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

Side by Side Diff: cc/layer_impl.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: Rebased to tip of tree and addressed feedback 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
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 <string> 9 #include <string>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "cc/cc_export.h" 13 #include "cc/cc_export.h"
13 #include "cc/input_handler.h" 14 #include "cc/input_handler.h"
14 #include "cc/layer_animation_controller.h" 15 #include "cc/layer_animation_controller.h"
15 #include "cc/region.h" 16 #include "cc/region.h"
16 #include "cc/render_pass.h" 17 #include "cc/render_pass.h"
17 #include "cc/render_surface_impl.h" 18 #include "cc/render_surface_impl.h"
18 #include "cc/resource_provider.h" 19 #include "cc/resource_provider.h"
19 #include "cc/scoped_ptr_vector.h" 20 #include "cc/scoped_ptr_vector.h"
20 #include "cc/shared_quad_state.h" 21 #include "cc/shared_quad_state.h"
21 #include "third_party/skia/include/core/SkColor.h" 22 #include "third_party/skia/include/core/SkColor.h"
22 #include "ui/gfx/rect.h" 23 #include "ui/gfx/rect.h"
23 #include "ui/gfx/rect_f.h" 24 #include "ui/gfx/rect_f.h"
24 #include <public/WebFilterOperations.h> 25 #include "ui/gfx/transform.h"
25 #include <public/WebTransformationMatrix.h>
26 26
27 namespace cc { 27 namespace cc {
28 28
29 class LayerSorter; 29 class LayerSorter;
30 class LayerTreeHostImpl; 30 class LayerTreeHostImpl;
31 class QuadSink; 31 class QuadSink;
32 class Renderer; 32 class Renderer;
33 class ScrollbarAnimationController; 33 class ScrollbarAnimationController;
34 class ScrollbarLayerImpl; 34 class ScrollbarLayerImpl;
35 class Layer; 35 class Layer;
36 36
37 struct AppendQuadsData; 37 struct AppendQuadsData;
38 38
39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { 39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient {
40 public: 40 public:
41 static scoped_ptr<LayerImpl> create(int id) 41 static scoped_ptr<LayerImpl> create(int id)
42 { 42 {
43 return make_scoped_ptr(new LayerImpl(id)); 43 return make_scoped_ptr(new LayerImpl(id));
44 } 44 }
45 45
46 virtual ~LayerImpl(); 46 virtual ~LayerImpl();
47 47
48 // LayerAnimationControllerClient implementation. 48 // LayerAnimationControllerClient implementation.
49 virtual int id() const OVERRIDE; 49 virtual int id() const OVERRIDE;
50 virtual void setOpacityFromAnimation(float) OVERRIDE; 50 virtual void setOpacityFromAnimation(float) OVERRIDE;
51 virtual float opacity() const OVERRIDE; 51 virtual float opacity() const OVERRIDE;
52 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix &) OVERRIDE; 52 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE;
53 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; 53 virtual const gfx::Transform& transform() const OVERRIDE;
54 54
55 // Tree structure. 55 // Tree structure.
56 LayerImpl* parent() { return m_parent; } 56 LayerImpl* parent() { return m_parent; }
57 const LayerImpl* parent() const { return m_parent; } 57 const LayerImpl* parent() const { return m_parent; }
58 const ScopedPtrVector<LayerImpl>& children() const { return m_children; } 58 const ScopedPtrVector<LayerImpl>& children() const { return m_children; }
59 void addChild(scoped_ptr<LayerImpl>); 59 void addChild(scoped_ptr<LayerImpl>);
60 void removeFromParent(); 60 void removeFromParent();
61 void removeAllChildren(); 61 void removeAllChildren();
62 62
63 void setMaskLayer(scoped_ptr<LayerImpl>); 63 void setMaskLayer(scoped_ptr<LayerImpl>);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 void setPreserves3D(bool); 139 void setPreserves3D(bool);
140 bool preserves3D() const { return m_preserves3D; } 140 bool preserves3D() const { return m_preserves3D; }
141 141
142 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us eParentBackfaceVisibility = useParentBackfaceVisibility; } 142 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us eParentBackfaceVisibility = useParentBackfaceVisibility; }
143 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil ity; } 143 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil ity; }
144 144
145 void setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; } 145 void setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; }
146 bool useLCDText() const { return m_useLCDText; } 146 bool useLCDText() const { return m_useLCDText; }
147 147
148 void setSublayerTransform(const WebKit::WebTransformationMatrix&); 148 void setSublayerTransform(const gfx::Transform&);
149 const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_ sublayerTransform; } 149 const gfx::Transform& sublayerTransform() const { return m_sublayerTransform ; }
150 150
151 // Debug layer name. 151 // Debug layer name.
152 void setDebugName(const std::string& debugName) { m_debugName = debugName; } 152 void setDebugName(const std::string& debugName) { m_debugName = debugName; }
153 std::string debugName() const { return m_debugName; } 153 std::string debugName() const { return m_debugName; }
154 154
155 bool showDebugBorders() const; 155 bool showDebugBorders() const;
156 156
157 RenderSurfaceImpl* renderSurface() const { return m_renderSurface.get(); } 157 RenderSurfaceImpl* renderSurface() const { return m_renderSurface.get(); }
158 void createRenderSurface(); 158 void createRenderSurface();
159 void clearRenderSurface() { m_renderSurface.reset(); } 159 void clearRenderSurface() { m_renderSurface.reset(); }
(...skipping 26 matching lines...) Expand all
186 186
187 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } 187 gfx::Vector2d scrollOffset() const { return m_scrollOffset; }
188 void setScrollOffset(gfx::Vector2d); 188 void setScrollOffset(gfx::Vector2d);
189 189
190 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } 190 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; }
191 void setMaxScrollOffset(gfx::Vector2d); 191 void setMaxScrollOffset(gfx::Vector2d);
192 192
193 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } 193 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; }
194 void setScrollDelta(const gfx::Vector2dF&); 194 void setScrollDelta(const gfx::Vector2dF&);
195 195
196 const WebKit::WebTransformationMatrix& implTransform() const { return m_impl Transform; } 196 const gfx::Transform& implTransform() const { return m_implTransform; }
197 void setImplTransform(const WebKit::WebTransformationMatrix& transform); 197 void setImplTransform(const gfx::Transform& transform);
198 198
199 const gfx::Vector2d& sentScrollDelta() const { return m_sentScrollDelta; } 199 const gfx::Vector2d& sentScrollDelta() const { return m_sentScrollDelta; }
200 void setSentScrollDelta(const gfx::Vector2d& sentScrollDelta) { m_sentScroll Delta = sentScrollDelta; } 200 void setSentScrollDelta(const gfx::Vector2d& sentScrollDelta) { m_sentScroll Delta = sentScrollDelta; }
201 201
202 // Returns the delta of the scroll that was outside of the bounds of the ini tial scroll 202 // Returns the delta of the scroll that was outside of the bounds of the ini tial scroll
203 gfx::Vector2dF scrollBy(const gfx::Vector2dF& scroll); 203 gfx::Vector2dF scrollBy(const gfx::Vector2dF& scroll);
204 204
205 bool scrollable() const { return m_scrollable; } 205 bool scrollable() const { return m_scrollable; }
206 void setScrollable(bool scrollable) { m_scrollable = scrollable; } 206 void setScrollable(bool scrollable) { m_scrollable = scrollable; }
207 207
(...skipping 13 matching lines...) Expand all
221 bool drawCheckerboardForMissingTiles() const; 221 bool drawCheckerboardForMissingTiles() const;
222 222
223 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi nt, InputHandlerClient::ScrollInputType) const; 223 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi nt, InputHandlerClient::ScrollInputType) const;
224 224
225 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } 225 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
226 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC ontentRect = visibleContentRect; } 226 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC ontentRect = visibleContentRect; }
227 227
228 bool doubleSided() const { return m_doubleSided; } 228 bool doubleSided() const { return m_doubleSided; }
229 void setDoubleSided(bool); 229 void setDoubleSided(bool);
230 230
231 void setTransform(const WebKit::WebTransformationMatrix&); 231 void setTransform(const gfx::Transform&);
232 bool transformIsAnimating() const; 232 bool transformIsAnimating() const;
233 233
234 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw Transform; } 234 const gfx::Transform& drawTransform() const { return m_drawTransform; }
235 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra wTransform = matrix; } 235 void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matr ix; }
236 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } 236 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra nsform; }
237 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } 237 void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTr ansform = matrix; }
238 238
239 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } 239 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
240 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin g = animating; } 240 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin g = animating; }
241 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform IsAnimating; } 241 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform IsAnimating; }
242 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans formIsAnimating = animating; } 242 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans formIsAnimating = animating; }
243 243
244 bool isClipped() const { return m_isClipped; } 244 bool isClipped() const { return m_isClipped; }
245 void setIsClipped(bool isClipped) { m_isClipped = isClipped; } 245 void setIsClipped(bool isClipped) { m_isClipped = isClipped; }
246 246
247 const gfx::Rect& clipRect() const { return m_clipRect; } 247 const gfx::Rect& clipRect() const { return m_clipRect; }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 // Uses layer's content space. 351 // Uses layer's content space.
352 gfx::Rect m_visibleContentRect; 352 gfx::Rect m_visibleContentRect;
353 bool m_masksToBounds; 353 bool m_masksToBounds;
354 bool m_contentsOpaque; 354 bool m_contentsOpaque;
355 float m_opacity; 355 float m_opacity;
356 gfx::PointF m_position; 356 gfx::PointF m_position;
357 bool m_preserves3D; 357 bool m_preserves3D;
358 bool m_useParentBackfaceVisibility; 358 bool m_useParentBackfaceVisibility;
359 bool m_drawCheckerboardForMissingTiles; 359 bool m_drawCheckerboardForMissingTiles;
360 WebKit::WebTransformationMatrix m_sublayerTransform; 360 gfx::Transform m_sublayerTransform;
361 WebKit::WebTransformationMatrix m_transform; 361 gfx::Transform m_transform;
362 bool m_useLCDText; 362 bool m_useLCDText;
363 363
364 bool m_drawsContent; 364 bool m_drawsContent;
365 bool m_forceRenderSurface; 365 bool m_forceRenderSurface;
366 366
367 // Set for the layer that other layers are fixed to. 367 // Set for the layer that other layers are fixed to.
368 bool m_isContainerForFixedPositionLayers; 368 bool m_isContainerForFixedPositionLayers;
369 // This is true if the layer should be fixed to the closest ancestor contain er. 369 // This is true if the layer should be fixed to the closest ancestor contain er.
370 bool m_fixedToContainerLayer; 370 bool m_fixedToContainerLayer;
371 371
372 gfx::Vector2dF m_scrollDelta; 372 gfx::Vector2dF m_scrollDelta;
373 gfx::Vector2d m_sentScrollDelta; 373 gfx::Vector2d m_sentScrollDelta;
374 gfx::Vector2d m_maxScrollOffset; 374 gfx::Vector2d m_maxScrollOffset;
375 WebKit::WebTransformationMatrix m_implTransform; 375 gfx::Transform m_implTransform;
376 376
377 // The layer whose coordinate space this layer draws into. This can be 377 // The layer whose coordinate space this layer draws into. This can be
378 // either the same layer (m_renderTarget == this) or an ancestor of this 378 // either the same layer (m_renderTarget == this) or an ancestor of this
379 // layer. 379 // layer.
380 LayerImpl* m_renderTarget; 380 LayerImpl* m_renderTarget;
381 381
382 // The global depth value of the center of the layer. This value is used 382 // The global depth value of the center of the layer. This value is used
383 // to sort layers from back to front. 383 // to sort layers from back to front.
384 float m_drawDepth; 384 float m_drawDepth;
385 float m_drawOpacity; 385 float m_drawOpacity;
386 bool m_drawOpacityIsAnimating; 386 bool m_drawOpacityIsAnimating;
387 387
388 // Debug layer name. 388 // Debug layer name.
389 std::string m_debugName; 389 std::string m_debugName;
390 390
391 WebKit::WebFilterOperations m_filters; 391 WebKit::WebFilterOperations m_filters;
392 WebKit::WebFilterOperations m_backgroundFilters; 392 WebKit::WebFilterOperations m_backgroundFilters;
393 SkImageFilter* m_filter; 393 SkImageFilter* m_filter;
394 394
395 WebKit::WebTransformationMatrix m_drawTransform; 395 gfx::Transform m_drawTransform;
396 WebKit::WebTransformationMatrix m_screenSpaceTransform; 396 gfx::Transform m_screenSpaceTransform;
397 bool m_drawTransformIsAnimating; 397 bool m_drawTransformIsAnimating;
398 bool m_screenSpaceTransformIsAnimating; 398 bool m_screenSpaceTransformIsAnimating;
399 399
400 #ifndef NDEBUG 400 #ifndef NDEBUG
401 bool m_betweenWillDrawAndDidDraw; 401 bool m_betweenWillDrawAndDidDraw;
402 #endif 402 #endif
403 403
404 // Render surface associated with this layer. The layer and its descendants 404 // Render surface associated with this layer. The layer and its descendants
405 // will render to this surface. 405 // will render to this surface.
406 scoped_ptr<RenderSurfaceImpl> m_renderSurface; 406 scoped_ptr<RenderSurfaceImpl> m_renderSurface;
(...skipping 17 matching lines...) Expand all
424 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; 424 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController;
425 425
426 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 426 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
427 }; 427 };
428 428
429 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*); 429 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*);
430 430
431 } 431 }
432 432
433 #endif // CC_LAYER_IMPL_H_ 433 #endif // CC_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698