| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
| 6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Retrieves the Layer's compositor. The Layer will walk up its parent chain | 81 // Retrieves the Layer's compositor. The Layer will walk up its parent chain |
| 82 // to locate it. Returns NULL if the Layer is not attached to a compositor. | 82 // to locate it. Returns NULL if the Layer is not attached to a compositor. |
| 83 Compositor* GetCompositor() { | 83 Compositor* GetCompositor() { |
| 84 return const_cast<Compositor*>( | 84 return const_cast<Compositor*>( |
| 85 const_cast<const Layer*>(this)->GetCompositor()); | 85 const_cast<const Layer*>(this)->GetCompositor()); |
| 86 } | 86 } |
| 87 const Compositor* GetCompositor() const; | 87 const Compositor* GetCompositor() const; |
| 88 | 88 |
| 89 // Called by the compositor when the Layer is set as its root Layer. This can | 89 // Called by the compositor when the Layer is set as its root Layer. This can |
| 90 // only ever be called on the root layer. | 90 // only ever be called on the root layer. |
| 91 void SetCompositor(Compositor* compositor); | 91 void SetCompositor(Compositor* compositor, |
| 92 scoped_refptr<cc::Layer> root_layer); |
| 93 void ResetCompositor(); |
| 92 | 94 |
| 93 LayerDelegate* delegate() { return delegate_; } | 95 LayerDelegate* delegate() { return delegate_; } |
| 94 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } | 96 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } |
| 95 | 97 |
| 96 LayerOwner* owner() { return owner_; } | 98 LayerOwner* owner() { return owner_; } |
| 97 | 99 |
| 98 // Adds a new Layer to this Layer. | 100 // Adds a new Layer to this Layer. |
| 99 void Add(Layer* child); | 101 void Add(Layer* child); |
| 100 | 102 |
| 101 // Removes a Layer from this Layer. | 103 // Removes a Layer from this Layer. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void SetAnimator(LayerAnimator* animator); | 136 void SetAnimator(LayerAnimator* animator); |
| 135 | 137 |
| 136 // Returns the layer's animator. Creates a default animator of one has not | 138 // Returns the layer's animator. Creates a default animator of one has not |
| 137 // been set. Will not return NULL. | 139 // been set. Will not return NULL. |
| 138 LayerAnimator* GetAnimator(); | 140 LayerAnimator* GetAnimator(); |
| 139 | 141 |
| 140 // The transform, relative to the parent. | 142 // The transform, relative to the parent. |
| 141 void SetTransform(const gfx::Transform& transform); | 143 void SetTransform(const gfx::Transform& transform); |
| 142 gfx::Transform transform() const; | 144 gfx::Transform transform() const; |
| 143 | 145 |
| 146 gfx::PointF position() const { return cc_layer_->position(); } |
| 147 |
| 144 // Return the target transform if animator is running, or the current | 148 // Return the target transform if animator is running, or the current |
| 145 // transform otherwise. | 149 // transform otherwise. |
| 146 gfx::Transform GetTargetTransform() const; | 150 gfx::Transform GetTargetTransform() const; |
| 147 | 151 |
| 148 // The bounds, relative to the parent. | 152 // The bounds, relative to the parent. |
| 149 void SetBounds(const gfx::Rect& bounds); | 153 void SetBounds(const gfx::Rect& bounds); |
| 150 const gfx::Rect& bounds() const { return bounds_; } | 154 const gfx::Rect& bounds() const { return bounds_; } |
| 151 | 155 |
| 152 // The offset from our parent (stored in bounds.origin()) is an integer but we | 156 // The offset from our parent (stored in bounds.origin()) is an integer but we |
| 153 // may need to be at a fractional pixel offset to align properly on screen. | 157 // may need to be at a fractional pixel offset to align properly on screen. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 void PaintContents( | 347 void PaintContents( |
| 344 SkCanvas* canvas, | 348 SkCanvas* canvas, |
| 345 const gfx::Rect& clip, | 349 const gfx::Rect& clip, |
| 346 ContentLayerClient::PaintingControlSetting painting_control) override; | 350 ContentLayerClient::PaintingControlSetting painting_control) override; |
| 347 void PaintContentsToDisplayList( | 351 void PaintContentsToDisplayList( |
| 348 cc::DisplayItemList* display_list, | 352 cc::DisplayItemList* display_list, |
| 349 const gfx::Rect& clip, | 353 const gfx::Rect& clip, |
| 350 ContentLayerClient::PaintingControlSetting painting_control) override; | 354 ContentLayerClient::PaintingControlSetting painting_control) override; |
| 351 bool FillsBoundsCompletely() const override; | 355 bool FillsBoundsCompletely() const override; |
| 352 | 356 |
| 353 cc::Layer* cc_layer() { return cc_layer_; } | 357 cc::Layer* cc_layer_for_testing() { return cc_layer_; } |
| 354 | 358 |
| 355 // TextureLayerClient | 359 // TextureLayerClient |
| 356 bool PrepareTextureMailbox( | 360 bool PrepareTextureMailbox( |
| 357 cc::TextureMailbox* mailbox, | 361 cc::TextureMailbox* mailbox, |
| 358 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 362 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
| 359 bool use_shared_memory) override; | 363 bool use_shared_memory) override; |
| 360 | 364 |
| 361 float device_scale_factor() const { return device_scale_factor_; } | 365 float device_scale_factor() const { return device_scale_factor_; } |
| 362 | 366 |
| 363 // Forces a render surface to be used on this layer. This has no positive | 367 // Forces a render surface to be used on this layer. This has no positive |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 535 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
| 532 // or SetTextureMailbox was called. | 536 // or SetTextureMailbox was called. |
| 533 gfx::Size frame_size_in_dip_; | 537 gfx::Size frame_size_in_dip_; |
| 534 | 538 |
| 535 DISALLOW_COPY_AND_ASSIGN(Layer); | 539 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 536 }; | 540 }; |
| 537 | 541 |
| 538 } // namespace ui | 542 } // namespace ui |
| 539 | 543 |
| 540 #endif // UI_COMPOSITOR_LAYER_H_ | 544 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |