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

Side by Side Diff: cc/layer.h

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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_H_ 5 #ifndef CC_LAYER_H_
6 #define CC_LAYER_H_ 6 #define CC_LAYER_H_
7 7
8 #include <public/WebFilterOperations.h>
9 #include <string>
10 #include <vector>
11
8 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
9 #include "cc/cc_export.h" 13 #include "cc/cc_export.h"
10 #include "cc/layer_animation_controller.h" 14 #include "cc/layer_animation_controller.h"
11 #include "cc/occlusion_tracker.h" 15 #include "cc/occlusion_tracker.h"
12 #include "cc/region.h" 16 #include "cc/region.h"
13 #include "cc/render_surface.h" 17 #include "cc/render_surface.h"
14 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
16 #include "ui/gfx/rect_f.h" 20 #include "ui/gfx/rect_f.h"
17 #include <public/WebFilterOperations.h> 21 #include "ui/gfx/transform.h"
18 #include <public/WebTransformationMatrix.h>
19 #include <string>
20 #include <vector>
21 22
22 namespace WebKit { 23 namespace WebKit {
23 class WebAnimationDelegate; 24 class WebAnimationDelegate;
24 class WebLayerScrollClient; 25 class WebLayerScrollClient;
25 } 26 }
26 27
27 class SkImageFilter; 28 class SkImageFilter;
28 29
29 namespace cc { 30 namespace cc {
30 31
(...skipping 13 matching lines...) Expand all
44 class CC_EXPORT Layer : public base::RefCounted<Layer>, public LayerAnimationCon trollerClient { 45 class CC_EXPORT Layer : public base::RefCounted<Layer>, public LayerAnimationCon trollerClient {
45 public: 46 public:
46 typedef std::vector<scoped_refptr<Layer> > LayerList; 47 typedef std::vector<scoped_refptr<Layer> > LayerList;
47 48
48 static scoped_refptr<Layer> create(); 49 static scoped_refptr<Layer> create();
49 50
50 // LayerAnimationControllerClient implementation 51 // LayerAnimationControllerClient implementation
51 virtual int id() const OVERRIDE; 52 virtual int id() const OVERRIDE;
52 virtual void setOpacityFromAnimation(float) OVERRIDE; 53 virtual void setOpacityFromAnimation(float) OVERRIDE;
53 virtual float opacity() const OVERRIDE; 54 virtual float opacity() const OVERRIDE;
54 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix &) OVERRIDE; 55 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE;
55 // A layer's transform operates layer space. That is, entirely in logical, 56 // A layer's transform operates layer space. That is, entirely in logical,
56 // non-page-scaled pixels (that is, they have page zoom baked in, but not pa ge scale). 57 // non-page-scaled pixels (that is, they have page zoom baked in, but not pa ge scale).
57 // The root layer is a special case -- it operates in physical pixels. 58 // The root layer is a special case -- it operates in physical pixels.
58 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; 59 virtual const gfx::Transform& transform() const OVERRIDE;
59 60
60 Layer* rootLayer(); 61 Layer* rootLayer();
61 Layer* parent() { return m_parent; } 62 Layer* parent() { return m_parent; }
62 const Layer* parent() const { return m_parent; } 63 const Layer* parent() const { return m_parent; }
63 void addChild(scoped_refptr<Layer>); 64 void addChild(scoped_refptr<Layer>);
64 void insertChild(scoped_refptr<Layer>, size_t index); 65 void insertChild(scoped_refptr<Layer>, size_t index);
65 void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer); 66 void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer);
66 void removeFromParent(); 67 void removeFromParent();
67 void removeAllChildren(); 68 void removeAllChildren();
68 void setChildren(const LayerList&); 69 void setChildren(const LayerList&);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 void setPosition(const gfx::PointF&); 116 void setPosition(const gfx::PointF&);
116 gfx::PointF position() const { return m_position; } 117 gfx::PointF position() const { return m_position; }
117 118
118 void setIsContainerForFixedPositionLayers(bool); 119 void setIsContainerForFixedPositionLayers(bool);
119 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; } 120 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; }
120 121
121 void setFixedToContainerLayer(bool); 122 void setFixedToContainerLayer(bool);
122 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } 123 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
123 124
124 void setSublayerTransform(const WebKit::WebTransformationMatrix&); 125 void setSublayerTransform(const gfx::Transform&);
125 const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_ sublayerTransform; } 126 const gfx::Transform& sublayerTransform() const { return m_sublayerTransform ; }
126 127
127 void setTransform(const WebKit::WebTransformationMatrix&); 128 void setTransform(const gfx::Transform&);
128 bool transformIsAnimating() const; 129 bool transformIsAnimating() const;
129 130
130 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } 131 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
131 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC ontentRect = visibleContentRect; } 132 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC ontentRect = visibleContentRect; }
132 133
133 void setScrollOffset(gfx::Vector2d); 134 void setScrollOffset(gfx::Vector2d);
134 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } 135 gfx::Vector2d scrollOffset() const { return m_scrollOffset; }
135 136
136 void setMaxScrollOffset(gfx::Vector2d); 137 void setMaxScrollOffset(gfx::Vector2d);
137 gfx::Vector2d maxScrollOffset() const { return m_maxScrollOffset; } 138 gfx::Vector2d maxScrollOffset() const { return m_maxScrollOffset; }
(...skipping 18 matching lines...) Expand all
156 void setLayerScrollClient(WebKit::WebLayerScrollClient* layerScrollClient) { m_layerScrollClient = layerScrollClient; } 157 void setLayerScrollClient(WebKit::WebLayerScrollClient* layerScrollClient) { m_layerScrollClient = layerScrollClient; }
157 158
158 void setDrawCheckerboardForMissingTiles(bool); 159 void setDrawCheckerboardForMissingTiles(bool);
159 bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForM issingTiles; } 160 bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForM issingTiles; }
160 161
161 bool forceRenderSurface() const { return m_forceRenderSurface; } 162 bool forceRenderSurface() const { return m_forceRenderSurface; }
162 void setForceRenderSurface(bool); 163 void setForceRenderSurface(bool);
163 164
164 gfx::Vector2d scrollDelta() const { return gfx::Vector2d(); } 165 gfx::Vector2d scrollDelta() const { return gfx::Vector2d(); }
165 166
166 void setImplTransform(const WebKit::WebTransformationMatrix&); 167 void setImplTransform(const gfx::Transform&);
167 const WebKit::WebTransformationMatrix& implTransform() const { return m_impl Transform; } 168 const gfx::Transform& implTransform() const { return m_implTransform; }
168 169
169 void setDoubleSided(bool); 170 void setDoubleSided(bool);
170 bool doubleSided() const { return m_doubleSided; } 171 bool doubleSided() const { return m_doubleSided; }
171 172
172 void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; } 173 void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; }
173 bool preserves3D() const { return m_preserves3D; } 174 bool preserves3D() const { return m_preserves3D; }
174 175
175 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us eParentBackfaceVisibility = useParentBackfaceVisibility; } 176 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us eParentBackfaceVisibility = useParentBackfaceVisibility; }
176 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil ity; } 177 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil ity; }
177 178
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 const Layer* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget ->renderSurface()); return m_renderTarget; } 219 const Layer* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget ->renderSurface()); return m_renderTarget; }
219 220
220 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } 221 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
221 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin g = animating; } 222 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin g = animating; }
222 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform IsAnimating; } 223 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform IsAnimating; }
223 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans formIsAnimating = animating; } 224 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans formIsAnimating = animating; }
224 225
225 // This moves from layer space, with origin in the center to target space wi th origin in the top left. 226 // This moves from layer space, with origin in the center to target space wi th origin in the top left.
226 // That is, it converts from logical, non-page-scaled, to target pixels (and if the target is the 227 // That is, it converts from logical, non-page-scaled, to target pixels (and if the target is the
227 // root render surface, then this converts to physical pixels). 228 // root render surface, then this converts to physical pixels).
228 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw Transform; } 229 const gfx::Transform& drawTransform() const { return m_drawTransform; }
229 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra wTransform = matrix; } 230 void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matr ix; }
230 // This moves from content space, with origin the top left to screen space w ith origin in the top left. 231 // This moves from content space, with origin the top left to screen space w ith origin in the top left.
231 // It converts logical, non-page-scaled pixels to physical pixels. 232 // It converts logical, non-page-scaled pixels to physical pixels.
232 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } 233 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra nsform; }
233 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } 234 void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTr ansform = matrix; }
234 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; } 235 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; }
235 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; } 236 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; }
236 237
237 // The contentsScale converts from logical, non-page-scaled pixels to target pixels. 238 // The contentsScale converts from logical, non-page-scaled pixels to target pixels.
238 // The contentsScale is 1 for the root layer as it is already in physical pi xels. 239 // The contentsScale is 1 for the root layer as it is already in physical pi xels.
239 // By default contentsScale is forced to be 1 except for subclasses of Conte ntsScalingLayer. 240 // By default contentsScale is forced to be 1 except for subclasses of Conte ntsScalingLayer.
240 virtual float contentsScaleX() const; 241 virtual float contentsScaleX() const;
241 virtual float contentsScaleY() const; 242 virtual float contentsScaleY() const;
242 virtual void setContentsScale(float contentsScale) { } 243 virtual void setContentsScale(float contentsScale) { }
243 244
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 bool m_isDrawable; 373 bool m_isDrawable;
373 bool m_masksToBounds; 374 bool m_masksToBounds;
374 bool m_contentsOpaque; 375 bool m_contentsOpaque;
375 bool m_doubleSided; 376 bool m_doubleSided;
376 bool m_useLCDText; 377 bool m_useLCDText;
377 bool m_preserves3D; 378 bool m_preserves3D;
378 bool m_useParentBackfaceVisibility; 379 bool m_useParentBackfaceVisibility;
379 bool m_drawCheckerboardForMissingTiles; 380 bool m_drawCheckerboardForMissingTiles;
380 bool m_forceRenderSurface; 381 bool m_forceRenderSurface;
381 382
382 WebKit::WebTransformationMatrix m_transform; 383 gfx::Transform m_transform;
383 WebKit::WebTransformationMatrix m_sublayerTransform; 384 gfx::Transform m_sublayerTransform;
384 385
385 // Replica layer used for reflections. 386 // Replica layer used for reflections.
386 scoped_refptr<Layer> m_replicaLayer; 387 scoped_refptr<Layer> m_replicaLayer;
387 388
388 // Transient properties. 389 // Transient properties.
389 scoped_ptr<RenderSurface> m_renderSurface; 390 scoped_ptr<RenderSurface> m_renderSurface;
390 float m_drawOpacity; 391 float m_drawOpacity;
391 bool m_drawOpacityIsAnimating; 392 bool m_drawOpacityIsAnimating;
392 393
393 Layer* m_renderTarget; 394 Layer* m_renderTarget;
394 395
395 WebKit::WebTransformationMatrix m_drawTransform; 396 gfx::Transform m_drawTransform;
396 WebKit::WebTransformationMatrix m_screenSpaceTransform; 397 gfx::Transform m_screenSpaceTransform;
397 bool m_drawTransformIsAnimating; 398 bool m_drawTransformIsAnimating;
398 bool m_screenSpaceTransformIsAnimating; 399 bool m_screenSpaceTransformIsAnimating;
399 400
400 // Uses target surface space. 401 // Uses target surface space.
401 gfx::Rect m_drawableContentRect; 402 gfx::Rect m_drawableContentRect;
402 float m_rasterScale; 403 float m_rasterScale;
403 bool m_automaticallyComputeRasterScale; 404 bool m_automaticallyComputeRasterScale;
404 bool m_boundsContainPageScale; 405 bool m_boundsContainPageScale;
405 406
406 WebKit::WebTransformationMatrix m_implTransform; 407 gfx::Transform m_implTransform;
407 408
408 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; 409 WebKit::WebAnimationDelegate* m_layerAnimationDelegate;
409 WebKit::WebLayerScrollClient* m_layerScrollClient; 410 WebKit::WebLayerScrollClient* m_layerScrollClient;
410 }; 411 };
411 412
412 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*); 413 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*);
413 414
414 } // namespace cc 415 } // namespace cc
415 416
416 #endif // CC_LAYER_H_ 417 #endif // CC_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698