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

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: Rebase. Fix code review issues. 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void SetCompositorRootCCLayer(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
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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 float GetGrayscaleForAnimation() const override; 413 float GetGrayscaleForAnimation() const override;
410 SkColor GetColorForAnimation() const override; 414 SkColor GetColorForAnimation() const override;
411 float GetDeviceScaleFactor() const override; 415 float GetDeviceScaleFactor() const override;
412 void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) override; 416 void AddThreadedAnimation(scoped_ptr<cc::Animation> animation) override;
413 void RemoveThreadedAnimation(int animation_id) override; 417 void RemoveThreadedAnimation(int animation_id) override;
414 LayerAnimatorCollection* GetLayerAnimatorCollection() override; 418 LayerAnimatorCollection* GetLayerAnimatorCollection() override;
415 419
416 // Creates a corresponding composited layer for |type_|. 420 // Creates a corresponding composited layer for |type_|.
417 void CreateCcLayer(); 421 void CreateCcLayer();
418 422
423 // Attach/Detach CC Layer animation event observers.
424 void AttachAnimationObservers();
425 void DetachAnimationObservers();
426
419 // Recomputes and sets to |cc_layer_|. 427 // Recomputes and sets to |cc_layer_|.
420 void RecomputeDrawsContentAndUVRect(); 428 void RecomputeDrawsContentAndUVRect();
421 void RecomputePosition(); 429 void RecomputePosition();
422 430
423 // Set all filters which got applied to the layer. 431 // Set all filters which got applied to the layer.
424 void SetLayerFilters(); 432 void SetLayerFilters();
425 433
426 // Set all filters which got applied to the layer background. 434 // Set all filters which got applied to the layer background.
427 void SetLayerBackgroundFilters(); 435 void SetLayerBackgroundFilters();
428 436
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // The size of the frame or texture in DIP, set when SetShowDelegatedContent 539 // The size of the frame or texture in DIP, set when SetShowDelegatedContent
532 // or SetTextureMailbox was called. 540 // or SetTextureMailbox was called.
533 gfx::Size frame_size_in_dip_; 541 gfx::Size frame_size_in_dip_;
534 542
535 DISALLOW_COPY_AND_ASSIGN(Layer); 543 DISALLOW_COPY_AND_ASSIGN(Layer);
536 }; 544 };
537 545
538 } // namespace ui 546 } // namespace ui
539 547
540 #endif // UI_COMPOSITOR_LAYER_H_ 548 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW
« no previous file with comments | « ui/compositor/dip_util.cc ('k') | ui/compositor/layer.cc » ('j') | ui/compositor/layer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698