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..f7da43ec84514b2aefd34bacc1b92d82ac96724f 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 { |
| @@ -1187,11 +1193,14 @@ void PictureLayerImpl::UpdateIdealScales() { |
| float min_contents_scale = MinimumContentsScale(); |
| DCHECK_GT(min_contents_scale, 0.f); |
| - ideal_page_scale_ = IsAffectedByPageScale() |
| - ? layer_tree_impl()->current_page_scale_factor() |
| - : 1.f; |
| + ideal_page_scale_ = |
| + IsAffectedByPageScale() |
| + ? MathUtil::RoundToFixedPrecision( |
| + layer_tree_impl()->current_page_scale_factor(), kScalePrecision) |
| + : 1.f; |
| ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); |
| - ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); |
| + ideal_contents_scale_ = MathUtil::RoundToFixedPrecision( |
| + std::max(GetIdealContentsScale(), min_contents_scale), kScalePrecision); |
|
prashant.n
2015/10/26 16:35:04
Modifying ideal page and contents scales are neede
|
| ideal_source_scale_ = |
| ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; |
| } |