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

Unified Diff: cc/image_layer.cc

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/image_layer.h ('k') | cc/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/image_layer.cc
diff --git a/cc/image_layer.cc b/cc/image_layer.cc
index e1620073e46a3db9c3e059e697decb0e347797e1..3c1712eeffc280d3af0e5ae3372965442ee9bb33 100644
--- a/cc/image_layer.cc
+++ b/cc/image_layer.cc
@@ -150,10 +150,18 @@ bool ImageLayer::drawsContent() const
return !m_bitmap.isNull() && TiledLayer::drawsContent();
}
-bool ImageLayer::needsContentsScale() const
+float ImageLayer::contentsScaleX() const
{
- // Contents scale is not need for image layer because this can be done in compositor more efficiently.
- return false;
+ if (bounds().isEmpty() || contentBounds().isEmpty())
+ return 1;
+ return static_cast<float>(m_bitmap.width()) / bounds().width();
+}
+
+float ImageLayer::contentsScaleY() const
+{
+ if (bounds().isEmpty() || contentBounds().isEmpty())
+ return 1;
+ return static_cast<float>(m_bitmap.height()) / bounds().height();
}
}
« no previous file with comments | « cc/image_layer.h ('k') | cc/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698