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

Unified Diff: cc/layer_tree_host_common.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/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 4af5717b71987c790e4fba3a16999fbd1841d134..57a3e1065a726e83ec308cb1f127cb7f4b8356ea 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -364,8 +364,20 @@ gfx::Transform computeScrollCompensationMatrixForChildren(LayerImpl* layer, cons
return nextScrollCompensationMatrix;
}
-// There is no contentsScale on impl thread.
-static inline void updateLayerContentsScale(LayerImpl*, const gfx::Transform&, float, float, bool) { }
+static inline void updateLayerContentsScale(LayerImpl* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
shawnsingh 2012/12/11 21:54:05 "update" was actually a word that really made me f
enne (OOO) 2012/12/11 23:23:44 Sure, I can rename this. Why is the word update p
+{
+ gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
+ float contentsScale = std::max(transformScale.x(), transformScale.y());
+ layer->setIdealContentsScale(contentsScale);
+
+ LayerImpl* maskLayer = layer->maskLayer();
+ if (maskLayer)
+ maskLayer->setIdealContentsScale(contentsScale);
+
+ LayerImpl* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLayer()->maskLayer() : 0;
+ if (replicaMaskLayer)
+ replicaMaskLayer->setIdealContentsScale(contentsScale);
+}
static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
{
@@ -390,15 +402,15 @@ static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform&
float contentsScale = rasterScale * deviceScaleFactor;
if (!layer->boundsContainPageScale())
contentsScale *= pageScaleFactor;
- layer->setContentsScale(contentsScale);
+ layer->setIdealContentsScale(contentsScale);
Layer* maskLayer = layer->maskLayer();
if (maskLayer)
- maskLayer->setContentsScale(contentsScale);
+ maskLayer->setIdealContentsScale(contentsScale);
Layer* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLayer()->maskLayer() : 0;
if (replicaMaskLayer)
- replicaMaskLayer->setContentsScale(contentsScale);
+ replicaMaskLayer->setIdealContentsScale(contentsScale);
}
// Recursively walks the layer tree starting at the given node and computes all the
« cc/layer.h ('K') | « cc/layer_impl.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698