Index: ui/gfx/compositor/layer.h |
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h |
index 7abb0f3ad8f5cb44bdfe1a0ffcbaeacdfcf7f1df..78c57641a7b88df9eff4c89c1e97e564a5c07405 100644 |
--- a/ui/gfx/compositor/layer.h |
+++ b/ui/gfx/compositor/layer.h |
@@ -26,6 +26,20 @@ |
class SkCanvas; |
+namespace { |
sky
2011/10/25 21:44:09
Move this to the private section of Layer.
|
+ |
+// contains info for a layer with respect to the root layer. |
sky
2011/10/25 21:44:09
Contains
|
+struct LayerProperties { |
+ public: |
sky
2011/10/25 21:44:09
don't use a public section with structs.
|
+ ui::Layer* layer; |
+ ui::Transform transform_relative_to_root; |
+ float combined_opacity; |
+ |
+ // Copy and assignment are allowed. |
sky
2011/10/25 21:44:09
Remove this comment. Generally when we use structs
|
+}; |
+ |
+} // namespace |
+ |
namespace ui { |
class Animation; |
@@ -201,18 +215,31 @@ class COMPOSITOR_EXPORT Layer : |
// delegate. |
void UpdateLayerCanvas(); |
+ // Called to indicate that a layer's properties have changed and that the |
+ // holes for the layers must be recomputed. |
+ void SetNeedsToRecomputeHole(); |
+ |
+ // Resets |hole_rect_| to the empty rect for all layers below and |
+ // including this one. |
+ void ClearHoleRects(); |
+ |
+ // Does a preorder traversal of layers starting with this layer. Omits layers |
+ // which cannot punch a hole in another layer such as non visible layers |
+ // and layers which don't fill their bounds opaquely. |
+ void GeneratePreorderTraversal(std::vector<LayerProperties>* layer_traversal, |
+ const ui::Transform& current_transform, float current_opacity); |
sky
2011/10/25 21:44:09
When you wrap, you want each argument on its own l
|
+ |
// A hole in a layer is an area in the layer that does not get drawn |
// because this area is covered up with another layer which is known to be |
// opaque. |
// This method computes the dimension of the hole (if there is one) |
// based on whether one of its child nodes is always opaque. |
- // Note: For simplicity's sake, currently a hole is only created if the child |
- // view has no transform with respect to its parent. |
+ // Note: This method should only be called from the root. |
void RecomputeHole(); |
- // Returns true if the layer paints every pixel (fills_bounds_opaquely) |
- // and the alpha of the layer is 1.0f. |
- bool IsCompletelyOpaque() const; |
+ void set_hole_rect(const gfx::Rect& hole_rect) { |
+ hole_rect_ = hole_rect; |
+ } |
// Determines the regions that don't intersect |rect| and places the |
// result in |sides|. |
@@ -232,6 +259,9 @@ class COMPOSITOR_EXPORT Layer : |
const gfx::Rect& region_to_punch_out, |
std::vector<gfx::Rect>* sides); |
+ // Drops texture just for this layer. |
+ void DropTexture(); |
+ |
// Drop all textures for layers below and including this one. Called when |
// the layer is removed from a hierarchy. Textures will be re-generated if |
// the layer is subsequently re-attached and needs to be drawn. |
@@ -292,6 +322,8 @@ class COMPOSITOR_EXPORT Layer : |
gfx::Rect hole_rect_; |
+ bool recompute_hole_; |
+ |
gfx::Rect invalid_rect_; |
// If true the layer is always up to date. |