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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 } | 444 } |
| 445 | 445 |
| 446 void PictureLayerImpl::UpdateTiles( | 446 void PictureLayerImpl::UpdateTiles( |
| 447 const Occlusion& occlusion_in_content_space) { | 447 const Occlusion& occlusion_in_content_space) { |
| 448 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles"); | 448 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles"); |
| 449 DCHECK_EQ(1.f, contents_scale_x()); | 449 DCHECK_EQ(1.f, contents_scale_x()); |
| 450 DCHECK_EQ(1.f, contents_scale_y()); | 450 DCHECK_EQ(1.f, contents_scale_y()); |
| 451 | 451 |
| 452 DoPostCommitInitializationIfNeeded(); | 452 DoPostCommitInitializationIfNeeded(); |
| 453 | 453 |
| 454 visible_rect_for_tile_priority_ = visible_content_rect(); | 454 visible_rect_for_tile_priority_ = visible_content_rect(); |
|
boliu
2014/09/30 03:10:54
Realized still needs to check for resourceless_sof
| |
| 455 viewport_rect_for_tile_priority_ = | 455 viewport_rect_for_tile_priority_ = |
| 456 layer_tree_impl()->ViewportRectForTilePriority(); | 456 layer_tree_impl()->ViewportRectForTilePriority(); |
| 457 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 457 screen_space_transform_for_tile_priority_ = screen_space_transform(); |
| 458 | 458 |
| 459 if (!CanHaveTilings()) { | 459 if (!CanHaveTilings()) { |
| 460 ideal_page_scale_ = 0.f; | 460 ideal_page_scale_ = 0.f; |
| 461 ideal_device_scale_ = 0.f; | 461 ideal_device_scale_ = 0.f; |
| 462 ideal_contents_scale_ = 0.f; | 462 ideal_contents_scale_ = 0.f; |
| 463 ideal_source_scale_ = 0.f; | 463 ideal_source_scale_ = 0.f; |
| 464 SanityCheckTilingState(); | 464 SanityCheckTilingState(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 802 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | 802 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { |
| 803 DCHECK(layer_tree_impl()->IsPendingTree()); | 803 DCHECK(layer_tree_impl()->IsPendingTree()); |
| 804 DCHECK(ideal_contents_scale_); | 804 DCHECK(ideal_contents_scale_); |
| 805 DCHECK_GT(tilings_->num_tilings(), 0u); | 805 DCHECK_GT(tilings_->num_tilings(), 0u); |
| 806 | 806 |
| 807 // The goal of this function is to find the minimum set of tiles that need to | 807 // The goal of this function is to find the minimum set of tiles that need to |
| 808 // be ready to draw in order to activate without flashing content from a | 808 // be ready to draw in order to activate without flashing content from a |
| 809 // higher res on the active tree to a lower res on the pending tree. | 809 // higher res on the active tree to a lower res on the pending tree. |
| 810 | 810 |
| 811 // First, early out for layers with no visible content. | 811 // First, early out for layers with no visible content. |
| 812 if (visible_content_rect().IsEmpty()) | 812 if (visible_rect_for_tile_priority_.IsEmpty()) |
| 813 return; | 813 return; |
| 814 | 814 |
| 815 // Only mark tiles inside the viewport for tile priority as required for | 815 // Only mark tiles inside the viewport for tile priority as required for |
| 816 // activation. This viewport is normally the same as the draw viewport but | 816 // activation. This viewport is normally the same as the draw viewport but |
| 817 // can be independently overridden by embedders like Android WebView with | 817 // can be independently overridden by embedders like Android WebView with |
| 818 // SetExternalDrawConstraints. | 818 // SetExternalDrawConstraints. |
| 819 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 819 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
| 820 rect.Intersect(visible_content_rect()); | 820 rect.Intersect(visible_rect_for_tile_priority_); |
| 821 | 821 |
| 822 float min_acceptable_scale = | 822 float min_acceptable_scale = |
| 823 std::min(raster_contents_scale_, ideal_contents_scale_); | 823 std::min(raster_contents_scale_, ideal_contents_scale_); |
| 824 | 824 |
| 825 if (PictureLayerImpl* twin = twin_layer_) { | 825 if (PictureLayerImpl* twin = twin_layer_) { |
| 826 float twin_min_acceptable_scale = | 826 float twin_min_acceptable_scale = |
| 827 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | 827 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); |
| 828 // Ignore 0 scale in case CalculateContentsScale() has never been | 828 // Ignore 0 scale in case CalculateContentsScale() has never been |
| 829 // called for active twin. | 829 // called for active twin. |
| 830 if (twin_min_acceptable_scale != 0.0f) { | 830 if (twin_min_acceptable_scale != 0.0f) { |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1488 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1488 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { |
| 1489 if (!layer_tree_impl()->IsPendingTree()) | 1489 if (!layer_tree_impl()->IsPendingTree()) |
| 1490 return true; | 1490 return true; |
| 1491 | 1491 |
| 1492 if (!HasValidTilePriorities()) | 1492 if (!HasValidTilePriorities()) |
| 1493 return true; | 1493 return true; |
| 1494 | 1494 |
| 1495 if (!tilings_) | 1495 if (!tilings_) |
| 1496 return true; | 1496 return true; |
| 1497 | 1497 |
| 1498 if (visible_content_rect().IsEmpty()) | 1498 if (visible_rect_for_tile_priority_.IsEmpty()) |
| 1499 return true; | 1499 return true; |
| 1500 | 1500 |
| 1501 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1501 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 1502 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1502 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 1503 if (tiling->resolution() != HIGH_RESOLUTION && | 1503 if (tiling->resolution() != HIGH_RESOLUTION && |
| 1504 tiling->resolution() != LOW_RESOLUTION) | 1504 tiling->resolution() != LOW_RESOLUTION) |
| 1505 continue; | 1505 continue; |
| 1506 | 1506 |
| 1507 gfx::Rect rect(visible_content_rect()); | 1507 gfx::Rect rect(visible_rect_for_tile_priority_); |
| 1508 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | 1508 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; |
| 1509 ++iter) { | 1509 ++iter) { |
| 1510 const Tile* tile = *iter; | 1510 const Tile* tile = *iter; |
| 1511 // A null tile (i.e. missing recording) can just be skipped. | 1511 // A null tile (i.e. missing recording) can just be skipped. |
| 1512 if (!tile) | 1512 if (!tile) |
| 1513 continue; | 1513 continue; |
| 1514 | 1514 |
| 1515 if (tile->required_for_activation() && !tile->IsReadyToDraw()) | 1515 if (tile->required_for_activation() && !tile->IsReadyToDraw()) |
| 1516 return false; | 1516 return false; |
| 1517 } | 1517 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1788 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1788 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1789 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1789 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1790 return tiling_range.end - 1 - current_tiling_range_offset; | 1790 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1791 } | 1791 } |
| 1792 } | 1792 } |
| 1793 NOTREACHED(); | 1793 NOTREACHED(); |
| 1794 return 0; | 1794 return 0; |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 } // namespace cc | 1797 } // namespace cc |
| OLD | NEW |