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

Side by Side Diff: cc/layer_impl.h

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some missed intstuff 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
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_impl.cc » ('j') | cc/layer_quad.h » ('J')
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 CCLayerImpl_h 5 #ifndef CCLayerImpl_h
6 #define CCLayerImpl_h 6 #define CCLayerImpl_h
7 7
8 #include "FloatRect.h"
9 #include "IntRect.h"
10 #include "Region.h" 8 #include "Region.h"
11 #include "base/logging.h" 9 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
13 #include "cc/input_handler.h" 11 #include "cc/input_handler.h"
14 #include "cc/layer_animation_controller.h" 12 #include "cc/layer_animation_controller.h"
15 #include "cc/render_pass.h" 13 #include "cc/render_pass.h"
16 #include "cc/render_surface_impl.h" 14 #include "cc/render_surface_impl.h"
17 #include "cc/resource_provider.h" 15 #include "cc/resource_provider.h"
18 #include "cc/scoped_ptr_vector.h" 16 #include "cc/scoped_ptr_vector.h"
19 #include "cc/shared_quad_state.h" 17 #include "cc/shared_quad_state.h"
20 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
19 #include "ui/gfx/rect.h"
20 #include "ui/gfx/rect_f.h"
21 #include <public/WebFilterOperations.h> 21 #include <public/WebFilterOperations.h>
22 #include <public/WebTransformationMatrix.h> 22 #include <public/WebTransformationMatrix.h>
23 #include <string> 23 #include <string>
24 24
25 namespace cc { 25 namespace cc {
26 26
27 class LayerSorter; 27 class LayerSorter;
28 class LayerTreeHostImpl; 28 class LayerTreeHostImpl;
29 class QuadSink; 29 class QuadSink;
30 class Renderer; 30 class Renderer;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Returns true if this layer has content to draw. 88 // Returns true if this layer has content to draw.
89 void setDrawsContent(bool); 89 void setDrawsContent(bool);
90 bool drawsContent() const { return m_drawsContent; } 90 bool drawsContent() const { return m_drawsContent; }
91 91
92 bool forceRenderSurface() const { return m_forceRenderSurface; } 92 bool forceRenderSurface() const { return m_forceRenderSurface; }
93 void setForceRenderSurface(bool force) { m_forceRenderSurface = force; } 93 void setForceRenderSurface(bool force) { m_forceRenderSurface = force; }
94 94
95 // Returns true if any of the layer's descendants has content to draw. 95 // Returns true if any of the layer's descendants has content to draw.
96 virtual bool descendantDrawsContent(); 96 virtual bool descendantDrawsContent();
97 97
98 void setAnchorPoint(const FloatPoint&); 98 void setAnchorPoint(const gfx::PointF&);
99 const FloatPoint& anchorPoint() const { return m_anchorPoint; } 99 const gfx::PointF& anchorPoint() const { return m_anchorPoint; }
100 100
101 void setAnchorPointZ(float); 101 void setAnchorPointZ(float);
102 float anchorPointZ() const { return m_anchorPointZ; } 102 float anchorPointZ() const { return m_anchorPointZ; }
103 103
104 void setBackgroundColor(SkColor); 104 void setBackgroundColor(SkColor);
105 SkColor backgroundColor() const { return m_backgroundColor; } 105 SkColor backgroundColor() const { return m_backgroundColor; }
106 106
107 void setFilters(const WebKit::WebFilterOperations&); 107 void setFilters(const WebKit::WebFilterOperations&);
108 const WebKit::WebFilterOperations& filters() const { return m_filters; } 108 const WebKit::WebFilterOperations& filters() const { return m_filters; }
109 109
110 void setBackgroundFilters(const WebKit::WebFilterOperations&); 110 void setBackgroundFilters(const WebKit::WebFilterOperations&);
111 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back groundFilters; } 111 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back groundFilters; }
112 112
113 void setFilter(SkImageFilter*); 113 void setFilter(SkImageFilter*);
114 SkImageFilter* filter() const { return m_filter; } 114 SkImageFilter* filter() const { return m_filter; }
115 115
116 void setMasksToBounds(bool); 116 void setMasksToBounds(bool);
117 bool masksToBounds() const { return m_masksToBounds; } 117 bool masksToBounds() const { return m_masksToBounds; }
118 118
119 void setContentsOpaque(bool); 119 void setContentsOpaque(bool);
120 bool contentsOpaque() const { return m_contentsOpaque; } 120 bool contentsOpaque() const { return m_contentsOpaque; }
121 121
122 void setOpacity(float); 122 void setOpacity(float);
123 bool opacityIsAnimating() const; 123 bool opacityIsAnimating() const;
124 124
125 void setPosition(const FloatPoint&); 125 void setPosition(const gfx::PointF&);
126 const FloatPoint& position() const { return m_position; } 126 const gfx::PointF& position() const { return m_position; }
127 127
128 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; } 128 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
129 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; } 129 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; }
130 130
131 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo ContainerLayer = fixedToContainerLayer;} 131 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo ContainerLayer = fixedToContainerLayer;}
132 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } 132 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
133 133
134 void setPreserves3D(bool); 134 void setPreserves3D(bool);
135 bool preserves3D() const { return m_preserves3D; } 135 bool preserves3D() const { return m_preserves3D; }
136 136
(...skipping 23 matching lines...) Expand all
160 160
161 float drawOpacity() const { return m_drawOpacity; } 161 float drawOpacity() const { return m_drawOpacity; }
162 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } 162 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
163 163
164 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } 164 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
165 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI sAnimating = drawOpacityIsAnimating; } 165 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI sAnimating = drawOpacityIsAnimating; }
166 166
167 LayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget-> renderSurface()); return m_renderTarget; } 167 LayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget-> renderSurface()); return m_renderTarget; }
168 void setRenderTarget(LayerImpl* target) { m_renderTarget = target; } 168 void setRenderTarget(LayerImpl* target) { m_renderTarget = target; }
169 169
170 void setBounds(const IntSize&); 170 void setBounds(const gfx::Size&);
171 const IntSize& bounds() const { return m_bounds; } 171 const gfx::Size& bounds() const { return m_bounds; }
172 172
173 const IntSize& contentBounds() const { return m_contentBounds; } 173 const gfx::Size& contentBounds() const { return m_contentBounds; }
174 void setContentBounds(const IntSize&); 174 void setContentBounds(const gfx::Size&);
175 175
176 const IntPoint& scrollPosition() const { return m_scrollPosition; } 176 const IntPoint& scrollPosition() const { return m_scrollPosition; }
177 void setScrollPosition(const IntPoint&); 177 void setScrollPosition(const IntPoint&);
178 178
179 const IntSize& maxScrollPosition() const {return m_maxScrollPosition; } 179 const IntSize& maxScrollPosition() const {return m_maxScrollPosition; }
180 void setMaxScrollPosition(const IntSize&); 180 void setMaxScrollPosition(const IntSize&);
181 181
182 const FloatSize& scrollDelta() const { return m_scrollDelta; } 182 const FloatSize& scrollDelta() const { return m_scrollDelta; }
183 void setScrollDelta(const FloatSize&); 183 void setScrollDelta(const FloatSize&);
184 184
(...skipping 16 matching lines...) Expand all
201 void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEve ntHandlers = haveWheelEventHandlers; } 201 void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEve ntHandlers = haveWheelEventHandlers; }
202 202
203 const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRe gion; } 203 const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRe gion; }
204 void setNonFastScrollableRegion(const Region& region) { m_nonFastScrollableR egion = region; } 204 void setNonFastScrollableRegion(const Region& region) { m_nonFastScrollableR egion = region; }
205 205
206 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo ardForMissingTiles = checkerboard; } 206 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo ardForMissingTiles = checkerboard; }
207 bool drawCheckerboardForMissingTiles() const; 207 bool drawCheckerboardForMissingTiles() const;
208 208
209 InputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, In putHandlerClient::ScrollInputType) const; 209 InputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, In putHandlerClient::ScrollInputType) const;
210 210
211 const IntRect& visibleContentRect() const { return m_visibleContentRect; } 211 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
212 void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleCon tentRect = visibleContentRect; } 212 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC ontentRect = visibleContentRect; }
213 213
214 bool doubleSided() const { return m_doubleSided; } 214 bool doubleSided() const { return m_doubleSided; }
215 void setDoubleSided(bool); 215 void setDoubleSided(bool);
216 216
217 void setTransform(const WebKit::WebTransformationMatrix&); 217 void setTransform(const WebKit::WebTransformationMatrix&);
218 bool transformIsAnimating() const; 218 bool transformIsAnimating() const;
219 219
220 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw Transform; } 220 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw Transform; }
221 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra wTransform = matrix; } 221 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra wTransform = matrix; }
222 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } 222 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
223 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } 223 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
224 224
225 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } 225 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
226 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin g = animating; } 226 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin g = animating; }
227 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform IsAnimating; } 227 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform IsAnimating; }
228 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans formIsAnimating = animating; } 228 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans formIsAnimating = animating; }
229 229
230 const IntRect& drawableContentRect() const { return m_drawableContentRect; } 230 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; }
231 void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = r ect; } 231 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; }
232 const FloatRect& updateRect() const { return m_updateRect; } 232 const gfx::RectF& updateRect() const { return m_updateRect; }
233 void setUpdateRect(const FloatRect& updateRect) { m_updateRect = updateRect; } 233 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect ; }
234 234
235 std::string layerTreeAsText() const; 235 std::string layerTreeAsText() const;
236 236
237 void setStackingOrderChanged(bool); 237 void setStackingOrderChanged(bool);
238 238
239 bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIs AlwaysDamaged(); } 239 bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIs AlwaysDamaged(); }
240 bool layerSurfacePropertyChanged() const; 240 bool layerSurfacePropertyChanged() const;
241 241
242 void resetAllChangeTrackingForSubtree(); 242 void resetAllChangeTrackingForSubtree();
243 243
(...skipping 14 matching lines...) Expand all
258 void setHorizontalScrollbarLayer(ScrollbarLayerImpl*); 258 void setHorizontalScrollbarLayer(ScrollbarLayerImpl*);
259 259
260 ScrollbarLayerImpl* verticalScrollbarLayer() const; 260 ScrollbarLayerImpl* verticalScrollbarLayer() const;
261 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); 261 void setVerticalScrollbarLayer(ScrollbarLayerImpl*);
262 262
263 protected: 263 protected:
264 explicit LayerImpl(int); 264 explicit LayerImpl(int);
265 265
266 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat a&) const; 266 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat a&) const;
267 267
268 IntRect layerRectToContentRect(const WebKit::WebRect& layerRect); 268 gfx::Rect layerRectToContentRect(const gfx::Rect& layerRect);
269 269
270 virtual void dumpLayerProperties(std::string*, int indent) const; 270 virtual void dumpLayerProperties(std::string*, int indent) const;
271 static std::string indentString(int indent); 271 static std::string indentString(int indent);
272 272
273 private: 273 private:
274 void setParent(LayerImpl* parent) { m_parent = parent; } 274 void setParent(LayerImpl* parent) { m_parent = parent; }
275 friend class TreeSynchronizer; 275 friend class TreeSynchronizer;
276 void clearChildList(); // Warning: This does not preserve tree structure inv ariants and so is only exposed to the tree synchronizer. 276 void clearChildList(); // Warning: This does not preserve tree structure inv ariants and so is only exposed to the tree synchronizer.
277 277
278 void noteLayerPropertyChangedForSubtree(); 278 void noteLayerPropertyChangedForSubtree();
(...skipping 10 matching lines...) Expand all
289 ScopedPtrVector<LayerImpl> m_children; 289 ScopedPtrVector<LayerImpl> m_children;
290 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t o confirm newly assigned layer is still the previous one 290 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t o confirm newly assigned layer is still the previous one
291 int m_maskLayerId; 291 int m_maskLayerId;
292 scoped_ptr<LayerImpl> m_maskLayer; 292 scoped_ptr<LayerImpl> m_maskLayer;
293 int m_replicaLayerId; // ditto 293 int m_replicaLayerId; // ditto
294 scoped_ptr<LayerImpl> m_replicaLayer; 294 scoped_ptr<LayerImpl> m_replicaLayer;
295 int m_layerId; 295 int m_layerId;
296 LayerTreeHostImpl* m_layerTreeHostImpl; 296 LayerTreeHostImpl* m_layerTreeHostImpl;
297 297
298 // Properties synchronized from the associated Layer. 298 // Properties synchronized from the associated Layer.
299 FloatPoint m_anchorPoint; 299 gfx::PointF m_anchorPoint;
300 float m_anchorPointZ; 300 float m_anchorPointZ;
301 IntSize m_bounds; 301 gfx::Size m_bounds;
302 IntSize m_contentBounds; 302 gfx::Size m_contentBounds;
303 IntPoint m_scrollPosition; 303 IntPoint m_scrollPosition;
304 bool m_scrollable; 304 bool m_scrollable;
305 bool m_shouldScrollOnMainThread; 305 bool m_shouldScrollOnMainThread;
306 bool m_haveWheelEventHandlers; 306 bool m_haveWheelEventHandlers;
307 Region m_nonFastScrollableRegion; 307 Region m_nonFastScrollableRegion;
308 SkColor m_backgroundColor; 308 SkColor m_backgroundColor;
309 309
310 // Whether the "back" of this layer should draw. 310 // Whether the "back" of this layer should draw.
311 bool m_doubleSided; 311 bool m_doubleSided;
312 312
313 // Tracks if drawing-related properties have changed since last redraw. 313 // Tracks if drawing-related properties have changed since last redraw.
314 bool m_layerPropertyChanged; 314 bool m_layerPropertyChanged;
315 315
316 // Indicates that a property has changed on this layer that would not 316 // Indicates that a property has changed on this layer that would not
317 // affect the pixels on its target surface, but would require redrawing 317 // affect the pixels on its target surface, but would require redrawing
318 // but would require redrawing the targetSurface onto its ancestor targetSur face. 318 // but would require redrawing the targetSurface onto its ancestor targetSur face.
319 // For layers that do not own a surface this flag acts as m_layerPropertyCha nged. 319 // For layers that do not own a surface this flag acts as m_layerPropertyCha nged.
320 bool m_layerSurfacePropertyChanged; 320 bool m_layerSurfacePropertyChanged;
321 321
322 // Uses layer's content space. 322 // Uses layer's content space.
323 IntRect m_visibleContentRect; 323 gfx::Rect m_visibleContentRect;
324 bool m_masksToBounds; 324 bool m_masksToBounds;
325 bool m_contentsOpaque; 325 bool m_contentsOpaque;
326 float m_opacity; 326 float m_opacity;
327 FloatPoint m_position; 327 gfx::PointF m_position;
328 bool m_preserves3D; 328 bool m_preserves3D;
329 bool m_useParentBackfaceVisibility; 329 bool m_useParentBackfaceVisibility;
330 bool m_drawCheckerboardForMissingTiles; 330 bool m_drawCheckerboardForMissingTiles;
331 WebKit::WebTransformationMatrix m_sublayerTransform; 331 WebKit::WebTransformationMatrix m_sublayerTransform;
332 WebKit::WebTransformationMatrix m_transform; 332 WebKit::WebTransformationMatrix m_transform;
333 bool m_useLCDText; 333 bool m_useLCDText;
334 334
335 bool m_drawsContent; 335 bool m_drawsContent;
336 bool m_forceRenderSurface; 336 bool m_forceRenderSurface;
337 337
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 #ifndef NDEBUG 375 #ifndef NDEBUG
376 bool m_betweenWillDrawAndDidDraw; 376 bool m_betweenWillDrawAndDidDraw;
377 #endif 377 #endif
378 378
379 // Render surface associated with this layer. The layer and its descendants 379 // Render surface associated with this layer. The layer and its descendants
380 // will render to this surface. 380 // will render to this surface.
381 scoped_ptr<RenderSurfaceImpl> m_renderSurface; 381 scoped_ptr<RenderSurfaceImpl> m_renderSurface;
382 382
383 // Hierarchical bounding rect containing the layer and its descendants. 383 // Hierarchical bounding rect containing the layer and its descendants.
384 // Uses target surface's space. 384 // Uses target surface's space.
385 IntRect m_drawableContentRect; 385 gfx::Rect m_drawableContentRect;
386 386
387 // Rect indicating what was repainted/updated during update. 387 // Rect indicating what was repainted/updated during update.
388 // Note that plugin layers bypass this and leave it empty. 388 // Note that plugin layers bypass this and leave it empty.
389 // Uses layer's content space. 389 // Uses layer's content space.
390 FloatRect m_updateRect; 390 gfx::RectF m_updateRect;
391 391
392 // Manages animations for this layer. 392 // Manages animations for this layer.
393 scoped_ptr<LayerAnimationController> m_layerAnimationController; 393 scoped_ptr<LayerAnimationController> m_layerAnimationController;
394 394
395 // Manages scrollbars for this layer 395 // Manages scrollbars for this layer
396 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; 396 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController;
397 }; 397 };
398 398
399 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*); 399 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*);
400 400
401 } 401 }
402 402
403 #endif // CCLayerImpl_h 403 #endif // CCLayerImpl_h
OLDNEW
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_impl.cc » ('j') | cc/layer_quad.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698