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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 // - This layer produced a high-res or non-ideal-res tile last frame. | 508 // - This layer produced a high-res or non-ideal-res tile last frame. |
509 // - We're in requires high res to draw mode. | 509 // - We're in requires high res to draw mode. |
510 // - We're not in smoothness takes priority mode. | 510 // - We're not in smoothness takes priority mode. |
511 // To put different, the tiling set can't require tiles for activation if | 511 // To put different, the tiling set can't require tiles for activation if |
512 // we're in smoothness mode and only used low-res or checkerboard to draw last | 512 // we're in smoothness mode and only used low-res or checkerboard to draw last |
513 // frame and we don't need high res to draw. | 513 // frame and we don't need high res to draw. |
514 // | 514 // |
515 // The reason for this is that we should be able to activate sooner and get a | 515 // The reason for this is that we should be able to activate sooner and get a |
516 // more up to date recording, so we don't run out of recording on the active | 516 // more up to date recording, so we don't run out of recording on the active |
517 // tree. | 517 // tree. |
518 bool can_require_tiles_for_activation = | 518 // A layer must be a drawing layer for it to require tiles for activation. |
519 !only_used_low_res_last_append_quads_ || RequiresHighResToDraw() || | 519 bool can_require_tiles_for_activation = false; |
520 !layer_tree_impl()->SmoothnessTakesPriority(); | 520 if (contributes_to_drawn_render_surface()) { |
| 521 can_require_tiles_for_activation = |
| 522 !only_used_low_res_last_append_quads_ || RequiresHighResToDraw() || |
| 523 !layer_tree_impl()->SmoothnessTakesPriority(); |
| 524 } |
521 | 525 |
522 static const Occlusion kEmptyOcclusion; | 526 static const Occlusion kEmptyOcclusion; |
523 const Occlusion& occlusion_in_content_space = | 527 const Occlusion& occlusion_in_content_space = |
524 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization | 528 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization |
525 ? draw_properties().occlusion_in_content_space | 529 ? draw_properties().occlusion_in_content_space |
526 : kEmptyOcclusion; | 530 : kEmptyOcclusion; |
527 | 531 |
528 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since | 532 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since |
529 // they are the same space in picture layer, as contents scale is always 1. | 533 // they are the same space in picture layer, as contents scale is always 1. |
530 bool updated = tilings_->UpdateTilePriorities( | 534 bool updated = tilings_->UpdateTilePriorities( |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 | 1455 |
1452 WhichTree PictureLayerImpl::GetTree() const { | 1456 WhichTree PictureLayerImpl::GetTree() const { |
1453 return layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 1457 return layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
1454 } | 1458 } |
1455 | 1459 |
1456 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1460 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1457 return !layer_tree_impl()->IsRecycleTree(); | 1461 return !layer_tree_impl()->IsRecycleTree(); |
1458 } | 1462 } |
1459 | 1463 |
1460 bool PictureLayerImpl::HasValidTilePriorities() const { | 1464 bool PictureLayerImpl::HasValidTilePriorities() const { |
1461 return IsOnActiveOrPendingTree() && (contributes_to_drawn_render_surface() || | 1465 return IsOnActiveOrPendingTree() && |
1462 raster_even_if_not_in_rsll()); | 1466 (contributes_to_drawn_render_surface() || raster_even_if_not_drawn()); |
1463 } | 1467 } |
1464 | 1468 |
1465 void PictureLayerImpl::InvalidateRegionForImages( | 1469 void PictureLayerImpl::InvalidateRegionForImages( |
1466 const PaintImageIdFlatSet& images_to_invalidate) { | 1470 const PaintImageIdFlatSet& images_to_invalidate) { |
1467 TRACE_EVENT_BEGIN0("cc", "PictureLayerImpl::InvalidateRegionForImages"); | 1471 TRACE_EVENT_BEGIN0("cc", "PictureLayerImpl::InvalidateRegionForImages"); |
1468 | 1472 |
1469 InvalidationRegion image_invalidation; | 1473 InvalidationRegion image_invalidation; |
1470 for (auto image_id : images_to_invalidate) | 1474 for (auto image_id : images_to_invalidate) |
1471 image_invalidation.Union(raster_source_->GetRectForImage(image_id)); | 1475 image_invalidation.Union(raster_source_->GetRectForImage(image_id)); |
1472 Region invalidation; | 1476 Region invalidation; |
1473 image_invalidation.Swap(&invalidation); | 1477 image_invalidation.Swap(&invalidation); |
1474 | 1478 |
1475 if (invalidation.IsEmpty()) { | 1479 if (invalidation.IsEmpty()) { |
1476 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", | 1480 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", |
1477 "Invalidation", invalidation.ToString()); | 1481 "Invalidation", invalidation.ToString()); |
1478 return; | 1482 return; |
1479 } | 1483 } |
1480 | 1484 |
1481 invalidation_.Union(invalidation); | 1485 invalidation_.Union(invalidation); |
1482 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); | 1486 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); |
1483 SetNeedsPushProperties(); | 1487 SetNeedsPushProperties(); |
1484 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", | 1488 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", |
1485 "Invalidation", invalidation.ToString()); | 1489 "Invalidation", invalidation.ToString()); |
1486 } | 1490 } |
1487 | 1491 |
1488 } // namespace cc | 1492 } // namespace cc |
OLD | NEW |