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

Unified Diff: cc/layer_tree_host_common.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/layer_impl_unittest.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index b51fd000dbae12bef0289216177458f968e5153c..65db168e8a4eed350a365863e47c05e2ebeeb7c1 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -525,8 +525,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
WebTransformationMatrix drawTransform = combinedTransform;
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
// M[draw] = M[parent] * LT * S[layer2content]
- drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()),
- layer->bounds().height() / static_cast<double>(layer->contentBounds().height()));
+ drawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(),
+ 1.0 / layer->contentsScaleY());
}
// layerScreenSpaceTransform represents the transform between root layer's "screen space" and local content space.
@@ -566,8 +566,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// The owning layer's draw transform has a scale from content to layer space which we need to undo and
// replace with a scale from the surface's subtree into layer space.
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- drawTransform.scaleNonUniform(layer->contentBounds().width() / static_cast<double>(layer->bounds().width()),
- layer->contentBounds().height() / static_cast<double>(layer->bounds().height()));
+ drawTransform.scaleNonUniform(layer->contentsScaleX(),
+ layer->contentsScaleY());
}
drawTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
renderSurface->setDrawTransform(drawTransform);
@@ -576,8 +576,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
WebTransformationMatrix layerDrawTransform;
layerDrawTransform.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()),
- layer->bounds().height() / static_cast<double>(layer->contentBounds().height()));
+ layerDrawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(),
+ 1.0 / layer->contentsScaleY());
}
layer->setDrawTransform(layerDrawTransform);
@@ -751,8 +751,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// replace with a scale from the surface's subtree into layer space.
WebTransformationMatrix screenSpaceTransform = layer->screenSpaceTransform();
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- screenSpaceTransform.scaleNonUniform(layer->contentBounds().width() / static_cast<double>(layer->bounds().width()),
- layer->contentBounds().height() / static_cast<double>(layer->bounds().height()));
+ screenSpaceTransform.scaleNonUniform(layer->contentsScaleX(),
+ layer->contentsScaleY());
}
screenSpaceTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
renderSurface->setScreenSpaceTransform(screenSpaceTransform);
« no previous file with comments | « cc/layer_impl_unittest.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698