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

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: 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
Index: cc/image_layer.cc
diff --git a/cc/image_layer.cc b/cc/image_layer.cc
index b3477367476817bbfdbe2d2699baef529daf0dae..cbc855ab6978fc4f8e32312c8d4f78e1340c24d8 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())
+ return 1;
+ return static_cast<float>(m_bitmap.width()) / bounds().width();
+}
+
+float ImageLayer::contentsScaleY() const
+{
+ if (bounds().isEmpty())
+ return 1;
+ return static_cast<float>(m_bitmap.height()) / bounds().height();
}
}

Powered by Google App Engine
This is Rietveld 408576698