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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 } | 442 } | 
| 443 | 443 | 
| 444 void PictureLayerImpl::UpdateTiles( | 444 void PictureLayerImpl::UpdateTiles( | 
| 445 const Occlusion& occlusion_in_content_space) { | 445 const Occlusion& occlusion_in_content_space) { | 
| 446 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles"); | 446 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles"); | 
| 447 DCHECK_EQ(1.f, contents_scale_x()); | 447 DCHECK_EQ(1.f, contents_scale_x()); | 
| 448 DCHECK_EQ(1.f, contents_scale_y()); | 448 DCHECK_EQ(1.f, contents_scale_y()); | 
| 449 | 449 | 
| 450 DoPostCommitInitializationIfNeeded(); | 450 DoPostCommitInitializationIfNeeded(); | 
| 451 | 451 | 
| 452 visible_rect_for_tile_priority_ = visible_content_rect(); | 452 if (!layer_tree_impl()->resourceless_software_draw()) { | 
| 
 
danakj
2014/09/30 21:06:37
can we pass this to UpdateTiles instead of making
 
boliu
2014/09/30 23:52:02
This is *not* done yet in PS3. Looks like going to
 
 | |
| 453 visible_rect_for_tile_priority_ = visible_content_rect(); | |
| 454 } | |
| 453 viewport_rect_for_tile_priority_ = | 455 viewport_rect_for_tile_priority_ = | 
| 
 
danakj
2014/09/30 20:38:37
the assign before this is completely overridden he
 
danakj
2014/09/30 20:39:03
oh visible/viewport, reading how does it work?
 
 | |
| 454 layer_tree_impl()->ViewportRectForTilePriority(); | 456 layer_tree_impl()->ViewportRectForTilePriority(); | 
| 455 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 457 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 
| 456 | 458 | 
| 457 if (!CanHaveTilings()) { | 459 if (!CanHaveTilings()) { | 
| 458 ideal_page_scale_ = 0.f; | 460 ideal_page_scale_ = 0.f; | 
| 459 ideal_device_scale_ = 0.f; | 461 ideal_device_scale_ = 0.f; | 
| 460 ideal_contents_scale_ = 0.f; | 462 ideal_contents_scale_ = 0.f; | 
| 461 ideal_source_scale_ = 0.f; | 463 ideal_source_scale_ = 0.f; | 
| 462 SanityCheckTilingState(); | 464 SanityCheckTilingState(); | 
| 463 return; | 465 return; | 
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 799 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | 801 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | 
| 800 DCHECK(layer_tree_impl()->IsPendingTree()); | 802 DCHECK(layer_tree_impl()->IsPendingTree()); | 
| 801 DCHECK(ideal_contents_scale_); | 803 DCHECK(ideal_contents_scale_); | 
| 802 DCHECK_GT(tilings_->num_tilings(), 0u); | 804 DCHECK_GT(tilings_->num_tilings(), 0u); | 
| 803 | 805 | 
| 804 // The goal of this function is to find the minimum set of tiles that need to | 806 // The goal of this function is to find the minimum set of tiles that need to | 
| 805 // be ready to draw in order to activate without flashing content from a | 807 // be ready to draw in order to activate without flashing content from a | 
| 806 // higher res on the active tree to a lower res on the pending tree. | 808 // higher res on the active tree to a lower res on the pending tree. | 
| 807 | 809 | 
| 808 // First, early out for layers with no visible content. | 810 // First, early out for layers with no visible content. | 
| 809 if (visible_content_rect().IsEmpty()) | 811 if (visible_rect_for_tile_priority_.IsEmpty()) | 
| 810 return; | 812 return; | 
| 811 | 813 | 
| 812 // Only mark tiles inside the viewport for tile priority as required for | 814 // Only mark tiles inside the viewport for tile priority as required for | 
| 813 // activation. This viewport is normally the same as the draw viewport but | 815 // activation. This viewport is normally the same as the draw viewport but | 
| 814 // can be independently overridden by embedders like Android WebView with | 816 // can be independently overridden by embedders like Android WebView with | 
| 815 // SetExternalDrawConstraints. | 817 // SetExternalDrawConstraints. | 
| 816 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 818 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 
| 817 rect.Intersect(visible_content_rect()); | 819 rect.Intersect(visible_rect_for_tile_priority_); | 
| 818 | 820 | 
| 819 float min_acceptable_scale = | 821 float min_acceptable_scale = | 
| 820 std::min(raster_contents_scale_, ideal_contents_scale_); | 822 std::min(raster_contents_scale_, ideal_contents_scale_); | 
| 821 | 823 | 
| 822 if (PictureLayerImpl* twin = twin_layer_) { | 824 if (PictureLayerImpl* twin = twin_layer_) { | 
| 823 float twin_min_acceptable_scale = | 825 float twin_min_acceptable_scale = | 
| 824 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | 826 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | 
| 825 // Ignore 0 scale in case CalculateContentsScale() has never been | 827 // Ignore 0 scale in case CalculateContentsScale() has never been | 
| 826 // called for active twin. | 828 // called for active twin. | 
| 827 if (twin_min_acceptable_scale != 0.0f) { | 829 if (twin_min_acceptable_scale != 0.0f) { | 
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1487 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 
| 1486 if (!layer_tree_impl()->IsPendingTree()) | 1488 if (!layer_tree_impl()->IsPendingTree()) | 
| 1487 return true; | 1489 return true; | 
| 1488 | 1490 | 
| 1489 if (!HasValidTilePriorities()) | 1491 if (!HasValidTilePriorities()) | 
| 1490 return true; | 1492 return true; | 
| 1491 | 1493 | 
| 1492 if (!tilings_) | 1494 if (!tilings_) | 
| 1493 return true; | 1495 return true; | 
| 1494 | 1496 | 
| 1495 if (visible_content_rect().IsEmpty()) | 1497 if (visible_rect_for_tile_priority_.IsEmpty()) | 
| 1496 return true; | 1498 return true; | 
| 1497 | 1499 | 
| 1498 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1500 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 
| 1499 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1501 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 
| 1500 if (tiling->resolution() != HIGH_RESOLUTION && | 1502 if (tiling->resolution() != HIGH_RESOLUTION && | 
| 1501 tiling->resolution() != LOW_RESOLUTION) | 1503 tiling->resolution() != LOW_RESOLUTION) | 
| 1502 continue; | 1504 continue; | 
| 1503 | 1505 | 
| 1504 gfx::Rect rect(visible_content_rect()); | 1506 gfx::Rect rect(visible_rect_for_tile_priority_); | 
| 
 
danakj
2014/09/30 21:05:53
Why isn't this using GetViewportForTilePriorityInC
 
boliu
2014/09/30 22:37:48
omg this is an existing bug! It should be GetViewp
 
 | |
| 1505 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | 1507 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | 
| 1506 ++iter) { | 1508 ++iter) { | 
| 1507 const Tile* tile = *iter; | 1509 const Tile* tile = *iter; | 
| 1508 // A null tile (i.e. missing recording) can just be skipped. | 1510 // A null tile (i.e. missing recording) can just be skipped. | 
| 1509 if (!tile) | 1511 if (!tile) | 
| 1510 continue; | 1512 continue; | 
| 1511 | 1513 | 
| 1512 if (tile->required_for_activation() && !tile->IsReadyToDraw()) | 1514 if (tile->required_for_activation() && !tile->IsReadyToDraw()) | 
| 1513 return false; | 1515 return false; | 
| 1514 } | 1516 } | 
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1785 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1787 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 
| 1786 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1788 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 
| 1787 return tiling_range.end - 1 - current_tiling_range_offset; | 1789 return tiling_range.end - 1 - current_tiling_range_offset; | 
| 1788 } | 1790 } | 
| 1789 } | 1791 } | 
| 1790 NOTREACHED(); | 1792 NOTREACHED(); | 
| 1791 return 0; | 1793 return 0; | 
| 1792 } | 1794 } | 
| 1793 | 1795 | 
| 1794 } // namespace cc | 1796 } // namespace cc | 
| OLD | NEW |