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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... | |
41 class COMPOSITOR_EXPORT Layer : | 41 class COMPOSITOR_EXPORT Layer : |
42 public LayerAnimationDelegate, | 42 public LayerAnimationDelegate, |
43 NON_EXPORTED_BASE(public WebKit::WebLayerClient), | 43 NON_EXPORTED_BASE(public WebKit::WebLayerClient), |
44 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { | 44 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { |
45 public: | 45 public: |
46 enum LayerType { | 46 enum LayerType { |
47 LAYER_HAS_NO_TEXTURE = 0, | 47 LAYER_HAS_NO_TEXTURE = 0, |
48 LAYER_HAS_TEXTURE = 1 | 48 LAYER_HAS_TEXTURE = 1 |
49 }; | 49 }; |
50 | 50 |
51 // |compositor| can be NULL, and will be set later when the Layer is added to | 51 Layer(); |
52 // a Compositor. | 52 explicit Layer(LayerType type); |
53 explicit Layer(Compositor* compositor); | |
54 Layer(Compositor* compositor, LayerType type); | |
55 virtual ~Layer(); | 53 virtual ~Layer(); |
56 | 54 |
57 // Retrieves the Layer's compositor. The Layer will walk up its parent chain | 55 // Retrieves the Layer's compositor. The Layer will walk up its parent chain |
58 // to locate it. Returns NULL if the Layer is not attached to a compositor. | 56 // to locate it. Returns NULL if the Layer is not attached to a compositor. |
59 Compositor* GetCompositor(); | 57 Compositor* GetCompositor(); |
60 | 58 |
61 // Called by the compositor when the Layer is set as its root Layer. This can | 59 // Called by the compositor when the Layer is set as its root Layer. This can |
62 // only ever be called on the root layer. | 60 // only ever be called on the root layer. |
63 void SetCompositor(Compositor* compositor); | 61 void SetCompositor(Compositor* compositor); |
64 | 62 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 void SetFillsBoundsOpaquely(bool fills_bounds_opaquely); | 144 void SetFillsBoundsOpaquely(bool fills_bounds_opaquely); |
147 bool fills_bounds_opaquely() const { return fills_bounds_opaquely_; } | 145 bool fills_bounds_opaquely() const { return fills_bounds_opaquely_; } |
148 | 146 |
149 // Returns the invalid rectangle. That is, the region of the layer that needs | 147 // Returns the invalid rectangle. That is, the region of the layer that needs |
150 // to be repainted. This is exposed for testing and isn't generally useful. | 148 // to be repainted. This is exposed for testing and isn't generally useful. |
151 const gfx::Rect& invalid_rect() const { return invalid_rect_; } | 149 const gfx::Rect& invalid_rect() const { return invalid_rect_; } |
152 | 150 |
153 const gfx::Rect& hole_rect() const { return hole_rect_; } | 151 const gfx::Rect& hole_rect() const { return hole_rect_; } |
154 | 152 |
155 // The compositor. | 153 // The compositor. |
156 const Compositor* compositor() const { return compositor_; } | 154 const Compositor* compositor() const { return compositor_; } |
sky
2011/11/15 04:57:04
Can these be removed? Seems error prone to use thi
piman
2011/11/15 22:06:33
Good idea. Done.
| |
157 Compositor* compositor() { return compositor_; } | 155 Compositor* compositor() { return compositor_; } |
158 | 156 |
159 const ui::Texture* texture() const { return texture_.get(); } | 157 const ui::Texture* texture() const { return texture_.get(); } |
160 | 158 |
161 // |texture| cannot be NULL, and this function cannot be called more than | 159 // |texture| cannot be NULL, and this function cannot be called more than |
162 // once. | 160 // once. |
163 // TODO(beng): This can be removed from the API when we are in a | 161 // TODO(beng): This can be removed from the API when we are in a |
164 // single-compositor world. | 162 // single-compositor world. |
165 void SetExternalTexture(ui::Texture* texture); | 163 void SetExternalTexture(ui::Texture* texture); |
166 | 164 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 WebKit::WebLayer web_layer_; | 308 WebKit::WebLayer web_layer_; |
311 bool web_layer_is_accelerated_; | 309 bool web_layer_is_accelerated_; |
312 #endif | 310 #endif |
313 | 311 |
314 DISALLOW_COPY_AND_ASSIGN(Layer); | 312 DISALLOW_COPY_AND_ASSIGN(Layer); |
315 }; | 313 }; |
316 | 314 |
317 } // namespace ui | 315 } // namespace ui |
318 | 316 |
319 #endif // UI_GFX_COMPOSITOR_LAYER_H_ | 317 #endif // UI_GFX_COMPOSITOR_LAYER_H_ |
OLD | NEW |