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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11777008: cc: Use maximum tiling contents scales for picture layer scale (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ok, 1.f Created 7 years, 11 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.cc ('k') | cc/picture_layer_impl.h » ('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 2210894e85570cbeb7f799d5a4490b7ee8a25ce1..275f3b60d618929c8fef74d7a687972a443f2736 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -389,8 +389,41 @@ gfx::Transform computeScrollCompensationMatrixForChildren(LayerImpl* layer, cons
return nextScrollCompensationMatrix;
}
+template<typename LayerType>
+static inline void calculateContentsScale(LayerType* layer, float contentsScale)
+{
+ layer->calculateContentsScale(
+ contentsScale,
+ &layer->drawProperties().contents_scale_x,
+ &layer->drawProperties().contents_scale_y,
+ &layer->drawProperties().content_bounds);
+
+ LayerType* maskLayer = layer->maskLayer();
+ if (maskLayer)
+ {
+ maskLayer->calculateContentsScale(
+ contentsScale,
+ &maskLayer->drawProperties().contents_scale_x,
+ &maskLayer->drawProperties().contents_scale_y,
+ &maskLayer->drawProperties().content_bounds);
+ }
+
+ LayerType* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLayer()->maskLayer() : 0;
+ if (replicaMaskLayer)
+ {
+ replicaMaskLayer->calculateContentsScale(
+ contentsScale,
+ &replicaMaskLayer->drawProperties().contents_scale_x,
+ &replicaMaskLayer->drawProperties().contents_scale_y,
+ &replicaMaskLayer->drawProperties().content_bounds);
+ }
+}
+
static inline void updateLayerContentsScale(LayerImpl* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
{
+ gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform, deviceScaleFactor * pageScaleFactor);
+ float contentsScale = std::max(transformScale.x(), transformScale.y());
+ calculateContentsScale(layer, contentsScale);
}
static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
@@ -416,31 +449,8 @@ static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform&
float contentsScale = rasterScale * deviceScaleFactor;
if (!layer->boundsContainPageScale())
contentsScale *= pageScaleFactor;
- layer->calculateContentsScale(
- contentsScale,
- &layer->drawProperties().contents_scale_x,
- &layer->drawProperties().contents_scale_y,
- &layer->drawProperties().content_bounds);
-
- Layer* maskLayer = layer->maskLayer();
- if (maskLayer)
- {
- 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->calculateContentsScale(
- contentsScale,
- &replicaMaskLayer->drawProperties().contents_scale_x,
- &replicaMaskLayer->drawProperties().contents_scale_y,
- &replicaMaskLayer->drawProperties().content_bounds);
- }
+ calculateContentsScale(layer, contentsScale);
}
template<typename LayerType, typename LayerList>
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698