Chromium Code Reviews| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 476 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 477 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( | 477 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( |
| 478 current_frame_time_in_seconds)) { | 478 current_frame_time_in_seconds)) { |
| 479 tiling_needs_update = true; | 479 tiling_needs_update = true; |
| 480 break; | 480 break; |
| 481 } | 481 } |
| 482 } | 482 } |
| 483 if (!tiling_needs_update) | 483 if (!tiling_needs_update) |
| 484 return; | 484 return; |
| 485 | 485 |
| 486 gfx::Rect visible_layer_rect = GetViewportForTilePriorityInContentSpace(); | 486 gfx::Rect visible_layer_rect = GetViewportForTilePriorityInContentSpace(); |
|
danakj
2014/09/18 16:48:22
can you rename this? it's not the visible layer re
vmpstr
2014/09/18 22:54:08
Done.
| |
| 487 WhichTree tree = | 487 WhichTree tree = |
| 488 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 488 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 489 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 489 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 490 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since | 490 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since |
| 491 // they are the same space in picture lbayer, as contents scale is always 1. | 491 // they are the same space in picture lbayer, as contents scale is always 1. |
| 492 tilings_->tiling_at(i)->UpdateTilePriorities(tree, | 492 tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
| 493 visible_layer_rect, | 493 visible_layer_rect, |
| 494 ideal_contents_scale_, | 494 ideal_contents_scale_, |
| 495 current_frame_time_in_seconds, | 495 current_frame_time_in_seconds, |
| 496 occlusion_in_content_space); | 496 occlusion_in_content_space); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 509 | 509 |
| 510 if (visible_rect_in_content_space.IsEmpty() || | 510 if (visible_rect_in_content_space.IsEmpty() || |
| 511 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_) { | 511 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_) { |
| 512 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); | 512 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); |
| 513 | 513 |
| 514 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { | 514 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { |
| 515 // Transform from view space to content space. | 515 // Transform from view space to content space. |
| 516 visible_rect_in_content_space = | 516 visible_rect_in_content_space = |
| 517 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 517 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
| 518 view_to_layer, viewport_rect_for_tile_priority_)); | 518 view_to_layer, viewport_rect_for_tile_priority_)); |
| 519 | |
| 520 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); | |
| 521 } | 519 } |
| 522 } | 520 } |
| 523 | |
| 524 visible_rect_in_content_space.Intersect(visible_content_rect()); | |
| 525 return visible_rect_in_content_space; | 521 return visible_rect_in_content_space; |
| 526 } | 522 } |
| 527 | 523 |
| 528 PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() { | 524 PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() { |
| 529 // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418 | 525 // TODO(vmpstr): Maintain recycled twin as a member. crbug.com/407418 |
| 530 return static_cast<PictureLayerImpl*>( | 526 return static_cast<PictureLayerImpl*>( |
| 531 layer_tree_impl()->FindRecycleTreeLayerById(id())); | 527 layer_tree_impl()->FindRecycleTreeLayerById(id())); |
| 532 } | 528 } |
| 533 | 529 |
| 534 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 530 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 | 779 |
| 784 // First, early out for layers with no visible content. | 780 // First, early out for layers with no visible content. |
| 785 if (visible_content_rect().IsEmpty()) | 781 if (visible_content_rect().IsEmpty()) |
| 786 return; | 782 return; |
| 787 | 783 |
| 788 // Only mark tiles inside the viewport for tile priority as required for | 784 // Only mark tiles inside the viewport for tile priority as required for |
| 789 // activation. This viewport is normally the same as the draw viewport but | 785 // activation. This viewport is normally the same as the draw viewport but |
| 790 // can be independently overridden by embedders like Android WebView with | 786 // can be independently overridden by embedders like Android WebView with |
| 791 // SetExternalDrawConstraints. | 787 // SetExternalDrawConstraints. |
| 792 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 788 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
| 789 rect.Intersect(visible_content_rect()); | |
| 793 | 790 |
| 794 float min_acceptable_scale = | 791 float min_acceptable_scale = |
| 795 std::min(raster_contents_scale_, ideal_contents_scale_); | 792 std::min(raster_contents_scale_, ideal_contents_scale_); |
| 796 | 793 |
| 797 if (PictureLayerImpl* twin = twin_layer_) { | 794 if (PictureLayerImpl* twin = twin_layer_) { |
| 798 float twin_min_acceptable_scale = | 795 float twin_min_acceptable_scale = |
| 799 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | 796 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); |
| 800 // Ignore 0 scale in case CalculateContentsScale() has never been | 797 // Ignore 0 scale in case CalculateContentsScale() has never been |
| 801 // called for active twin. | 798 // called for active twin. |
| 802 if (twin_min_acceptable_scale != 0.0f) { | 799 if (twin_min_acceptable_scale != 0.0f) { |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1758 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1755 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1759 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1756 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1760 return tiling_range.end - 1 - current_tiling_range_offset; | 1757 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1761 } | 1758 } |
| 1762 } | 1759 } |
| 1763 NOTREACHED(); | 1760 NOTREACHED(); |
| 1764 return 0; | 1761 return 0; |
| 1765 } | 1762 } |
| 1766 | 1763 |
| 1767 } // namespace cc | 1764 } // namespace cc |
| OLD | NEW |