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 // to locate it. Returns NULL if the Layer is not attached to a compositor. | 81 // to locate it. Returns NULL if the Layer is not attached to a compositor. |
82 Compositor* GetCompositor() { | 82 Compositor* GetCompositor() { |
83 return const_cast<Compositor*>( | 83 return const_cast<Compositor*>( |
84 const_cast<const Layer*>(this)->GetCompositor()); | 84 const_cast<const Layer*>(this)->GetCompositor()); |
85 } | 85 } |
86 const Compositor* GetCompositor() const; | 86 const Compositor* GetCompositor() const; |
87 | 87 |
88 // Called by the compositor when the Layer is set as its root Layer. This can | 88 // Called by the compositor when the Layer is set as its root Layer. This can |
89 // only ever be called on the root layer. | 89 // only ever be called on the root layer. |
90 void SetCompositor(Compositor* compositor); | 90 void SetCompositor(Compositor* compositor); |
91 void SetCompositorRootLayer(scoped_refptr<cc::Layer> root_layer); | |
ajuma
2015/04/24 16:02:16
SetCompositorRootCCLayer maybe? (so the difference
loyso (OOO)
2015/04/27 06:34:08
Done.
| |
92 void ResetCompositor(); | |
91 | 93 |
92 LayerDelegate* delegate() { return delegate_; } | 94 LayerDelegate* delegate() { return delegate_; } |
93 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } | 95 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } |
94 | 96 |
95 LayerOwner* owner() { return owner_; } | 97 LayerOwner* owner() { return owner_; } |
96 | 98 |
97 // Adds a new Layer to this Layer. | 99 // Adds a new Layer to this Layer. |
98 void Add(Layer* child); | 100 void Add(Layer* child); |
99 | 101 |
100 // Removes a Layer from this Layer. | 102 // Removes a Layer from this Layer. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 void SetAnimator(LayerAnimator* animator); | 135 void SetAnimator(LayerAnimator* animator); |
134 | 136 |
135 // Returns the layer's animator. Creates a default animator of one has not | 137 // Returns the layer's animator. Creates a default animator of one has not |
136 // been set. Will not return NULL. | 138 // been set. Will not return NULL. |
137 LayerAnimator* GetAnimator(); | 139 LayerAnimator* GetAnimator(); |
138 | 140 |
139 // The transform, relative to the parent. | 141 // The transform, relative to the parent. |
140 void SetTransform(const gfx::Transform& transform); | 142 void SetTransform(const gfx::Transform& transform); |
141 gfx::Transform transform() const; | 143 gfx::Transform transform() const; |
142 | 144 |
145 gfx::PointF position() const { return cc_layer_->position(); } | |
146 | |
143 // Return the target transform if animator is running, or the current | 147 // Return the target transform if animator is running, or the current |
144 // transform otherwise. | 148 // transform otherwise. |
145 gfx::Transform GetTargetTransform() const; | 149 gfx::Transform GetTargetTransform() const; |
146 | 150 |
147 // The bounds, relative to the parent. | 151 // The bounds, relative to the parent. |
148 void SetBounds(const gfx::Rect& bounds); | 152 void SetBounds(const gfx::Rect& bounds); |
149 const gfx::Rect& bounds() const { return bounds_; } | 153 const gfx::Rect& bounds() const { return bounds_; } |
150 | 154 |
151 // The offset from our parent (stored in bounds.origin()) is an integer but we | 155 // The offset from our parent (stored in bounds.origin()) is an integer but we |
152 // may need to be at a fractional pixel offset to align properly on screen. | 156 // may need to be at a fractional pixel offset to align properly on screen. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 // ContentLayerClient | 344 // ContentLayerClient |
341 void PaintContents( | 345 void PaintContents( |
342 SkCanvas* canvas, | 346 SkCanvas* canvas, |
343 const gfx::Rect& clip, | 347 const gfx::Rect& clip, |
344 ContentLayerClient::PaintingControlSetting painting_control) override; | 348 ContentLayerClient::PaintingControlSetting painting_control) override; |
345 scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList( | 349 scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList( |
346 const gfx::Rect& clip, | 350 const gfx::Rect& clip, |
347 ContentLayerClient::PaintingControlSetting painting_control) override; | 351 ContentLayerClient::PaintingControlSetting painting_control) override; |
348 bool FillsBoundsCompletely() const override; | 352 bool FillsBoundsCompletely() const override; |
349 | 353 |
350 cc::Layer* cc_layer() { return cc_layer_; } | 354 cc::Layer* cc_layer_for_testing() { return cc_layer_; } |
351 | 355 |
352 // TextureLayerClient | 356 // TextureLayerClient |
353 bool PrepareTextureMailbox( | 357 bool PrepareTextureMailbox( |
354 cc::TextureMailbox* mailbox, | 358 cc::TextureMailbox* mailbox, |
355 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 359 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
356 bool use_shared_memory) override; | 360 bool use_shared_memory) override; |
357 | 361 |
358 float device_scale_factor() const { return device_scale_factor_; } | 362 float device_scale_factor() const { return device_scale_factor_; } |
359 | 363 |
360 // Forces a render surface to be used on this layer. This has no positive | 364 // Forces a render surface to be used on this layer. This has no positive |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 float GetGrayscaleForAnimation() const override; | 410 float GetGrayscaleForAnimation() const override; |
407 SkColor GetColorForAnimation() const override; | 411 SkColor GetColorForAnimation() const override; |
408 float GetDeviceScaleFactor() const override; | 412 float GetDeviceScaleFactor() const override; |
409 void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) override; | 413 void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) override; |
410 void RemoveThreadedAnimation(int animation_id) override; | 414 void RemoveThreadedAnimation(int animation_id) override; |
411 LayerAnimatorCollection* GetLayerAnimatorCollection() override; | 415 LayerAnimatorCollection* GetLayerAnimatorCollection() override; |
412 | 416 |
413 // Creates a corresponding composited layer for |type_|. | 417 // Creates a corresponding composited layer for |type_|. |
414 void CreateCcLayer(); | 418 void CreateCcLayer(); |
415 | 419 |
420 // Attach/Detach CC Layer animation event observers. | |
421 void AttachAnimationObservers(); | |
422 void DetachAnimationObservers(); | |
423 | |
416 // Recomputes and sets to |cc_layer_|. | 424 // Recomputes and sets to |cc_layer_|. |
417 void RecomputeDrawsContentAndUVRect(); | 425 void RecomputeDrawsContentAndUVRect(); |
418 void RecomputePosition(); | 426 void RecomputePosition(); |
419 | 427 |
420 // Set all filters which got applied to the layer. | 428 // Set all filters which got applied to the layer. |
421 void SetLayerFilters(); | 429 void SetLayerFilters(); |
422 | 430 |
423 // Set all filters which got applied to the layer background. | 431 // Set all filters which got applied to the layer background. |
424 void SetLayerBackgroundFilters(); | 432 void SetLayerBackgroundFilters(); |
425 | 433 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
528 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 536 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
529 // or SetTextureMailbox was called. | 537 // or SetTextureMailbox was called. |
530 gfx::Size frame_size_in_dip_; | 538 gfx::Size frame_size_in_dip_; |
531 | 539 |
532 DISALLOW_COPY_AND_ASSIGN(Layer); | 540 DISALLOW_COPY_AND_ASSIGN(Layer); |
533 }; | 541 }; |
534 | 542 |
535 } // namespace ui | 543 } // namespace ui |
536 | 544 |
537 #endif // UI_COMPOSITOR_LAYER_H_ | 545 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |