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

Side by Side Diff: cc/layer.h

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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/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 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
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
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;
233 virtual float contentsScaleY() const;
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 29 matching lines...) Expand all
273 274
274 bool hasActiveAnimation() const; 275 bool hasActiveAnimation() const;
275 276
276 virtual void notifyAnimationStarted(const AnimationEvent&, double wallClockT ime); 277 virtual void notifyAnimationStarted(const AnimationEvent&, double wallClockT ime);
277 virtual void notifyAnimationFinished(double wallClockTime); 278 virtual void notifyAnimationFinished(double wallClockTime);
278 279
279 virtual Region visibleContentOpaqueRegion() const; 280 virtual Region visibleContentOpaqueRegion() const;
280 281
281 virtual ScrollbarLayer* toScrollbarLayer(); 282 virtual ScrollbarLayer* toScrollbarLayer();
282 283
284 IntRect layerRectToContentRect(const FloatRect& layerRect) const;
285
283 protected: 286 protected:
284 friend class LayerImpl; 287 friend class LayerImpl;
285 friend class TreeSynchronizer; 288 friend class TreeSynchronizer;
286 virtual ~Layer(); 289 virtual ~Layer();
287 290
288 Layer(); 291 Layer();
289 292
290 void setNeedsCommit(); 293 void setNeedsCommit();
291 294
292 IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
293
294 // This flag is set when layer need repainting/updating. 295 // This flag is set when layer need repainting/updating.
295 bool m_needsDisplay; 296 bool m_needsDisplay;
296 297
297 // Tracks whether this layer may have changed stacking order with its siblin gs. 298 // Tracks whether this layer may have changed stacking order with its siblin gs.
298 bool m_stackingOrderChanged; 299 bool m_stackingOrderChanged;
299 300
300 // The update rect is the region of the compositor resource that was actuall y updated by the compositor. 301 // The update rect is the region of the compositor resource that was actuall y updated by the compositor.
301 // For layers that may do updating outside the compositor's control (i.e. pl ugin layers), this information 302 // For layers that may do updating outside the compositor's control (i.e. pl ugin layers), this information
302 // is not available and the update rect will remain empty. 303 // is not available and the update rect will remain empty.
303 // Note this rect is in layer space (not content space). 304 // Note this rect is in layer space (not content space).
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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