| 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 <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 current_frame_time_in_seconds)) { | 479 current_frame_time_in_seconds)) { |
| 480 tiling_needs_update = true; | 480 tiling_needs_update = true; |
| 481 break; | 481 break; |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 if (!tiling_needs_update) | 484 if (!tiling_needs_update) |
| 485 return; | 485 return; |
| 486 | 486 |
| 487 gfx::Rect visible_rect_in_content_space( | 487 gfx::Rect visible_rect_in_content_space( |
| 488 GetViewportForTilePriorityInContentSpace()); | 488 GetViewportForTilePriorityInContentSpace()); |
| 489 visible_rect_in_content_space.Intersect(visible_content_rect()); | |
| 490 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 489 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
| 491 visible_rect_in_content_space, 1.f / contents_scale_x()); | 490 visible_rect_in_content_space, 1.f / contents_scale_x()); |
| 492 WhichTree tree = | 491 WhichTree tree = |
| 493 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 492 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 494 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 493 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 495 tilings_->tiling_at(i)->UpdateTilePriorities(tree, | 494 tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
| 496 visible_layer_rect, | 495 visible_layer_rect, |
| 497 ideal_contents_scale_, | 496 ideal_contents_scale_, |
| 498 current_frame_time_in_seconds, | 497 current_frame_time_in_seconds, |
| 499 occlusion_in_content_space); | 498 occlusion_in_content_space); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 517 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { | 516 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { |
| 518 // Transform from view space to content space. | 517 // Transform from view space to content space. |
| 519 visible_rect_in_content_space = | 518 visible_rect_in_content_space = |
| 520 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 519 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
| 521 view_to_layer, viewport_rect_for_tile_priority_)); | 520 view_to_layer, viewport_rect_for_tile_priority_)); |
| 522 | 521 |
| 523 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); | 522 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); |
| 524 } | 523 } |
| 525 } | 524 } |
| 526 | 525 |
| 526 visible_rect_in_content_space.Intersect(visible_content_rect()); |
| 527 return visible_rect_in_content_space; | 527 return visible_rect_in_content_space; |
| 528 } | 528 } |
| 529 | 529 |
| 530 PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() { | 530 PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() { |
| 531 // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418 | 531 // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418 |
| 532 return static_cast<PictureLayerImpl*>( | 532 return static_cast<PictureLayerImpl*>( |
| 533 layer_tree_impl()->FindRecycleTreeLayerById(id())); | 533 layer_tree_impl()->FindRecycleTreeLayerById(id())); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 536 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 DCHECK_GT(tilings_->num_tilings(), 0u); | 782 DCHECK_GT(tilings_->num_tilings(), 0u); |
| 783 | 783 |
| 784 // The goal of this function is to find the minimum set of tiles that need to | 784 // The goal of this function is to find the minimum set of tiles that need to |
| 785 // be ready to draw in order to activate without flashing content from a | 785 // be ready to draw in order to activate without flashing content from a |
| 786 // higher res on the active tree to a lower res on the pending tree. | 786 // higher res on the active tree to a lower res on the pending tree. |
| 787 | 787 |
| 788 // First, early out for layers with no visible content. | 788 // First, early out for layers with no visible content. |
| 789 if (visible_content_rect().IsEmpty()) | 789 if (visible_content_rect().IsEmpty()) |
| 790 return; | 790 return; |
| 791 | 791 |
| 792 gfx::Rect rect(visible_content_rect()); | |
| 793 | |
| 794 // Only mark tiles inside the viewport for tile priority as required for | 792 // Only mark tiles inside the viewport for tile priority as required for |
| 795 // activation. This viewport is normally the same as the draw viewport but | 793 // activation. This viewport is normally the same as the draw viewport but |
| 796 // can be independently overridden by embedders like Android WebView with | 794 // can be independently overridden by embedders like Android WebView with |
| 797 // SetExternalDrawConstraints. | 795 // SetExternalDrawConstraints. |
| 798 rect.Intersect(GetViewportForTilePriorityInContentSpace()); | 796 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
| 799 | 797 |
| 800 float min_acceptable_scale = | 798 float min_acceptable_scale = |
| 801 std::min(raster_contents_scale_, ideal_contents_scale_); | 799 std::min(raster_contents_scale_, ideal_contents_scale_); |
| 802 | 800 |
| 803 if (PictureLayerImpl* twin = twin_layer_) { | 801 if (PictureLayerImpl* twin = twin_layer_) { |
| 804 float twin_min_acceptable_scale = | 802 float twin_min_acceptable_scale = |
| 805 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | 803 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); |
| 806 // Ignore 0 scale in case CalculateContentsScale() has never been | 804 // Ignore 0 scale in case CalculateContentsScale() has never been |
| 807 // called for active twin. | 805 // called for active twin. |
| 808 if (twin_min_acceptable_scale != 0.0f) { | 806 if (twin_min_acceptable_scale != 0.0f) { |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1764 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1767 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1765 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1768 return tiling_range.end - 1 - current_tiling_range_offset; | 1766 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1769 } | 1767 } |
| 1770 } | 1768 } |
| 1771 NOTREACHED(); | 1769 NOTREACHED(); |
| 1772 return 0; | 1770 return 0; |
| 1773 } | 1771 } |
| 1774 | 1772 |
| 1775 } // namespace cc | 1773 } // namespace cc |
| OLD | NEW |