Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 616543004: cc: Use visible_rect_for_tile_priority_ where approriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UpdateTiles Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 on_demand_missing_tile_count); 434 on_demand_missing_tile_count);
435 } 435 }
436 436
437 // Aggressively remove any tilings that are not seen to save memory. Note 437 // Aggressively remove any tilings that are not seen to save memory. Note
438 // that this is at the expense of doing cause more frequent re-painting. A 438 // that this is at the expense of doing cause more frequent re-painting. A
439 // better scheme would be to maintain a tighter visible_content_rect for the 439 // better scheme would be to maintain a tighter visible_content_rect for the
440 // finer tilings. 440 // finer tilings.
441 CleanUpTilingsOnActiveLayer(seen_tilings); 441 CleanUpTilingsOnActiveLayer(seen_tilings);
442 } 442 }
443 443
444 void PictureLayerImpl::UpdateTiles( 444 void PictureLayerImpl::UpdateTiles(const Occlusion& occlusion_in_content_space,
445 const Occlusion& occlusion_in_content_space) { 445 bool draw_properties_valid) {
danakj 2014/10/01 02:05:14 nit: this name seems like a bit of a like, like th
danakj 2014/10/01 02:05:37 a bit of a lie* i mean
boliu 2014/10/01 02:14:58 Umm, external_draw_constraints_invalid? But only t
danakj 2014/10/01 02:23:42 From the POV of this function it seems like the vi
boliu 2014/10/01 02:28:47 I was referring to LTHI::SetExternalDrawConstraint
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 (draw_properties_valid) {
453 visible_rect_for_tile_priority_ = visible_content_rect();
454 }
453 viewport_rect_for_tile_priority_ = 455 viewport_rect_for_tile_priority_ =
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();
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
1500 gfx::Rect rect = GetViewportForTilePriorityInContentSpace();
1501 rect.Intersect(visible_rect_for_tile_priority_);
1502
1498 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 1503 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
1499 PictureLayerTiling* tiling = tilings_->tiling_at(i); 1504 PictureLayerTiling* tiling = tilings_->tiling_at(i);
1500 if (tiling->resolution() != HIGH_RESOLUTION && 1505 if (tiling->resolution() != HIGH_RESOLUTION &&
1501 tiling->resolution() != LOW_RESOLUTION) 1506 tiling->resolution() != LOW_RESOLUTION)
1502 continue; 1507 continue;
1503 1508
1504 gfx::Rect rect(visible_content_rect());
1505 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; 1509 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter;
1506 ++iter) { 1510 ++iter) {
1507 const Tile* tile = *iter; 1511 const Tile* tile = *iter;
1508 // A null tile (i.e. missing recording) can just be skipped. 1512 // A null tile (i.e. missing recording) can just be skipped.
1509 if (!tile) 1513 if (!tile)
1510 continue; 1514 continue;
1511 1515
1512 if (tile->required_for_activation() && !tile->IsReadyToDraw()) 1516 if (tile->required_for_activation() && !tile->IsReadyToDraw())
1513 return false; 1517 return false;
1514 } 1518 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1789 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1786 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1790 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1787 return tiling_range.end - 1 - current_tiling_range_offset; 1791 return tiling_range.end - 1 - current_tiling_range_offset;
1788 } 1792 }
1789 } 1793 }
1790 NOTREACHED(); 1794 NOTREACHED();
1791 return 0; 1795 return 0;
1792 } 1796 }
1793 1797
1794 } // namespace cc 1798 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698