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 3d06aa4a12b98233ed420ff14677606e16c3c93e..4df83a453e748b83d989e6a3b87161865a2ed321 100644 |
| --- a/cc/layer_tree_host_common.cc |
| +++ b/cc/layer_tree_host_common.cc |
| @@ -540,6 +540,12 @@ static void preCalculateMetaInformation(LayerType* layer) |
| layer->drawProperties().descendants_can_clip_selves = descendantsCanClipSelves; |
| } |
| +static void roundTranslates(gfx::Transform* transform) |
|
danakj
2013/03/06 01:49:28
nit: roundTranslationComponents()
Xianzhu
2013/03/06 02:11:00
Done.
|
| +{ |
| + transform->matrix().setDouble(0, 3, round(transform->matrix().getDouble(0, 3))); |
| + transform->matrix().setDouble(1, 3, round(transform->matrix().getDouble(1, 3))); |
| +} |
| + |
| // Recursively walks the layer tree starting at the given node and computes all the |
| // necessary transformations, clipRects, render surfaces, etc. |
| template<typename LayerType, typename LayerList, typename RenderSurfaceType> |
| @@ -694,6 +700,12 @@ static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo |
| // Note carefully: this is Concat, not Preconcat (implTransform * combinedTransform). |
| combinedTransform.ConcatTransform(layer->implTransform()); |
| + if (!animatingTransformToTarget && layer->scrollable() && combinedTransform.IsScaleOrTranslation()) { |
| + // Align the scrollable layer's position to screen space pixels to avoid blurriness. |
| + // To avoid side-effects, do this only if the transform is simple. |
| + roundTranslates(&combinedTransform); |
| + } |
| + |
| if (layer->fixedToContainerLayer()) { |
| // Special case: this layer is a composited fixed-position layer; we need to |
| // explicitly compensate for all ancestors' nonzero scrollDeltas to keep this layer |