Chromium Code Reviews| Index: cc/layers/picture_layer_impl.cc |
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
| index f8aa213a92596eef4bcf8a843933d4c1d6f10da2..747d4d7c9ae14222607420a4f4dfacf5682e267f 100644 |
| --- a/cc/layers/picture_layer_impl.cc |
| +++ b/cc/layers/picture_layer_impl.cc |
| @@ -48,6 +48,12 @@ const int kMinHeightForGpuRasteredTile = 256; |
| // of using the same tile size. |
| const int kTileRoundUp = 64; |
| +// The precision value for rounding floating points values of scale factors. |
| +// With this scale factors will be having 3 digits fractional part, which will |
| +// make almost equal (having smaller difference by some magnitude of floating |
| +// point epsilon) scale factors to be considered as same. |
| +const int kScalePrecision = 4; |
| + |
| } // namespace |
| namespace cc { |
| @@ -942,7 +948,10 @@ void PictureLayerImpl::RecalculateRasterScales() { |
| raster_device_scale_ = ideal_device_scale_; |
| raster_page_scale_ = ideal_page_scale_; |
| raster_source_scale_ = ideal_source_scale_; |
| - raster_contents_scale_ = ideal_contents_scale_; |
| + // Get fixed precision scale to avoid creating extra tilings for scales |
| + // which are almost equal. |
| + raster_contents_scale_ = |
| + MathUtil::RoundToFixedPrecision(ideal_contents_scale_, kScalePrecision); |
|
vmpstr
2015/10/19 18:58:38
My understanding is that with this, something like
prashant.n
2015/10/20 18:45:24
We set scale precision as 4. This will give 4 digi
vmpstr
2015/10/20 18:55:23
Yeah you're probably right, but I'd still like to
|
| // If we're not animating, or leaving an animation, and the |
| // ideal_source_scale_ changes, then things are unpredictable, and we fix |