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

Unified Diff: cc/layer_impl.h

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_impl.h
diff --git a/cc/layer_impl.h b/cc/layer_impl.h
index 05f3b44f374c6259dd281adb592abeaf90ce17d3..f1fae67d3e4bd2695244391c2c48a89875a7a95a 100644
--- a/cc/layer_impl.h
+++ b/cc/layer_impl.h
@@ -167,11 +167,21 @@ public:
LayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
void setRenderTarget(LayerImpl* target) { m_renderTarget = target; }
+ // The client should be responsible for setting bounds, contentBounds and
+ // contentsScale to appropriate values. LayerImpl doesn't calculate any of
+ // them from the other values.
+
void setBounds(const IntSize&);
const IntSize& bounds() const { return m_bounds; }
- const IntSize& contentBounds() const { return m_contentBounds; }
+ // ContentBounds may be [0, 1) pixels larger than bounds * contentsScale.
+ // Don't calculate scale from it. Use contentsScale instead for accuracy.
void setContentBounds(const IntSize&);
+ IntSize contentBounds() const { return m_contentBounds; }
+
+ float contentsScaleX() const { return m_contentsScaleX; }
+ float contentsScaleY() const { return m_contentsScaleY; }
+ void setContentsScale(float contentsScaleX, float contentsScaleY);
const IntPoint& scrollPosition() const { return m_scrollPosition; }
void setScrollPosition(const IntPoint&);
@@ -260,13 +270,13 @@ public:
ScrollbarLayerImpl* verticalScrollbarLayer() const;
void setVerticalScrollbarLayer(ScrollbarLayerImpl*);
+ IntRect layerRectToContentRect(const FloatRect& layerRect) const;
+
protected:
explicit LayerImpl(int);
void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsData&) const;
- IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
-
virtual void dumpLayerProperties(std::string*, int indent) const;
static std::string indentString(int indent);
@@ -300,6 +310,8 @@ private:
float m_anchorPointZ;
IntSize m_bounds;
IntSize m_contentBounds;
+ float m_contentsScaleX;
+ float m_contentsScaleY;
IntPoint m_scrollPosition;
bool m_scrollable;
bool m_shouldScrollOnMainThread;
« 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