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

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: Fix shadowing 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 <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);
199 virtual void updateContentsScale(float ideal_contents_scale) { }
201 200
202 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } 201 gfx::Vector2d scrollOffset() const { return m_scrollOffset; }
203 void setScrollOffset(gfx::Vector2d); 202 void setScrollOffset(gfx::Vector2d);
204 203
205 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } 204 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; }
206 void setMaxScrollOffset(gfx::Vector2d); 205 void setMaxScrollOffset(gfx::Vector2d);
207 206
208 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } 207 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; }
209 void setScrollDelta(const gfx::Vector2dF&); 208 void setScrollDelta(const gfx::Vector2dF&);
210 209
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 scoped_ptr<LayerImpl> m_maskLayer; 315 scoped_ptr<LayerImpl> m_maskLayer;
317 int m_replicaLayerId; // ditto 316 int m_replicaLayerId; // ditto
318 scoped_ptr<LayerImpl> m_replicaLayer; 317 scoped_ptr<LayerImpl> m_replicaLayer;
319 int m_layerId; 318 int m_layerId;
320 LayerTreeImpl* m_layerTreeImpl; 319 LayerTreeImpl* m_layerTreeImpl;
321 320
322 // Properties synchronized from the associated Layer. 321 // Properties synchronized from the associated Layer.
323 gfx::PointF m_anchorPoint; 322 gfx::PointF m_anchorPoint;
324 float m_anchorPointZ; 323 float m_anchorPointZ;
325 gfx::Size m_bounds; 324 gfx::Size m_bounds;
326 gfx::Size m_contentBounds;
327 float m_contentsScaleX;
328 float m_contentsScaleY;
329 gfx::Vector2d m_scrollOffset; 325 gfx::Vector2d m_scrollOffset;
330 bool m_scrollable; 326 bool m_scrollable;
331 bool m_shouldScrollOnMainThread; 327 bool m_shouldScrollOnMainThread;
332 bool m_haveWheelEventHandlers; 328 bool m_haveWheelEventHandlers;
333 Region m_nonFastScrollableRegion; 329 Region m_nonFastScrollableRegion;
334 Region m_touchEventHandlerRegion; 330 Region m_touchEventHandlerRegion;
335 SkColor m_backgroundColor; 331 SkColor m_backgroundColor;
336 332
337 // Whether the "back" of this layer should draw. 333 // Whether the "back" of this layer should draw.
338 bool m_doubleSided; 334 bool m_doubleSided;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // Group of properties that need to be computed based on the layer tree 394 // Group of properties that need to be computed based on the layer tree
399 // hierarchy before layers can be drawn. 395 // hierarchy before layers can be drawn.
400 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; 396 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties;
401 397
402 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 398 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
403 }; 399 };
404 400
405 } 401 }
406 402
407 #endif // CC_LAYER_IMPL_H_ 403 #endif // CC_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698