| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // See description in View for details | 143 // See description in View for details |
| 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. | |
| 156 const Compositor* compositor() const { return compositor_; } | |
| 157 Compositor* compositor() { return compositor_; } | |
| 158 | |
| 159 const ui::Texture* texture() const { return texture_.get(); } | 153 const ui::Texture* texture() const { return texture_.get(); } |
| 160 | 154 |
| 161 // |texture| cannot be NULL, and this function cannot be called more than | 155 // |texture| cannot be NULL, and this function cannot be called more than |
| 162 // once. | 156 // once. |
| 163 // TODO(beng): This can be removed from the API when we are in a | 157 // TODO(beng): This can be removed from the API when we are in a |
| 164 // single-compositor world. | 158 // single-compositor world. |
| 165 void SetExternalTexture(ui::Texture* texture); | 159 void SetExternalTexture(ui::Texture* texture); |
| 166 | 160 |
| 167 // Resets the canvas of the texture. | 161 // Resets the canvas of the texture. |
| 168 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); | 162 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 WebKit::WebLayer web_layer_; | 328 WebKit::WebLayer web_layer_; |
| 335 bool web_layer_is_accelerated_; | 329 bool web_layer_is_accelerated_; |
| 336 #endif | 330 #endif |
| 337 | 331 |
| 338 DISALLOW_COPY_AND_ASSIGN(Layer); | 332 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 339 }; | 333 }; |
| 340 | 334 |
| 341 } // namespace ui | 335 } // namespace ui |
| 342 | 336 |
| 343 #endif // UI_GFX_COMPOSITOR_LAYER_H_ | 337 #endif // UI_GFX_COMPOSITOR_LAYER_H_ |
| OLD | NEW |