OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie
nt.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie
nt.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.
h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL
ayer.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
18 #include "third_party/skia/include/core/SkRegion.h" | 21 #include "third_party/skia/include/core/SkRegion.h" |
19 #include "ui/compositor/compositor.h" | 22 #include "ui/compositor/compositor.h" |
20 #include "ui/compositor/layer_animation_delegate.h" | 23 #include "ui/compositor/layer_animation_delegate.h" |
21 #include "ui/compositor/layer_delegate.h" | 24 #include "ui/compositor/layer_delegate.h" |
22 #include "ui/compositor/layer_type.h" | 25 #include "ui/compositor/layer_type.h" |
23 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
24 #include "ui/gfx/transform.h" | 27 #include "ui/gfx/transform.h" |
25 | 28 |
26 class SkCanvas; | 29 class SkCanvas; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 254 |
252 // WebContentLayerClient | 255 // WebContentLayerClient |
253 virtual void paintContents(WebKit::WebCanvas*, | 256 virtual void paintContents(WebKit::WebCanvas*, |
254 const WebKit::WebRect& clip, | 257 const WebKit::WebRect& clip, |
255 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) | 258 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) |
256 WebKit::WebFloatRect& opaque); | 259 WebKit::WebFloatRect& opaque); |
257 #else | 260 #else |
258 WebKit::WebRect& opaque); | 261 WebKit::WebRect& opaque); |
259 #endif | 262 #endif |
260 | 263 |
| 264 #if defined(WEBLAYER_IS_PURE_VIRTUAL) |
| 265 WebKit::WebLayer* web_layer() { return web_layer_; } |
| 266 #else |
261 WebKit::WebLayer web_layer() { return web_layer_; } | 267 WebKit::WebLayer web_layer() { return web_layer_; } |
| 268 #endif |
262 | 269 |
263 float device_scale_factor() const { return device_scale_factor_; } | 270 float device_scale_factor() const { return device_scale_factor_; } |
264 | 271 |
265 // Forces a render surface to be used on this layer. This has no positive | 272 // Forces a render surface to be used on this layer. This has no positive |
266 // impact, and is only used for benchmarking/testing purpose. | 273 // impact, and is only used for benchmarking/testing purpose. |
267 void SetForceRenderSurface(bool force); | 274 void SetForceRenderSurface(bool force); |
268 bool force_render_surface() const { return force_render_surface_; } | 275 bool force_render_surface() const { return force_render_surface_; } |
269 | 276 |
270 private: | 277 private: |
271 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than | 278 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // We keep this reference for the case that if the mask layer gets deleted | 373 // We keep this reference for the case that if the mask layer gets deleted |
367 // while attached to the main layer before the main layer is deleted. | 374 // while attached to the main layer before the main layer is deleted. |
368 Layer* layer_mask_back_link_; | 375 Layer* layer_mask_back_link_; |
369 | 376 |
370 std::string name_; | 377 std::string name_; |
371 | 378 |
372 LayerDelegate* delegate_; | 379 LayerDelegate* delegate_; |
373 | 380 |
374 scoped_ptr<LayerAnimator> animator_; | 381 scoped_ptr<LayerAnimator> animator_; |
375 | 382 |
| 383 #if defined(WEBLAYER_IS_PURE_VIRTUAL) |
| 384 // Ownership of the layer is held through one of the strongly typed layer |
| 385 // pointers, depending on which sort of layer this is. |
| 386 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
| 387 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
| 388 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 389 WebKit::WebLayer* web_layer_; |
| 390 #else |
376 WebKit::WebLayer web_layer_; | 391 WebKit::WebLayer web_layer_; |
| 392 #endif |
377 bool web_layer_is_accelerated_; | 393 bool web_layer_is_accelerated_; |
378 bool show_debug_borders_; | 394 bool show_debug_borders_; |
379 | 395 |
380 // If true, the layer scales the canvas and the texture with the device scale | 396 // If true, the layer scales the canvas and the texture with the device scale |
381 // factor as appropriate. When true, the texture size is in DIP. | 397 // factor as appropriate. When true, the texture size is in DIP. |
382 bool scale_content_; | 398 bool scale_content_; |
383 | 399 |
384 // A cached copy of |Compositor::device_scale_factor()|. | 400 // A cached copy of |Compositor::device_scale_factor()|. |
385 float device_scale_factor_; | 401 float device_scale_factor_; |
386 | 402 |
387 DISALLOW_COPY_AND_ASSIGN(Layer); | 403 DISALLOW_COPY_AND_ASSIGN(Layer); |
388 }; | 404 }; |
389 | 405 |
390 } // namespace ui | 406 } // namespace ui |
391 | 407 |
392 #endif // UI_COMPOSITOR_LAYER_H_ | 408 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |