Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: ui/compositor/layer.h

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 NON_EXPORTED_BASE(public cc::TextureLayerClient), 71 NON_EXPORTED_BASE(public cc::TextureLayerClient),
72 NON_EXPORTED_BASE(public cc::LayerClient), 72 NON_EXPORTED_BASE(public cc::LayerClient),
73 NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) { 73 NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) {
74 public: 74 public:
75 Layer(); 75 Layer();
76 explicit Layer(LayerType type); 76 explicit Layer(LayerType type);
77 ~Layer() override; 77 ~Layer() override;
78 78
79 static bool UsingPictureLayer(); 79 static bool UsingPictureLayer();
80 80
81 static const cc::LayerSettings& UILayerSettings();
82 static void SetUILayerSettings(const cc::LayerSettings& settings);
83
81 // Retrieves the Layer's compositor. The Layer will walk up its parent chain 84 // 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. 85 // to locate it. Returns NULL if the Layer is not attached to a compositor.
83 Compositor* GetCompositor() { 86 Compositor* GetCompositor() {
84 return const_cast<Compositor*>( 87 return const_cast<Compositor*>(
85 const_cast<const Layer*>(this)->GetCompositor()); 88 const_cast<const Layer*>(this)->GetCompositor());
86 } 89 }
87 const Compositor* GetCompositor() const; 90 const Compositor* GetCompositor() const;
88 91
89 // Called by the compositor when the Layer is set as its root Layer. This can 92 // Called by the compositor when the Layer is set as its root Layer. This can
90 // only ever be called on the root layer. 93 // only ever be called on the root layer.
91 void SetCompositor(Compositor* compositor); 94 void SetCompositor(Compositor* compositor,
95 scoped_refptr<cc::Layer> root_layer);
96 void ResetCompositor();
92 97
93 LayerDelegate* delegate() { return delegate_; } 98 LayerDelegate* delegate() { return delegate_; }
94 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } 99 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; }
95 100
96 LayerOwner* owner() { return owner_; } 101 LayerOwner* owner() { return owner_; }
97 102
98 // Adds a new Layer to this Layer. 103 // Adds a new Layer to this Layer.
99 void Add(Layer* child); 104 void Add(Layer* child);
100 105
101 // Removes a Layer from this Layer. 106 // Removes a Layer from this Layer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void SetAnimator(LayerAnimator* animator); 139 void SetAnimator(LayerAnimator* animator);
135 140
136 // Returns the layer's animator. Creates a default animator of one has not 141 // Returns the layer's animator. Creates a default animator of one has not
137 // been set. Will not return NULL. 142 // been set. Will not return NULL.
138 LayerAnimator* GetAnimator(); 143 LayerAnimator* GetAnimator();
139 144
140 // The transform, relative to the parent. 145 // The transform, relative to the parent.
141 void SetTransform(const gfx::Transform& transform); 146 void SetTransform(const gfx::Transform& transform);
142 gfx::Transform transform() const; 147 gfx::Transform transform() const;
143 148
149 gfx::PointF position() const { return cc_layer_->position(); }
150
144 // Return the target transform if animator is running, or the current 151 // Return the target transform if animator is running, or the current
145 // transform otherwise. 152 // transform otherwise.
146 gfx::Transform GetTargetTransform() const; 153 gfx::Transform GetTargetTransform() const;
147 154
148 // The bounds, relative to the parent. 155 // The bounds, relative to the parent.
149 void SetBounds(const gfx::Rect& bounds); 156 void SetBounds(const gfx::Rect& bounds);
150 const gfx::Rect& bounds() const { return bounds_; } 157 const gfx::Rect& bounds() const { return bounds_; }
151 158
152 // The offset from our parent (stored in bounds.origin()) is an integer but we 159 // 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. 160 // 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
343 void PaintContents( 350 void PaintContents(
344 SkCanvas* canvas, 351 SkCanvas* canvas,
345 const gfx::Rect& clip, 352 const gfx::Rect& clip,
346 ContentLayerClient::PaintingControlSetting painting_control) override; 353 ContentLayerClient::PaintingControlSetting painting_control) override;
347 void PaintContentsToDisplayList( 354 void PaintContentsToDisplayList(
348 cc::DisplayItemList* display_list, 355 cc::DisplayItemList* display_list,
349 const gfx::Rect& clip, 356 const gfx::Rect& clip,
350 ContentLayerClient::PaintingControlSetting painting_control) override; 357 ContentLayerClient::PaintingControlSetting painting_control) override;
351 bool FillsBoundsCompletely() const override; 358 bool FillsBoundsCompletely() const override;
352 359
353 cc::Layer* cc_layer() { return cc_layer_; } 360 cc::Layer* cc_layer_for_testing() { return cc_layer_; }
354 361
355 // TextureLayerClient 362 // TextureLayerClient
356 bool PrepareTextureMailbox( 363 bool PrepareTextureMailbox(
357 cc::TextureMailbox* mailbox, 364 cc::TextureMailbox* mailbox,
358 scoped_ptr<cc::SingleReleaseCallback>* release_callback, 365 scoped_ptr<cc::SingleReleaseCallback>* release_callback,
359 bool use_shared_memory) override; 366 bool use_shared_memory) override;
360 367
361 float device_scale_factor() const { return device_scale_factor_; } 368 float device_scale_factor() const { return device_scale_factor_; }
362 369
363 // Forces a render surface to be used on this layer. This has no positive 370 // 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
531 // The size of the frame or texture in DIP, set when SetShowDelegatedContent 538 // The size of the frame or texture in DIP, set when SetShowDelegatedContent
532 // or SetTextureMailbox was called. 539 // or SetTextureMailbox was called.
533 gfx::Size frame_size_in_dip_; 540 gfx::Size frame_size_in_dip_;
534 541
535 DISALLOW_COPY_AND_ASSIGN(Layer); 542 DISALLOW_COPY_AND_ASSIGN(Layer);
536 }; 543 };
537 544
538 } // namespace ui 545 } // namespace ui
539 546
540 #endif // UI_COMPOSITOR_LAYER_H_ 547 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698