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

Unified Diff: cc/contents_scaling_layer.cc

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/contents_scaling_layer.cc
diff --git a/cc/contents_scaling_layer.cc b/cc/contents_scaling_layer.cc
index 454b6e786e0085b8952c8a7d47243a680f47cbcf..3131154dd9e5b8480a8191a476b7484be6160838 100644
--- a/cc/contents_scaling_layer.cc
+++ b/cc/contents_scaling_layer.cc
@@ -11,30 +11,28 @@ gfx::Size ContentsScalingLayer::computeContentBoundsForScale(float scaleX, float
return gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scaleX, scaleY));
}
-ContentsScalingLayer::ContentsScalingLayer()
- : m_contentsScale(1.0) {
+ContentsScalingLayer::ContentsScalingLayer() {
}
ContentsScalingLayer::~ContentsScalingLayer() {
}
-gfx::Size ContentsScalingLayer::contentBounds() const {
- return computeContentBoundsForScale(contentsScaleX(), contentsScaleY());
-}
-
-float ContentsScalingLayer::contentsScaleX() const {
- return m_contentsScale;
-}
+void ContentsScalingLayer::setIdealContentsScale(
+ float ideal_contents_scale) {
+ if (m_drawProperties.ideal_contents_scale == ideal_contents_scale)
+ return;
-float ContentsScalingLayer::contentsScaleY() const {
- return m_contentsScale;
+ m_drawProperties.ideal_contents_scale = ideal_contents_scale;
+ m_drawProperties.contents_scale_x = ideal_contents_scale;
+ m_drawProperties.contents_scale_y = ideal_contents_scale;
+ didUpdateBounds();
+ setNeedsDisplay();
}
-void ContentsScalingLayer::setContentsScale(float contentsScale) {
- if (m_contentsScale == contentsScale)
- return;
- m_contentsScale = contentsScale;
- setNeedsDisplay();
+void ContentsScalingLayer::didUpdateBounds() {
+ m_drawProperties.content_bounds = computeContentBoundsForScale(
+ m_drawProperties.ideal_contents_scale,
+ m_drawProperties.ideal_contents_scale);
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698