Chromium Code Reviews| 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..27779d7b083becf3802f2d2e84fbfdb8149259e2 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); |
|
danakj
2013/01/07 15:57:44
Are you sure you don't want deviceScaleFactor * pa
enne (OOO)
2013/01/07 17:00:01
Oh! Good catch. Done.
|
| + 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> |