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

Side by Side Diff: cc/layer_impl.h

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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.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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const LayerImpl* renderTarget() const { DCHECK(!m_drawProperties.render_targ et || m_drawProperties.render_target->renderSurface()); return m_drawProperties. render_target; } 183 const LayerImpl* renderTarget() const { DCHECK(!m_drawProperties.render_targ et || m_drawProperties.render_target->renderSurface()); return m_drawProperties. render_target; }
184 RenderSurfaceImpl* renderSurface() const { return m_drawProperties.render_su rface.get(); } 184 RenderSurfaceImpl* renderSurface() const { return m_drawProperties.render_su rface.get(); }
185 185
186 // The client should be responsible for setting bounds, contentBounds and 186 // The client should be responsible for setting bounds, contentBounds and
187 // contentsScale to appropriate values. LayerImpl doesn't calculate any of 187 // contentsScale to appropriate values. LayerImpl doesn't calculate any of
188 // them from the other values. 188 // them from the other values.
189 189
190 void setBounds(const gfx::Size&); 190 void setBounds(const gfx::Size&);
191 const gfx::Size& bounds() const { return m_bounds; } 191 const gfx::Size& bounds() const { return m_bounds; }
192 192
193 // ContentBounds may be [0, 1) pixels larger than bounds * contentsScale.
194 // Don't calculate scale from it. Use contentsScale instead for accuracy.
195 void setContentBounds(const gfx::Size&); 193 void setContentBounds(const gfx::Size&);
196 gfx::Size contentBounds() const { return m_contentBounds; } 194 gfx::Size contentBounds() const { return m_drawProperties.content_bounds; }
197 195
198 float contentsScaleX() const { return m_contentsScaleX; } 196 float contentsScaleX() const { return m_drawProperties.contents_scale_x; }
199 float contentsScaleY() const { return m_contentsScaleY; } 197 float contentsScaleY() const { return m_drawProperties.contents_scale_y; }
200 void setContentsScale(float contentsScaleX, float contentsScaleY); 198 void setContentsScale(float contentsScaleX, float contentsScaleY);
201 199
202 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } 200 gfx::Vector2d scrollOffset() const { return m_scrollOffset; }
203 void setScrollOffset(gfx::Vector2d); 201 void setScrollOffset(gfx::Vector2d);
204 202
205 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } 203 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; }
206 void setMaxScrollOffset(gfx::Vector2d); 204 void setMaxScrollOffset(gfx::Vector2d);
207 205
208 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } 206 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; }
209 void setScrollDelta(const gfx::Vector2dF&); 207 void setScrollDelta(const gfx::Vector2dF&);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 scoped_ptr<LayerImpl> m_maskLayer; 317 scoped_ptr<LayerImpl> m_maskLayer;
320 int m_replicaLayerId; // ditto 318 int m_replicaLayerId; // ditto
321 scoped_ptr<LayerImpl> m_replicaLayer; 319 scoped_ptr<LayerImpl> m_replicaLayer;
322 int m_layerId; 320 int m_layerId;
323 LayerTreeImpl* m_layerTreeImpl; 321 LayerTreeImpl* m_layerTreeImpl;
324 322
325 // Properties synchronized from the associated Layer. 323 // Properties synchronized from the associated Layer.
326 gfx::PointF m_anchorPoint; 324 gfx::PointF m_anchorPoint;
327 float m_anchorPointZ; 325 float m_anchorPointZ;
328 gfx::Size m_bounds; 326 gfx::Size m_bounds;
329 gfx::Size m_contentBounds;
330 float m_contentsScaleX;
331 float m_contentsScaleY;
332 gfx::Vector2d m_scrollOffset; 327 gfx::Vector2d m_scrollOffset;
333 bool m_scrollable; 328 bool m_scrollable;
334 bool m_shouldScrollOnMainThread; 329 bool m_shouldScrollOnMainThread;
335 bool m_haveWheelEventHandlers; 330 bool m_haveWheelEventHandlers;
336 Region m_nonFastScrollableRegion; 331 Region m_nonFastScrollableRegion;
337 Region m_touchEventHandlerRegion; 332 Region m_touchEventHandlerRegion;
338 SkColor m_backgroundColor; 333 SkColor m_backgroundColor;
339 334
340 // Whether the "back" of this layer should draw. 335 // Whether the "back" of this layer should draw.
341 bool m_doubleSided; 336 bool m_doubleSided;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // Group of properties that need to be computed based on the layer tree 396 // Group of properties that need to be computed based on the layer tree
402 // hierarchy before layers can be drawn. 397 // hierarchy before layers can be drawn.
403 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; 398 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties;
404 399
405 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 400 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
406 }; 401 };
407 402
408 } 403 }
409 404
410 #endif // CC_LAYER_IMPL_H_ 405 #endif // CC_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698