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

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: rebase 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
« no previous file with comments | « cc/contents_scaling_layer.h ('k') | cc/contents_scaling_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/contents_scaling_layer.cc
diff --git a/cc/contents_scaling_layer.cc b/cc/contents_scaling_layer.cc
index 454b6e786e0085b8952c8a7d47243a680f47cbcf..579af3476991b2b3fbb234bb73cef0af65f0fdd8 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());
+void ContentsScalingLayer::calculateContentsScale(
+ float ideal_contents_scale,
+ float* contents_scale_x,
+ float* contents_scale_y,
+ gfx::Size* content_bounds) {
+ *contents_scale_x = ideal_contents_scale;
+ *contents_scale_y = ideal_contents_scale;
+ *content_bounds = computeContentBoundsForScale(
+ ideal_contents_scale,
+ ideal_contents_scale);
}
-float ContentsScalingLayer::contentsScaleX() const {
- return m_contentsScale;
-}
-
-float ContentsScalingLayer::contentsScaleY() const {
- return m_contentsScale;
-}
-
-void ContentsScalingLayer::setContentsScale(float contentsScale) {
- if (m_contentsScale == contentsScale)
- return;
- m_contentsScale = contentsScale;
- setNeedsDisplay();
+void ContentsScalingLayer::didUpdateBounds() {
+ drawProperties().content_bounds = computeContentBoundsForScale(
+ contentsScaleX(),
+ contentsScaleY());
}
} // namespace cc
« no previous file with comments | « cc/contents_scaling_layer.h ('k') | cc/contents_scaling_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698