Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 | 41 |
| 42 // Even for really wide viewports, at some point GPU raster should use | 42 // Even for really wide viewports, at some point GPU raster should use |
| 43 // less than 4 tiles to fill the viewport. This is set to 256 as a | 43 // less than 4 tiles to fill the viewport. This is set to 256 as a |
| 44 // sane minimum for now, but we might want to tune this for low-end. | 44 // sane minimum for now, but we might want to tune this for low-end. |
| 45 const int kMinHeightForGpuRasteredTile = 256; | 45 const int kMinHeightForGpuRasteredTile = 256; |
| 46 | 46 |
| 47 // When making odd-sized tiles, round them up to increase the chances | 47 // When making odd-sized tiles, round them up to increase the chances |
| 48 // of using the same tile size. | 48 // of using the same tile size. |
| 49 const int kTileRoundUp = 64; | 49 const int kTileRoundUp = 64; |
| 50 | 50 |
| 51 // The precision value for rounding floating points values of scale factors. | |
| 52 // With this scale factors will be having 3 digits fractional part, which will | |
| 53 // make almost equal (having smaller difference by some magnitude of floating | |
| 54 // point epsilon) scale factors to be considered as same. | |
| 55 const int kScalePrecision = 4; | |
| 56 | |
| 51 } // namespace | 57 } // namespace |
| 52 | 58 |
| 53 namespace cc { | 59 namespace cc { |
| 54 | 60 |
| 55 PictureLayerImpl::PictureLayerImpl( | 61 PictureLayerImpl::PictureLayerImpl( |
| 56 LayerTreeImpl* tree_impl, | 62 LayerTreeImpl* tree_impl, |
| 57 int id, | 63 int id, |
| 58 bool is_mask, | 64 bool is_mask, |
| 59 scoped_refptr<SyncedScrollOffset> scroll_offset) | 65 scoped_refptr<SyncedScrollOffset> scroll_offset) |
| 60 : LayerImpl(tree_impl, id, scroll_offset), | 66 : LayerImpl(tree_impl, id, scroll_offset), |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1180 : settings.skewport_target_time_in_seconds, | 1186 : settings.skewport_target_time_in_seconds, |
| 1181 settings.skewport_extrapolation_limit_in_content_pixels); | 1187 settings.skewport_extrapolation_limit_in_content_pixels); |
| 1182 } | 1188 } |
| 1183 | 1189 |
| 1184 void PictureLayerImpl::UpdateIdealScales() { | 1190 void PictureLayerImpl::UpdateIdealScales() { |
| 1185 DCHECK(CanHaveTilings()); | 1191 DCHECK(CanHaveTilings()); |
| 1186 | 1192 |
| 1187 float min_contents_scale = MinimumContentsScale(); | 1193 float min_contents_scale = MinimumContentsScale(); |
| 1188 DCHECK_GT(min_contents_scale, 0.f); | 1194 DCHECK_GT(min_contents_scale, 0.f); |
| 1189 | 1195 |
| 1190 ideal_page_scale_ = IsAffectedByPageScale() | 1196 ideal_page_scale_ = |
| 1191 ? layer_tree_impl()->current_page_scale_factor() | 1197 IsAffectedByPageScale() |
| 1192 : 1.f; | 1198 ? MathUtil::RoundToFixedPrecision( |
| 1199 layer_tree_impl()->current_page_scale_factor(), kScalePrecision) | |
| 1200 : 1.f; | |
| 1193 ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); | 1201 ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); |
| 1194 ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); | 1202 ideal_contents_scale_ = MathUtil::RoundToFixedPrecision( |
| 1203 std::max(GetIdealContentsScale(), min_contents_scale), kScalePrecision); | |
|
prashant.n
2015/10/26 16:35:04
Modifying ideal page and contents scales are neede
| |
| 1195 ideal_source_scale_ = | 1204 ideal_source_scale_ = |
| 1196 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; | 1205 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; |
| 1197 } | 1206 } |
| 1198 | 1207 |
| 1199 void PictureLayerImpl::GetDebugBorderProperties( | 1208 void PictureLayerImpl::GetDebugBorderProperties( |
| 1200 SkColor* color, | 1209 SkColor* color, |
| 1201 float* width) const { | 1210 float* width) const { |
| 1202 *color = DebugColors::TiledContentLayerBorderColor(); | 1211 *color = DebugColors::TiledContentLayerBorderColor(); |
| 1203 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1212 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
| 1204 } | 1213 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1263 | 1272 |
| 1264 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1273 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1265 return !layer_tree_impl()->IsRecycleTree(); | 1274 return !layer_tree_impl()->IsRecycleTree(); |
| 1266 } | 1275 } |
| 1267 | 1276 |
| 1268 bool PictureLayerImpl::HasValidTilePriorities() const { | 1277 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1269 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1278 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1270 } | 1279 } |
| 1271 | 1280 |
| 1272 } // namespace cc | 1281 } // namespace cc |
| OLD | NEW |