| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 on_demand_missing_tile_count); | 401 on_demand_missing_tile_count); |
| 402 } | 402 } |
| 403 | 403 |
| 404 // Aggressively remove any tilings that are not seen to save memory. Note | 404 // Aggressively remove any tilings that are not seen to save memory. Note |
| 405 // that this is at the expense of doing cause more frequent re-painting. A | 405 // that this is at the expense of doing cause more frequent re-painting. A |
| 406 // better scheme would be to maintain a tighter visible_content_rect for the | 406 // better scheme would be to maintain a tighter visible_content_rect for the |
| 407 // finer tilings. | 407 // finer tilings. |
| 408 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); | 408 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); |
| 409 } | 409 } |
| 410 | 410 |
| 411 bool PictureLayerImpl::UpdateTiles(const Occlusion& occlusion_in_content_space, | 411 bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) { |
| 412 bool resourceless_software_draw) { | |
| 413 DCHECK_EQ(1.f, contents_scale_x()); | 412 DCHECK_EQ(1.f, contents_scale_x()); |
| 414 DCHECK_EQ(1.f, contents_scale_y()); | 413 DCHECK_EQ(1.f, contents_scale_y()); |
| 415 | 414 |
| 416 if (!resourceless_software_draw) { | 415 if (!resourceless_software_draw) { |
| 417 visible_rect_for_tile_priority_ = visible_content_rect(); | 416 visible_rect_for_tile_priority_ = visible_content_rect(); |
| 418 } | 417 } |
| 419 | 418 |
| 420 if (!CanHaveTilings()) { | 419 if (!CanHaveTilings()) { |
| 421 ideal_page_scale_ = 0.f; | 420 ideal_page_scale_ = 0.f; |
| 422 ideal_device_scale_ = 0.f; | 421 ideal_device_scale_ = 0.f; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 445 DCHECK(raster_device_scale_); | 444 DCHECK(raster_device_scale_); |
| 446 DCHECK(raster_source_scale_); | 445 DCHECK(raster_source_scale_); |
| 447 DCHECK(raster_contents_scale_); | 446 DCHECK(raster_contents_scale_); |
| 448 DCHECK(low_res_raster_contents_scale_); | 447 DCHECK(low_res_raster_contents_scale_); |
| 449 | 448 |
| 450 was_screen_space_transform_animating_ = | 449 was_screen_space_transform_animating_ = |
| 451 draw_properties().screen_space_transform_is_animating; | 450 draw_properties().screen_space_transform_is_animating; |
| 452 | 451 |
| 453 if (draw_transform_is_animating()) | 452 if (draw_transform_is_animating()) |
| 454 raster_source_->SetShouldAttemptToUseDistanceFieldText(); | 453 raster_source_->SetShouldAttemptToUseDistanceFieldText(); |
| 455 return UpdateTilePriorities(occlusion_in_content_space); | |
| 456 } | |
| 457 | |
| 458 bool PictureLayerImpl::UpdateTilePriorities( | |
| 459 const Occlusion& occlusion_in_content_space) { | |
| 460 DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0); | |
| 461 | 454 |
| 462 double current_frame_time_in_seconds = | 455 double current_frame_time_in_seconds = |
| 463 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - | 456 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - |
| 464 base::TimeTicks()).InSecondsF(); | 457 base::TimeTicks()).InSecondsF(); |
| 465 UpdateViewportRectForTilePriorityInContentSpace(); | 458 UpdateViewportRectForTilePriorityInContentSpace(); |
| 466 | 459 |
| 467 // The tiling set can require tiles for activation any of the following | 460 // The tiling set can require tiles for activation any of the following |
| 468 // conditions are true: | 461 // conditions are true: |
| 469 // - This layer produced a high-res or non-ideal-res tile last frame. | 462 // - This layer produced a high-res or non-ideal-res tile last frame. |
| 470 // - We're in requires high res to draw mode. | 463 // - We're in requires high res to draw mode. |
| 471 // - We're not in smoothness takes priority mode. | 464 // - We're not in smoothness takes priority mode. |
| 472 // To put different, the tiling set can't require tiles for activation if | 465 // To put different, the tiling set can't require tiles for activation if |
| 473 // we're in smoothness mode and only used low-res or checkerboard to draw last | 466 // we're in smoothness mode and only used low-res or checkerboard to draw last |
| 474 // frame and we don't need high res to draw. | 467 // frame and we don't need high res to draw. |
| 475 // | 468 // |
| 476 // The reason for this is that we should be able to activate sooner and get a | 469 // The reason for this is that we should be able to activate sooner and get a |
| 477 // more up to date recording, so we don't run out of recording on the active | 470 // more up to date recording, so we don't run out of recording on the active |
| 478 // tree. | 471 // tree. |
| 479 bool can_require_tiles_for_activation = | 472 bool can_require_tiles_for_activation = |
| 480 !only_used_low_res_last_append_quads_ || RequiresHighResToDraw() || | 473 !only_used_low_res_last_append_quads_ || RequiresHighResToDraw() || |
| 481 !layer_tree_impl()->SmoothnessTakesPriority(); | 474 !layer_tree_impl()->SmoothnessTakesPriority(); |
| 482 | 475 |
| 476 static const Occlusion kEmptyOcclusion; |
| 477 const Occlusion& occlusion_in_content_space = |
| 478 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization |
| 479 ? draw_properties().occlusion_in_content_space |
| 480 : kEmptyOcclusion; |
| 481 |
| 483 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since | 482 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since |
| 484 // they are the same space in picture layer, as contents scale is always 1. | 483 // they are the same space in picture layer, as contents scale is always 1. |
| 485 bool updated = tilings_->UpdateTilePriorities( | 484 bool updated = tilings_->UpdateTilePriorities( |
| 486 viewport_rect_for_tile_priority_in_content_space_, ideal_contents_scale_, | 485 viewport_rect_for_tile_priority_in_content_space_, ideal_contents_scale_, |
| 487 current_frame_time_in_seconds, occlusion_in_content_space, | 486 current_frame_time_in_seconds, occlusion_in_content_space, |
| 488 can_require_tiles_for_activation); | 487 can_require_tiles_for_activation); |
| 489 return updated; | 488 return updated; |
| 490 } | 489 } |
| 491 | 490 |
| 492 void PictureLayerImpl::UpdateViewportRectForTilePriorityInContentSpace() { | 491 void PictureLayerImpl::UpdateViewportRectForTilePriorityInContentSpace() { |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 | 1211 |
| 1213 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1212 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1214 return !layer_tree_impl()->IsRecycleTree(); | 1213 return !layer_tree_impl()->IsRecycleTree(); |
| 1215 } | 1214 } |
| 1216 | 1215 |
| 1217 bool PictureLayerImpl::HasValidTilePriorities() const { | 1216 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1218 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1217 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1219 } | 1218 } |
| 1220 | 1219 |
| 1221 } // namespace cc | 1220 } // namespace cc |
| OLD | NEW |