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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, | 62 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, |
63 int id, | 63 int id, |
64 bool is_mask) | 64 bool is_mask) |
65 : LayerImpl(tree_impl, id), | 65 : LayerImpl(tree_impl, id), |
66 twin_layer_(nullptr), | 66 twin_layer_(nullptr), |
67 tilings_(CreatePictureLayerTilingSet()), | 67 tilings_(CreatePictureLayerTilingSet()), |
68 ideal_page_scale_(0.f), | 68 ideal_page_scale_(0.f), |
69 ideal_device_scale_(0.f), | 69 ideal_device_scale_(0.f), |
70 ideal_source_scale_(0.f), | 70 ideal_source_scale_(0.f), |
71 ideal_contents_scale_(0.f), | 71 ideal_contents_scale_(0.f), |
72 last_ideal_source_scale_(0.f), | |
72 raster_page_scale_(0.f), | 73 raster_page_scale_(0.f), |
73 raster_device_scale_(0.f), | 74 raster_device_scale_(0.f), |
74 raster_source_scale_(0.f), | 75 raster_source_scale_(0.f), |
75 raster_contents_scale_(0.f), | 76 raster_contents_scale_(0.f), |
76 low_res_raster_contents_scale_(0.f), | 77 low_res_raster_contents_scale_(0.f), |
77 raster_source_scale_is_fixed_(false), | 78 raster_source_scale_is_fixed_(false), |
78 was_screen_space_transform_animating_(false), | 79 was_screen_space_transform_animating_(false), |
79 only_used_low_res_last_append_quads_(false), | 80 only_used_low_res_last_append_quads_(false), |
80 is_mask_(is_mask), | 81 is_mask_(is_mask), |
81 nearest_neighbor_(false) { | 82 nearest_neighbor_(false) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 if (layer_tree_impl()->IsActiveTree()) | 427 if (layer_tree_impl()->IsActiveTree()) |
427 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); | 428 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); |
428 | 429 |
429 UpdateIdealScales(); | 430 UpdateIdealScales(); |
430 | 431 |
431 if (!raster_contents_scale_ || ShouldAdjustRasterScale()) { | 432 if (!raster_contents_scale_ || ShouldAdjustRasterScale()) { |
432 RecalculateRasterScales(); | 433 RecalculateRasterScales(); |
433 AddTilingsForRasterScale(); | 434 AddTilingsForRasterScale(); |
434 } | 435 } |
435 | 436 |
437 // Inform layer tree impl if we will have blurry content because of fixed | |
438 // raster scale (note that this check should happen after we | |
439 // ReclaculateRasterScales, since that's the function that will determine | |
440 // whether our raster scale is fixed. | |
441 if (raster_source_scale_is_fixed_ && !has_will_change_transform_hint()) { | |
442 if (std::abs(raster_source_scale_ - ideal_source_scale_) >= | |
443 std::numeric_limits<float>::epsilon()) { | |
danakj
2016/05/13 20:41:47
Why?
vmpstr
2016/05/13 21:17:10
Acknowledged.
| |
444 layer_tree_impl()->SetFixedRasterScaleHasBlurryContent(); | |
445 } | |
446 if (std::abs(ideal_source_scale_ - last_ideal_source_scale_) >= | |
447 std::numeric_limits<float>::epsilon()) { | |
448 layer_tree_impl()->SetFixedRasterScaleAttemptedToChangeScale(); | |
449 } | |
450 } | |
451 | |
436 if (layer_tree_impl()->IsActiveTree()) | 452 if (layer_tree_impl()->IsActiveTree()) |
437 AddLowResolutionTilingIfNeeded(); | 453 AddLowResolutionTilingIfNeeded(); |
438 | 454 |
439 DCHECK(raster_page_scale_); | 455 DCHECK(raster_page_scale_); |
440 DCHECK(raster_device_scale_); | 456 DCHECK(raster_device_scale_); |
441 DCHECK(raster_source_scale_); | 457 DCHECK(raster_source_scale_); |
442 DCHECK(raster_contents_scale_); | 458 DCHECK(raster_contents_scale_); |
443 DCHECK(low_res_raster_contents_scale_); | 459 DCHECK(low_res_raster_contents_scale_); |
444 | 460 |
445 was_screen_space_transform_animating_ = | 461 was_screen_space_transform_animating_ = |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1199 DCHECK(CanHaveTilings()); | 1215 DCHECK(CanHaveTilings()); |
1200 | 1216 |
1201 float min_contents_scale = MinimumContentsScale(); | 1217 float min_contents_scale = MinimumContentsScale(); |
1202 DCHECK_GT(min_contents_scale, 0.f); | 1218 DCHECK_GT(min_contents_scale, 0.f); |
1203 | 1219 |
1204 ideal_page_scale_ = IsAffectedByPageScale() | 1220 ideal_page_scale_ = IsAffectedByPageScale() |
1205 ? layer_tree_impl()->current_page_scale_factor() | 1221 ? layer_tree_impl()->current_page_scale_factor() |
1206 : 1.f; | 1222 : 1.f; |
1207 ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); | 1223 ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); |
1208 ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); | 1224 ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); |
1225 last_ideal_source_scale_ = ideal_source_scale_; | |
1209 ideal_source_scale_ = | 1226 ideal_source_scale_ = |
1210 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; | 1227 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; |
1211 } | 1228 } |
1212 | 1229 |
1213 void PictureLayerImpl::GetDebugBorderProperties( | 1230 void PictureLayerImpl::GetDebugBorderProperties( |
1214 SkColor* color, | 1231 SkColor* color, |
1215 float* width) const { | 1232 float* width) const { |
1216 *color = DebugColors::TiledContentLayerBorderColor(); | 1233 *color = DebugColors::TiledContentLayerBorderColor(); |
1217 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1234 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
1218 } | 1235 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1278 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1295 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1279 return !layer_tree_impl()->IsRecycleTree(); | 1296 return !layer_tree_impl()->IsRecycleTree(); |
1280 } | 1297 } |
1281 | 1298 |
1282 bool PictureLayerImpl::HasValidTilePriorities() const { | 1299 bool PictureLayerImpl::HasValidTilePriorities() const { |
1283 return IsOnActiveOrPendingTree() && | 1300 return IsOnActiveOrPendingTree() && |
1284 is_drawn_render_surface_layer_list_member(); | 1301 is_drawn_render_surface_layer_list_member(); |
1285 } | 1302 } |
1286 | 1303 |
1287 } // namespace cc | 1304 } // namespace cc |
OLD | NEW |