Chromium Code Reviews| Index: ui/compositor/layer.h |
| diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h |
| index 7c7e4e32562c1899c69a438587c10cc6aaeafea6..7bbd3a69eaa6ceff648a7156372ba3ebe8e7f1b3 100644 |
| --- a/ui/compositor/layer.h |
| +++ b/ui/compositor/layer.h |
| @@ -76,6 +76,9 @@ class COMPOSITOR_EXPORT Layer |
| explicit Layer(LayerType type); |
| ~Layer() override; |
| + // Note that only solid color and surface content is copied. |
| + std::unique_ptr<Layer> Clone() const; |
|
danakj
2016/10/24 20:28:02
Can you group Clone() and Mirror() together? Peopl
Dominik Laskowski
2016/10/24 22:58:05
Done, but I think "Clone" and "Mirror" are self-ex
|
| + |
| // Retrieves the Layer's compositor. The Layer will walk up its parent chain |
| // to locate it. Returns NULL if the Layer is not attached to a compositor. |
| Compositor* GetCompositor() { |
| @@ -294,6 +297,13 @@ class COMPOSITOR_EXPORT Layer |
| float scale, |
| gfx::Size frame_size_in_dip); |
| + // Returns a new layer that mirrors this layer and is optionally synchronized |
| + // with the bounds thereof. Note that children are not mirrored, and that the |
| + // content is only mirrored if painted by a delegate or backed by a surface. |
| + std::unique_ptr<Layer> Mirror(); |
| + |
| + void set_sync_bounds(bool sync_bounds) { sync_bounds_ = sync_bounds; } |
| + |
| bool has_external_content() { |
| return texture_layer_.get() || surface_layer_.get(); |
| } |
| @@ -303,7 +313,7 @@ class COMPOSITOR_EXPORT Layer |
| // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
| void SetColor(SkColor color); |
| - SkColor GetTargetColor(); |
| + SkColor GetTargetColor() const; |
| SkColor background_color() const; |
| // Updates the nine patch layer's image, aperture and border. May only be |
| @@ -383,6 +393,7 @@ class COMPOSITOR_EXPORT Layer |
| private: |
| friend class LayerOwner; |
| + class LayerMirror; |
| void CollectAnimators(std::vector<scoped_refptr<LayerAnimator> >* animators); |
| @@ -433,6 +444,8 @@ class COMPOSITOR_EXPORT Layer |
| void SetCompositorForAnimatorsInTree(Compositor* compositor); |
| void ResetCompositorForAnimatorsInTree(Compositor* compositor); |
| + void OnMirrorDestroyed(LayerMirror* mirror); |
| + |
| const LayerType type_; |
| Compositor* compositor_; |
| @@ -442,6 +455,11 @@ class COMPOSITOR_EXPORT Layer |
| // This layer's children, in bottom-to-top stacking order. |
| std::vector<Layer*> children_; |
| + std::vector<std::unique_ptr<LayerMirror>> mirrors_; |
| + |
| + // If true, changes to the bounds of this layer are propagated to mirrors. |
| + bool sync_bounds_ = false; |
| + |
| gfx::Rect bounds_; |
| gfx::Vector2dF subpixel_position_offset_; |