| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // The bounds, relative to the parent. | 96 // The bounds, relative to the parent. |
| 97 void SetBounds(const gfx::Rect& bounds); | 97 void SetBounds(const gfx::Rect& bounds); |
| 98 const gfx::Rect& bounds() const { return bounds_; } | 98 const gfx::Rect& bounds() const { return bounds_; } |
| 99 | 99 |
| 100 // The opacity of the layer. The opacity is applied to each pixel of the | 100 // The opacity of the layer. The opacity is applied to each pixel of the |
| 101 // texture (resulting alpha = opacity * alpha). | 101 // texture (resulting alpha = opacity * alpha). |
| 102 float opacity() const { return opacity_; } | 102 float opacity() const { return opacity_; } |
| 103 void SetOpacity(float opacity); | 103 void SetOpacity(float opacity); |
| 104 | 104 |
| 105 // Sets |visible_|. The Layer is drawn by Draw() only when visible_ is true. | 105 // Sets the visibility of the Layer. A Layer may be visible but not |
| 106 bool visible() const { return visible_; } | 106 // drawn. This happens if any ancestor of a Layer is not visible. |
| 107 void SetVisible(bool visible); | 107 void SetVisible(bool visible); |
| 108 | 108 |
| 109 // Returns true if this Layer is drawn. A Layer is drawn only if all ancestors |
| 110 // are visible. |
| 111 bool IsDrawn() const; |
| 112 |
| 109 // Returns true if this layer can have a texture (has_texture_ is true) | 113 // Returns true if this layer can have a texture (has_texture_ is true) |
| 110 // and is not completely obscured by a child. | 114 // and is not completely obscured by a child. |
| 111 bool ShouldDraw(); | 115 bool ShouldDraw(); |
| 112 | 116 |
| 113 // Converts a point from the coordinates of |source| to the coordinates of | 117 // Converts a point from the coordinates of |source| to the coordinates of |
| 114 // |target|. Necessarily, |source| and |target| must inhabit the same Layer | 118 // |target|. Necessarily, |source| and |target| must inhabit the same Layer |
| 115 // tree. | 119 // tree. |
| 116 static void ConvertPointToLayer(const Layer* source, | 120 static void ConvertPointToLayer(const Layer* source, |
| 117 const Layer* target, | 121 const Layer* target, |
| 118 gfx::Point* point); | 122 gfx::Point* point); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 scoped_refptr<ui::Texture> texture_; | 241 scoped_refptr<ui::Texture> texture_; |
| 238 | 242 |
| 239 Layer* parent_; | 243 Layer* parent_; |
| 240 | 244 |
| 241 std::vector<Layer*> children_; | 245 std::vector<Layer*> children_; |
| 242 | 246 |
| 243 ui::Transform transform_; | 247 ui::Transform transform_; |
| 244 | 248 |
| 245 gfx::Rect bounds_; | 249 gfx::Rect bounds_; |
| 246 | 250 |
| 251 // Visibility of this layer. See SetVisible/IsDrawn for more details. |
| 247 bool visible_; | 252 bool visible_; |
| 248 | 253 |
| 249 bool fills_bounds_opaquely_; | 254 bool fills_bounds_opaquely_; |
| 250 | 255 |
| 251 gfx::Rect hole_rect_; | 256 gfx::Rect hole_rect_; |
| 252 | 257 |
| 253 gfx::Rect invalid_rect_; | 258 gfx::Rect invalid_rect_; |
| 254 | 259 |
| 255 // If true the layer is always up to date. | 260 // If true the layer is always up to date. |
| 256 bool layer_updated_externally_; | 261 bool layer_updated_externally_; |
| 257 | 262 |
| 258 float opacity_; | 263 float opacity_; |
| 259 | 264 |
| 260 LayerDelegate* delegate_; | 265 LayerDelegate* delegate_; |
| 261 | 266 |
| 262 scoped_ptr<LayerAnimator> animator_; | 267 scoped_ptr<LayerAnimator> animator_; |
| 263 | 268 |
| 264 DISALLOW_COPY_AND_ASSIGN(Layer); | 269 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 265 }; | 270 }; |
| 266 | 271 |
| 267 } // namespace ui | 272 } // namespace ui |
| 268 | 273 |
| 269 #endif // UI_GFX_COMPOSITOR_LAYER_H_ | 274 #endif // UI_GFX_COMPOSITOR_LAYER_H_ |
| OLD | NEW |