| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 ideal_device_scale_(0.f), | 75 ideal_device_scale_(0.f), |
| 76 ideal_source_scale_(0.f), | 76 ideal_source_scale_(0.f), |
| 77 ideal_contents_scale_(0.f), | 77 ideal_contents_scale_(0.f), |
| 78 raster_page_scale_(0.f), | 78 raster_page_scale_(0.f), |
| 79 raster_device_scale_(0.f), | 79 raster_device_scale_(0.f), |
| 80 raster_source_scale_(0.f), | 80 raster_source_scale_(0.f), |
| 81 raster_contents_scale_(0.f), | 81 raster_contents_scale_(0.f), |
| 82 low_res_raster_contents_scale_(0.f), | 82 low_res_raster_contents_scale_(0.f), |
| 83 raster_source_scale_is_fixed_(false), | 83 raster_source_scale_is_fixed_(false), |
| 84 was_screen_space_transform_animating_(false), | 84 was_screen_space_transform_animating_(false), |
| 85 should_update_tile_priorities_(false), | |
| 86 only_used_low_res_last_append_quads_(false), | 85 only_used_low_res_last_append_quads_(false), |
| 87 is_mask_(is_mask), | 86 is_mask_(is_mask), |
| 88 nearest_neighbor_(false) { | 87 nearest_neighbor_(false) { |
| 89 layer_tree_impl()->RegisterPictureLayerImpl(this); | 88 layer_tree_impl()->RegisterPictureLayerImpl(this); |
| 90 } | 89 } |
| 91 | 90 |
| 92 PictureLayerImpl::~PictureLayerImpl() { | 91 PictureLayerImpl::~PictureLayerImpl() { |
| 93 if (twin_layer_) | 92 if (twin_layer_) |
| 94 twin_layer_->twin_layer_ = nullptr; | 93 twin_layer_->twin_layer_ = nullptr; |
| 95 layer_tree_impl()->UnregisterPictureLayerImpl(this); | 94 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 DCHECK(raster_source_scale_); | 454 DCHECK(raster_source_scale_); |
| 456 DCHECK(raster_contents_scale_); | 455 DCHECK(raster_contents_scale_); |
| 457 DCHECK(low_res_raster_contents_scale_); | 456 DCHECK(low_res_raster_contents_scale_); |
| 458 | 457 |
| 459 was_screen_space_transform_animating_ = | 458 was_screen_space_transform_animating_ = |
| 460 draw_properties().screen_space_transform_is_animating; | 459 draw_properties().screen_space_transform_is_animating; |
| 461 | 460 |
| 462 if (draw_transform_is_animating()) | 461 if (draw_transform_is_animating()) |
| 463 raster_source_->SetShouldAttemptToUseDistanceFieldText(); | 462 raster_source_->SetShouldAttemptToUseDistanceFieldText(); |
| 464 | 463 |
| 465 should_update_tile_priorities_ = true; | |
| 466 | |
| 467 return UpdateTilePriorities(occlusion_in_content_space); | 464 return UpdateTilePriorities(occlusion_in_content_space); |
| 468 } | 465 } |
| 469 | 466 |
| 470 bool PictureLayerImpl::UpdateTilePriorities( | 467 bool PictureLayerImpl::UpdateTilePriorities( |
| 471 const Occlusion& occlusion_in_content_space) { | 468 const Occlusion& occlusion_in_content_space) { |
| 472 DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0); | 469 DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0); |
| 473 | 470 |
| 474 double current_frame_time_in_seconds = | 471 double current_frame_time_in_seconds = |
| 475 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - | 472 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - |
| 476 base::TimeTicks()).InSecondsF(); | 473 base::TimeTicks()).InSecondsF(); |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 return nextafterf(max_scale, 0.f); | 1066 return nextafterf(max_scale, 0.f); |
| 1070 } | 1067 } |
| 1071 | 1068 |
| 1072 void PictureLayerImpl::ResetRasterScale() { | 1069 void PictureLayerImpl::ResetRasterScale() { |
| 1073 raster_page_scale_ = 0.f; | 1070 raster_page_scale_ = 0.f; |
| 1074 raster_device_scale_ = 0.f; | 1071 raster_device_scale_ = 0.f; |
| 1075 raster_source_scale_ = 0.f; | 1072 raster_source_scale_ = 0.f; |
| 1076 raster_contents_scale_ = 0.f; | 1073 raster_contents_scale_ = 0.f; |
| 1077 low_res_raster_contents_scale_ = 0.f; | 1074 low_res_raster_contents_scale_ = 0.f; |
| 1078 raster_source_scale_is_fixed_ = false; | 1075 raster_source_scale_is_fixed_ = false; |
| 1079 | |
| 1080 // When raster scales aren't valid, don't update tile priorities until | |
| 1081 // this layer has been updated via UpdateDrawProperties. | |
| 1082 should_update_tile_priorities_ = false; | |
| 1083 } | 1076 } |
| 1084 | 1077 |
| 1085 bool PictureLayerImpl::CanHaveTilings() const { | 1078 bool PictureLayerImpl::CanHaveTilings() const { |
| 1086 if (raster_source_->IsSolidColor()) | 1079 if (raster_source_->IsSolidColor()) |
| 1087 return false; | 1080 return false; |
| 1088 if (!DrawsContent()) | 1081 if (!DrawsContent()) |
| 1089 return false; | 1082 return false; |
| 1090 if (!raster_source_->HasRecordings()) | 1083 if (!raster_source_->HasRecordings()) |
| 1091 return false; | 1084 return false; |
| 1092 // If the |raster_source_| has a recording it should have non-empty bounds. | 1085 // If the |raster_source_| has a recording it should have non-empty bounds. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 | 1279 |
| 1287 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | 1280 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
| 1288 if (!layer_tree_impl()->IsActiveTree()) | 1281 if (!layer_tree_impl()->IsActiveTree()) |
| 1289 return true; | 1282 return true; |
| 1290 | 1283 |
| 1291 return AllTilesRequiredAreReadyToDraw( | 1284 return AllTilesRequiredAreReadyToDraw( |
| 1292 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 1285 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
| 1293 } | 1286 } |
| 1294 | 1287 |
| 1295 } // namespace cc | 1288 } // namespace cc |
| OLD | NEW |