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

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: 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/layer_impl.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 0a204ceb6914df96a5bdede2b6c8c9ee7e1c6915..0cb882e7bd66f14f7e6a0f7a9dad973a5249197c 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -373,8 +373,9 @@ 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)
+{
+}
static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
{
@@ -399,15 +400,31 @@ static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform&
float contentsScale = rasterScale * deviceScaleFactor;
if (!layer->boundsContainPageScale())
contentsScale *= pageScaleFactor;
- layer->setContentsScale(contentsScale);
+ layer->calculateContentsScale(
+ contentsScale,
+ &layer->drawProperties().contents_scale_x,
+ &layer->drawProperties().contents_scale_y,
+ &layer->drawProperties().content_bounds);
Layer* maskLayer = layer->maskLayer();
if (maskLayer)
- maskLayer->setContentsScale(contentsScale);
+ {
+ maskLayer->calculateContentsScale(
+ contentsScale,
+ &maskLayer->drawProperties().contents_scale_x,
+ &maskLayer->drawProperties().contents_scale_y,
+ &maskLayer->drawProperties().content_bounds);
+ }
Layer* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLayer()->maskLayer() : 0;
if (replicaMaskLayer)
- replicaMaskLayer->setContentsScale(contentsScale);
+ {
+ replicaMaskLayer->calculateContentsScale(
+ contentsScale,
+ &replicaMaskLayer->drawProperties().contents_scale_x,
+ &replicaMaskLayer->drawProperties().contents_scale_y,
+ &replicaMaskLayer->drawProperties().content_bounds);
+ }
}
template<typename LayerType, typename LayerList>
« no previous file with comments | « 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