OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GFX_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_GFX_COMPOSITOR_LAYER_H_ |
6 #define UI_GFX_COMPOSITOR_LAYER_H_ | 6 #define UI_GFX_COMPOSITOR_LAYER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebContentLa
yerClient.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebContentLa
yerClient.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebLayer.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebLayer.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebLayerClie
nt.h" | |
19 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
20 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
21 #include "ui/gfx/compositor/compositor.h" | 20 #include "ui/gfx/compositor/compositor.h" |
22 #include "ui/gfx/compositor/layer_animation_delegate.h" | 21 #include "ui/gfx/compositor/layer_animation_delegate.h" |
23 #include "ui/gfx/compositor/layer_delegate.h" | 22 #include "ui/gfx/compositor/layer_delegate.h" |
24 | 23 |
25 class SkCanvas; | 24 class SkCanvas; |
26 | 25 |
27 namespace ui { | 26 namespace ui { |
28 | 27 |
29 class Compositor; | 28 class Compositor; |
30 class LayerAnimator; | 29 class LayerAnimator; |
31 class Texture; | 30 class Texture; |
32 | 31 |
33 // Layer manages a texture, transform and a set of child Layers. Any View that | 32 // Layer manages a texture, transform and a set of child Layers. Any View that |
34 // has enabled layers ends up creating a Layer to manage the texture. | 33 // has enabled layers ends up creating a Layer to manage the texture. |
35 // A Layer can also be created without a texture, in which case it renders | 34 // A Layer can also be created without a texture, in which case it renders |
36 // nothing and is simply used as a node in a hierarchy of layers. | 35 // nothing and is simply used as a node in a hierarchy of layers. |
37 // | 36 // |
38 // NOTE: unlike Views, each Layer does *not* own its children views. If you | 37 // NOTE: unlike Views, each Layer does *not* own its children views. If you |
39 // delete a Layer and it has children, the parent of each child layer is set to | 38 // delete a Layer and it has children, the parent of each child layer is set to |
40 // NULL, but the children are not deleted. | 39 // NULL, but the children are not deleted. |
41 class COMPOSITOR_EXPORT Layer : | 40 class COMPOSITOR_EXPORT Layer : |
42 public LayerAnimationDelegate, | 41 public LayerAnimationDelegate, |
43 NON_EXPORTED_BASE(public WebKit::WebLayerClient), | |
44 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { | 42 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { |
45 public: | 43 public: |
46 enum LayerType { | 44 enum LayerType { |
47 LAYER_HAS_NO_TEXTURE = 0, | 45 LAYER_HAS_NO_TEXTURE = 0, |
48 LAYER_HAS_TEXTURE = 1 | 46 LAYER_HAS_TEXTURE = 1 |
49 }; | 47 }; |
50 | 48 |
51 Layer(); | 49 Layer(); |
52 explicit Layer(LayerType type); | 50 explicit Layer(LayerType type); |
53 virtual ~Layer(); | 51 virtual ~Layer(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void Draw(); | 181 void Draw(); |
184 | 182 |
185 // Draws a tree of Layers, by calling Draw() on each in the hierarchy starting | 183 // Draws a tree of Layers, by calling Draw() on each in the hierarchy starting |
186 // with the receiver. | 184 // with the receiver. |
187 void DrawTree(); | 185 void DrawTree(); |
188 | 186 |
189 // Sometimes the Layer is being updated by something other than SetCanvas | 187 // Sometimes the Layer is being updated by something other than SetCanvas |
190 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). | 188 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). |
191 bool layer_updated_externally() const { return layer_updated_externally_; } | 189 bool layer_updated_externally() const { return layer_updated_externally_; } |
192 | 190 |
193 // WebLayerClient | |
194 virtual void notifyNeedsComposite(); | |
195 | |
196 // WebContentLayerClient | 191 // WebContentLayerClient |
197 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); | 192 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); |
198 | 193 |
199 #if defined(USE_WEBKIT_COMPOSITOR) | 194 #if defined(USE_WEBKIT_COMPOSITOR) |
200 WebKit::WebLayer web_layer() { return web_layer_; } | 195 WebKit::WebLayer web_layer() { return web_layer_; } |
201 #endif | 196 #endif |
202 | 197 |
203 private: | 198 private: |
204 struct LayerProperties { | 199 struct LayerProperties { |
205 public: | 200 public: |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 bool web_layer_is_accelerated_; | 343 bool web_layer_is_accelerated_; |
349 bool show_debug_borders_; | 344 bool show_debug_borders_; |
350 #endif | 345 #endif |
351 | 346 |
352 DISALLOW_COPY_AND_ASSIGN(Layer); | 347 DISALLOW_COPY_AND_ASSIGN(Layer); |
353 }; | 348 }; |
354 | 349 |
355 } // namespace ui | 350 } // namespace ui |
356 | 351 |
357 #endif // UI_GFX_COMPOSITOR_LAYER_H_ | 352 #endif // UI_GFX_COMPOSITOR_LAYER_H_ |
OLD | NEW |