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

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: 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/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 92b44d1ad2fa5623daf138e22b18010a3ccc7520..0c9a651c8ae9edd8c269b2d5f271272b316156b6 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -533,8 +533,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
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.
@@ -574,8 +574,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// 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);
@@ -584,8 +584,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
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);
@@ -763,8 +763,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// 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);

Powered by Google App Engine
This is Rietveld 408576698