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

Side by Side Diff: cc/layer.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/image_layer.cc ('k') | cc/layer.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 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> 8 #include <public/WebFilterOperations.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 void setAnchorPointZ(float); 78 void setAnchorPointZ(float);
79 float anchorPointZ() const { return m_anchorPointZ; } 79 float anchorPointZ() const { return m_anchorPointZ; }
80 80
81 virtual void setBackgroundColor(SkColor); 81 virtual void setBackgroundColor(SkColor);
82 SkColor backgroundColor() const { return m_backgroundColor; } 82 SkColor backgroundColor() const { return m_backgroundColor; }
83 83
84 // A layer's bounds are in logical, non-page-scaled pixels (however, the 84 // A layer's bounds are in logical, non-page-scaled pixels (however, the
85 // root layer's bounds are in physical pixels). 85 // root layer's bounds are in physical pixels).
86 void setBounds(const gfx::Size&); 86 void setBounds(const gfx::Size&);
87 // TODO(enne): remove this function: http://crbug.com/166023
88 virtual void didUpdateBounds();
87 const gfx::Size& bounds() const { return m_bounds; } 89 const gfx::Size& bounds() const { return m_bounds; }
88 virtual gfx::Size contentBounds() const;
89 90
90 void setMasksToBounds(bool); 91 void setMasksToBounds(bool);
91 bool masksToBounds() const { return m_masksToBounds; } 92 bool masksToBounds() const { return m_masksToBounds; }
92 93
93 void setMaskLayer(Layer*); 94 void setMaskLayer(Layer*);
94 Layer* maskLayer() { return m_maskLayer.get(); } 95 Layer* maskLayer() { return m_maskLayer.get(); }
95 const Layer* maskLayer() const { return m_maskLayer.get(); } 96 const Layer* maskLayer() const { return m_maskLayer.get(); }
96 97
97 virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect); 98 virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect);
98 void setNeedsDisplay() { setNeedsDisplayRect(gfx::RectF(gfx::PointF(), bound s())); } 99 void setNeedsDisplay() { setNeedsDisplayRect(gfx::RectF(gfx::PointF(), bound s())); }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 void setDebugName(const std::string&); 220 void setDebugName(const std::string&);
220 221
221 virtual void pushPropertiesTo(LayerImpl*); 222 virtual void pushPropertiesTo(LayerImpl*);
222 223
223 void clearRenderSurface() { m_drawProperties.render_surface.reset(); } 224 void clearRenderSurface() { m_drawProperties.render_surface.reset(); }
224 void createRenderSurface(); 225 void createRenderSurface();
225 226
226 // The contentsScale converts from logical, non-page-scaled pixels to target pixels. 227 // The contentsScale converts from logical, non-page-scaled pixels to target pixels.
227 // The contentsScale is 1 for the root layer as it is already in physical pi xels. 228 // The contentsScale is 1 for the root layer as it is already in physical pi xels.
228 // By default contentsScale is forced to be 1 except for subclasses of Conte ntsScalingLayer. 229 // By default contentsScale is forced to be 1 except for subclasses of Conte ntsScalingLayer.
229 virtual float contentsScaleX() const; 230 float contentsScaleX() const { return m_drawProperties.contents_scale_x; }
230 virtual float contentsScaleY() const; 231 float contentsScaleY() const { return m_drawProperties.contents_scale_y; }
231 virtual void setContentsScale(float contentsScale) { } 232 gfx::Size contentBounds() const { return m_drawProperties.content_bounds; }
233 virtual void calculateContentsScale(
234 float idealContentsScale,
235 float* contentsScaleX,
236 float* contentsScaleY,
237 gfx::Size* contentBounds);
232 238
233 // The scale at which contents should be rastered, to match the scale at 239 // The scale at which contents should be rastered, to match the scale at
234 // which they will drawn to the screen. This scale is a component of the 240 // which they will drawn to the screen. This scale is a component of the
235 // contentsScale() but does not include page/device scale factors. 241 // contentsScale() but does not include page/device scale factors.
236 float rasterScale() const { return m_rasterScale; } 242 float rasterScale() const { return m_rasterScale; }
237 void setRasterScale(float scale); 243 void setRasterScale(float scale);
238 244
239 // When true, the rasterScale() will be set by the compositor. If false, it 245 // When true, the rasterScale() will be set by the compositor. If false, it
240 // will use whatever value is given to it by the embedder. 246 // will use whatever value is given to it by the embedder.
241 bool automaticallyComputeRasterScale() { return m_automaticallyComputeRaster Scale; } 247 bool automaticallyComputeRasterScale() { return m_automaticallyComputeRaster Scale; }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 WebKit::WebLayerScrollClient* m_layerScrollClient; 390 WebKit::WebLayerScrollClient* m_layerScrollClient;
385 391
386 DrawProperties<Layer, RenderSurface> m_drawProperties; 392 DrawProperties<Layer, RenderSurface> m_drawProperties;
387 }; 393 };
388 394
389 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*); 395 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*);
390 396
391 } // namespace cc 397 } // namespace cc
392 398
393 #endif // CC_LAYER_H_ 399 #endif // CC_LAYER_H_
OLDNEW
« no previous file with comments | « cc/image_layer.cc ('k') | cc/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698