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

Side by Side Diff: cc/layer_impl.h

Issue 11348256: Use an auxiliary list of animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_animation_controller_unittest.cc ('k') | cc/layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 CC_LAYER_IMPL_H_ 5 #ifndef CC_LAYER_IMPL_H_
6 #define CC_LAYER_IMPL_H_ 6 #define CC_LAYER_IMPL_H_
7 7
8 #include <public/WebFilterOperations.h> 8 #include <public/WebFilterOperations.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 21 matching lines...) Expand all
32 class LayerSorter; 32 class LayerSorter;
33 class LayerTreeHostImpl; 33 class LayerTreeHostImpl;
34 class QuadSink; 34 class QuadSink;
35 class Renderer; 35 class Renderer;
36 class ScrollbarAnimationController; 36 class ScrollbarAnimationController;
37 class ScrollbarLayerImpl; 37 class ScrollbarLayerImpl;
38 class Layer; 38 class Layer;
39 39
40 struct AppendQuadsData; 40 struct AppendQuadsData;
41 41
42 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { 42 class CC_EXPORT LayerImpl {
43 public: 43 public:
44 typedef ScopedPtrVector<LayerImpl> LayerList; 44 typedef ScopedPtrVector<LayerImpl> LayerList;
45 45
46 static scoped_ptr<LayerImpl> create(int id) 46 static scoped_ptr<LayerImpl> create(int id)
47 { 47 {
48 return make_scoped_ptr(new LayerImpl(id)); 48 return make_scoped_ptr(new LayerImpl(id));
49 } 49 }
50 50
51 virtual ~LayerImpl(); 51 virtual ~LayerImpl();
52 52
53 // LayerAnimationControllerClient implementation. 53 int id() const;
54 virtual int id() const OVERRIDE;
55 virtual void setOpacityFromAnimation(float) OVERRIDE;
56 virtual float opacity() const OVERRIDE;
57 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE;
58 virtual const gfx::Transform& transform() const OVERRIDE;
59 54
60 // Tree structure. 55 // Tree structure.
61 LayerImpl* parent() { return m_parent; } 56 LayerImpl* parent() { return m_parent; }
62 const LayerImpl* parent() const { return m_parent; } 57 const LayerImpl* parent() const { return m_parent; }
63 const LayerList& children() const { return m_children; } 58 const LayerList& children() const { return m_children; }
64 void addChild(scoped_ptr<LayerImpl>); 59 void addChild(scoped_ptr<LayerImpl>);
65 void removeFromParent(); 60 void removeFromParent();
66 void removeAllChildren(); 61 void removeAllChildren();
67 62
68 void setMaskLayer(scoped_ptr<LayerImpl>); 63 void setMaskLayer(scoped_ptr<LayerImpl>);
69 LayerImpl* maskLayer() { return m_maskLayer.get(); } 64 LayerImpl* maskLayer() { return m_maskLayer.get(); }
70 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } 65 const LayerImpl* maskLayer() const { return m_maskLayer.get(); }
71 66
72 void setReplicaLayer(scoped_ptr<LayerImpl>); 67 void setReplicaLayer(scoped_ptr<LayerImpl>);
73 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } 68 LayerImpl* replicaLayer() { return m_replicaLayer.get(); }
74 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } 69 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
75 70
76 bool hasMask() const { return m_maskLayer; } 71 bool hasMask() const { return m_maskLayer; }
77 bool hasReplica() const { return m_replicaLayer; } 72 bool hasReplica() const { return m_replicaLayer; }
78 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep licaLayer->m_maskLayer); } 73 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep licaLayer->m_maskLayer); }
79 74
80 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } 75 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; }
81 void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } 76 void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl);
82 77
83 scoped_ptr<SharedQuadState> createSharedQuadState() const; 78 scoped_ptr<SharedQuadState> createSharedQuadState() const;
84 // willDraw must be called before appendQuads. If willDraw is called, 79 // willDraw must be called before appendQuads. If willDraw is called,
85 // didDraw is guaranteed to be called before another willDraw or before 80 // didDraw is guaranteed to be called before another willDraw or before
86 // the layer is destroyed. To enforce this, any class that overrides 81 // the layer is destroyed. To enforce this, any class that overrides
87 // willDraw/didDraw must call the base class version. 82 // willDraw/didDraw must call the base class version.
88 virtual void willDraw(ResourceProvider*); 83 virtual void willDraw(ResourceProvider*);
89 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } 84 virtual void appendQuads(QuadSink&, AppendQuadsData&) { }
90 virtual void didDraw(ResourceProvider*); 85 virtual void didDraw(ResourceProvider*);
91 86
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void setFilter(const skia::RefPtr<SkImageFilter>&); 120 void setFilter(const skia::RefPtr<SkImageFilter>&);
126 skia::RefPtr<SkImageFilter> filter() const { return m_filter; } 121 skia::RefPtr<SkImageFilter> filter() const { return m_filter; }
127 122
128 void setMasksToBounds(bool); 123 void setMasksToBounds(bool);
129 bool masksToBounds() const { return m_masksToBounds; } 124 bool masksToBounds() const { return m_masksToBounds; }
130 125
131 void setContentsOpaque(bool); 126 void setContentsOpaque(bool);
132 bool contentsOpaque() const { return m_contentsOpaque; } 127 bool contentsOpaque() const { return m_contentsOpaque; }
133 128
134 void setOpacity(float); 129 void setOpacity(float);
130 float opacity() const;
135 bool opacityIsAnimating() const; 131 bool opacityIsAnimating() const;
136 132
137 void setPosition(const gfx::PointF&); 133 void setPosition(const gfx::PointF&);
138 const gfx::PointF& position() const { return m_position; } 134 const gfx::PointF& position() const { return m_position; }
139 135
140 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; } 136 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
141 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; } 137 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; }
142 138
143 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo ContainerLayer = fixedToContainerLayer;} 139 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo ContainerLayer = fixedToContainerLayer;}
144 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } 140 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 229
234 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo ardForMissingTiles = checkerboard; } 230 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo ardForMissingTiles = checkerboard; }
235 bool drawCheckerboardForMissingTiles() const; 231 bool drawCheckerboardForMissingTiles() const;
236 232
237 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi nt, InputHandlerClient::ScrollInputType) const; 233 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi nt, InputHandlerClient::ScrollInputType) const;
238 234
239 bool doubleSided() const { return m_doubleSided; } 235 bool doubleSided() const { return m_doubleSided; }
240 void setDoubleSided(bool); 236 void setDoubleSided(bool);
241 237
242 void setTransform(const gfx::Transform&); 238 void setTransform(const gfx::Transform&);
239 const gfx::Transform& transform() const;
243 bool transformIsAnimating() const; 240 bool transformIsAnimating() const;
244 241
245 const gfx::RectF& updateRect() const { return m_updateRect; } 242 const gfx::RectF& updateRect() const { return m_updateRect; }
246 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect ; } 243 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect ; }
247 244
248 std::string layerTreeAsText() const; 245 std::string layerTreeAsText() const;
249 246
250 void setStackingOrderChanged(bool); 247 void setStackingOrderChanged(bool);
251 248
252 bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIs AlwaysDamaged(); } 249 bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIs AlwaysDamaged(); }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 bool m_layerPropertyChanged; 334 bool m_layerPropertyChanged;
338 335
339 // Indicates that a property has changed on this layer that would not 336 // Indicates that a property has changed on this layer that would not
340 // affect the pixels on its target surface, but would require redrawing 337 // affect the pixels on its target surface, but would require redrawing
341 // but would require redrawing the targetSurface onto its ancestor targetSur face. 338 // but would require redrawing the targetSurface onto its ancestor targetSur face.
342 // For layers that do not own a surface this flag acts as m_layerPropertyCha nged. 339 // For layers that do not own a surface this flag acts as m_layerPropertyCha nged.
343 bool m_layerSurfacePropertyChanged; 340 bool m_layerSurfacePropertyChanged;
344 341
345 bool m_masksToBounds; 342 bool m_masksToBounds;
346 bool m_contentsOpaque; 343 bool m_contentsOpaque;
347 float m_opacity;
348 gfx::PointF m_position; 344 gfx::PointF m_position;
349 bool m_preserves3D; 345 bool m_preserves3D;
350 bool m_useParentBackfaceVisibility; 346 bool m_useParentBackfaceVisibility;
351 bool m_drawCheckerboardForMissingTiles; 347 bool m_drawCheckerboardForMissingTiles;
352 gfx::Transform m_sublayerTransform; 348 gfx::Transform m_sublayerTransform;
353 gfx::Transform m_transform;
354 bool m_useLCDText; 349 bool m_useLCDText;
355 350
356 bool m_drawsContent; 351 bool m_drawsContent;
357 bool m_forceRenderSurface; 352 bool m_forceRenderSurface;
358 353
359 // Set for the layer that other layers are fixed to. 354 // Set for the layer that other layers are fixed to.
360 bool m_isContainerForFixedPositionLayers; 355 bool m_isContainerForFixedPositionLayers;
361 // This is true if the layer should be fixed to the closest ancestor contain er. 356 // This is true if the layer should be fixed to the closest ancestor contain er.
362 bool m_fixedToContainerLayer; 357 bool m_fixedToContainerLayer;
363 358
(...skipping 16 matching lines...) Expand all
380 #ifndef NDEBUG 375 #ifndef NDEBUG
381 bool m_betweenWillDrawAndDidDraw; 376 bool m_betweenWillDrawAndDidDraw;
382 #endif 377 #endif
383 378
384 // Rect indicating what was repainted/updated during update. 379 // Rect indicating what was repainted/updated during update.
385 // Note that plugin layers bypass this and leave it empty. 380 // Note that plugin layers bypass this and leave it empty.
386 // Uses layer's content space. 381 // Uses layer's content space.
387 gfx::RectF m_updateRect; 382 gfx::RectF m_updateRect;
388 383
389 // Manages animations for this layer. 384 // Manages animations for this layer.
390 scoped_ptr<LayerAnimationController> m_layerAnimationController; 385 scoped_refptr<LayerAnimationController> m_layerAnimationController;
391 386
392 // Manages scrollbars for this layer 387 // Manages scrollbars for this layer
393 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; 388 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController;
394 389
395 // Group of properties that need to be computed based on the layer tree 390 // Group of properties that need to be computed based on the layer tree
396 // hierarchy before layers can be drawn. 391 // hierarchy before layers can be drawn.
397 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; 392 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties;
398 393
399 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 394 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
400 }; 395 };
401 396
402 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*); 397 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*);
403 398
404 } 399 }
405 400
406 #endif // CC_LAYER_IMPL_H_ 401 #endif // CC_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layer_animation_controller_unittest.cc ('k') | cc/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698