OLD | NEW |
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 LayerChromium_h | 5 #ifndef LayerChromium_h |
6 #define LayerChromium_h | 6 #define LayerChromium_h |
7 | 7 |
8 #include "FloatPoint.h" | 8 #include "FloatPoint.h" |
9 #include "Region.h" | 9 #include "Region.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bool hasMask() const { return m_maskLayer; } | 182 bool hasMask() const { return m_maskLayer; } |
183 bool hasReplica() const { return m_replicaLayer; } | 183 bool hasReplica() const { return m_replicaLayer; } |
184 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 184 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
185 | 185 |
186 // These methods typically need to be overwritten by derived classes. | 186 // These methods typically need to be overwritten by derived classes. |
187 virtual bool drawsContent() const; | 187 virtual bool drawsContent() const; |
188 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) { } | 188 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) { } |
189 virtual bool needMoreUpdates(); | 189 virtual bool needMoreUpdates(); |
190 virtual void setIsMask(bool) { } | 190 virtual void setIsMask(bool) { } |
191 virtual void bindContentsTexture() { } | 191 virtual void bindContentsTexture() { } |
192 virtual bool needsContentsScale() const; | |
193 | 192 |
194 void setDebugBorderColor(SkColor); | 193 void setDebugBorderColor(SkColor); |
195 void setDebugBorderWidth(float); | 194 void setDebugBorderWidth(float); |
196 void setDebugName(const std::string&); | 195 void setDebugName(const std::string&); |
197 | 196 |
198 virtual void pushPropertiesTo(LayerImpl*); | 197 virtual void pushPropertiesTo(LayerImpl*); |
199 | 198 |
200 void clearRenderSurface() { m_renderSurface.reset(); } | 199 void clearRenderSurface() { m_renderSurface.reset(); } |
201 RenderSurface* renderSurface() const { return m_renderSurface.get(); } | 200 RenderSurface* renderSurface() const { return m_renderSurface.get(); } |
202 void createRenderSurface(); | 201 void createRenderSurface(); |
(...skipping 19 matching lines...) Expand all Loading... |
222 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra
wTransform = matrix; } | 221 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra
wTransform = matrix; } |
223 // This moves from content space, with origin the top left to screen space w
ith origin in the top left. | 222 // This moves from content space, with origin the top left to screen space w
ith origin in the top left. |
224 // It converts logical, non-page-scaled pixels to physical pixels. | 223 // It converts logical, non-page-scaled pixels to physical pixels. |
225 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } | 224 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } |
226 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix)
{ m_screenSpaceTransform = matrix; } | 225 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix)
{ m_screenSpaceTransform = matrix; } |
227 const IntRect& drawableContentRect() const { return m_drawableContentRect; } | 226 const IntRect& drawableContentRect() const { return m_drawableContentRect; } |
228 void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = r
ect; } | 227 void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = r
ect; } |
229 | 228 |
230 // The contentsScale converts from logical, non-page-scaled pixels to target
pixels. | 229 // The contentsScale converts from logical, non-page-scaled pixels to target
pixels. |
231 // The contentsScale is 1 for the root layer as it is already in physical pi
xels. | 230 // The contentsScale is 1 for the root layer as it is already in physical pi
xels. |
232 float contentsScale() const { return m_contentsScale; } | 231 // By default contentsScale is forced to be 1 except for subclasses of Conte
ntsScalingLayer. |
233 void setContentsScale(float); | 232 virtual float contentsScaleX() const { return 1.0; } |
| 233 virtual float contentsScaleY() const { return 1.0; } |
| 234 virtual void setContentsScale(float contentsScale) { } |
234 | 235 |
235 // The scale at which contents should be rastered, to match the scale at | 236 // The scale at which contents should be rastered, to match the scale at |
236 // which they will drawn to the screen. This scale is a component of the | 237 // which they will drawn to the screen. This scale is a component of the |
237 // contentsScale() but does not include page/device scale factors. | 238 // contentsScale() but does not include page/device scale factors. |
238 float rasterScale() const { return m_rasterScale; } | 239 float rasterScale() const { return m_rasterScale; } |
239 void setRasterScale(float scale); | 240 void setRasterScale(float scale); |
240 | 241 |
241 // When true, the rasterScale() will be set by the compositor. If false, it | 242 // When true, the rasterScale() will be set by the compositor. If false, it |
242 // will use whatever value is given to it by the embedder. | 243 // will use whatever value is given to it by the embedder. |
243 bool automaticallyComputeRasterScale() { return m_automaticallyComputeRaster
Scale; } | 244 bool automaticallyComputeRasterScale() { return m_automaticallyComputeRaster
Scale; } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 384 |
384 Layer* m_renderTarget; | 385 Layer* m_renderTarget; |
385 | 386 |
386 WebKit::WebTransformationMatrix m_drawTransform; | 387 WebKit::WebTransformationMatrix m_drawTransform; |
387 WebKit::WebTransformationMatrix m_screenSpaceTransform; | 388 WebKit::WebTransformationMatrix m_screenSpaceTransform; |
388 bool m_drawTransformIsAnimating; | 389 bool m_drawTransformIsAnimating; |
389 bool m_screenSpaceTransformIsAnimating; | 390 bool m_screenSpaceTransformIsAnimating; |
390 | 391 |
391 // Uses target surface space. | 392 // Uses target surface space. |
392 IntRect m_drawableContentRect; | 393 IntRect m_drawableContentRect; |
393 float m_contentsScale; | |
394 float m_rasterScale; | 394 float m_rasterScale; |
395 bool m_automaticallyComputeRasterScale; | 395 bool m_automaticallyComputeRasterScale; |
396 bool m_boundsContainPageScale; | 396 bool m_boundsContainPageScale; |
397 | 397 |
398 WebKit::WebTransformationMatrix m_implTransform; | 398 WebKit::WebTransformationMatrix m_implTransform; |
399 | 399 |
400 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; | 400 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; |
401 WebKit::WebLayerScrollClient* m_layerScrollClient; | 401 WebKit::WebLayerScrollClient* m_layerScrollClient; |
402 }; | 402 }; |
403 | 403 |
404 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*); | 404 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*); |
405 | 405 |
406 } // namespace cc | 406 } // namespace cc |
407 | 407 |
408 #endif | 408 #endif |
OLD | NEW |