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

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

Issue 874613003: cc: Stop pushing properties every activation for picture layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pli-pushprops: fixscrolling Created 5 years, 10 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
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 DCHECK_IMPLIES(raster_source_->IsSolidColor(), 136 DCHECK_IMPLIES(raster_source_->IsSolidColor(),
137 layer_impl->tilings_->num_tilings() == 0); 137 layer_impl->tilings_->num_tilings() == 0);
138 138
139 layer_impl->raster_page_scale_ = raster_page_scale_; 139 layer_impl->raster_page_scale_ = raster_page_scale_;
140 layer_impl->raster_device_scale_ = raster_device_scale_; 140 layer_impl->raster_device_scale_ = raster_device_scale_;
141 layer_impl->raster_source_scale_ = raster_source_scale_; 141 layer_impl->raster_source_scale_ = raster_source_scale_;
142 layer_impl->raster_contents_scale_ = raster_contents_scale_; 142 layer_impl->raster_contents_scale_ = raster_contents_scale_;
143 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; 143 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_;
144 144
145 layer_impl->SanityCheckTilingState(); 145 layer_impl->SanityCheckTilingState();
146
147 // We always need to push properties.
148 // See http://crbug.com/303943
149 // TODO(danakj): Stop always pushing properties since we don't swap tilings.
150 needs_push_properties_ = true;
151 } 146 }
152 147
153 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, 148 void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
154 const Occlusion& occlusion_in_content_space, 149 const Occlusion& occlusion_in_content_space,
155 AppendQuadsData* append_quads_data) { 150 AppendQuadsData* append_quads_data) {
156 // The bounds and the pile size may differ if the pile wasn't updated (ie. 151 // The bounds and the pile size may differ if the pile wasn't updated (ie.
157 // PictureLayer::Update didn't happen). In that case the pile will be empty. 152 // PictureLayer::Update didn't happen). In that case the pile will be empty.
158 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(), 153 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(),
159 bounds() == raster_source_->GetSize()) 154 bounds() == raster_source_->GetSize())
160 << " bounds " << bounds().ToString() << " pile " 155 << " bounds " << bounds().ToString() << " pile "
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // access the invalidation through the PictureLayerTilingClient interface. 550 // access the invalidation through the PictureLayerTilingClient interface.
556 invalidation_.Clear(); 551 invalidation_.Clear();
557 invalidation_.Swap(new_invalidation); 552 invalidation_.Swap(new_invalidation);
558 553
559 bool can_have_tilings = CanHaveTilings(); 554 bool can_have_tilings = CanHaveTilings();
560 555
561 // Need to call UpdateTiles again if CanHaveTilings changed. 556 // Need to call UpdateTiles again if CanHaveTilings changed.
562 if (could_have_tilings != can_have_tilings) 557 if (could_have_tilings != can_have_tilings)
563 layer_tree_impl()->set_needs_update_draw_properties(); 558 layer_tree_impl()->set_needs_update_draw_properties();
564 559
560 // SetNeedsPushProperties when changing the raster source. This shouldn't
561 // imply damage but need to be synced.
562 SetNeedsPushProperties();
563
565 if (!can_have_tilings) { 564 if (!can_have_tilings) {
566 RemoveAllTilings(); 565 RemoveAllTilings();
567 return; 566 return;
568 } 567 }
569 568
570 // We could do this after doing UpdateTiles, which would avoid doing this for 569 // We could do this after doing UpdateTiles, which would avoid doing this for
571 // tilings that are going to disappear on the pending tree (if scale changed). 570 // tilings that are going to disappear on the pending tree (if scale changed).
572 // But that would also be more complicated, so we just do it here for now. 571 // But that would also be more complicated, so we just do it here for now.
573 tilings_->UpdateTilingsToCurrentRasterSource( 572 tilings_->UpdateTilingsToCurrentRasterSource(
574 raster_source_, pending_set, invalidation_, MinimumContentsScale(), 573 raster_source_, pending_set, invalidation_, MinimumContentsScale(),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { 648 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const {
650 if (!HasValidTilePriorities()) 649 if (!HasValidTilePriorities())
651 return TilePriority::EVENTUALLY; 650 return TilePriority::EVENTUALLY;
652 return TilePriority::NOW; 651 return TilePriority::NOW;
653 } 652 }
654 653
655 bool PictureLayerImpl::RequiresHighResToDraw() const { 654 bool PictureLayerImpl::RequiresHighResToDraw() const {
656 return layer_tree_impl()->RequiresHighResToDraw(); 655 return layer_tree_impl()->RequiresHighResToDraw();
657 } 656 }
658 657
658 void PictureLayerImpl::TilingLiveRectChanged() {
659 // SetNeedsPushProperties when the live rect changes, as there are new tiles
660 // on the tree. This shouldn't imply damage but need to be synced.
661 SetNeedsPushProperties();
662 }
663
659 gfx::Size PictureLayerImpl::CalculateTileSize( 664 gfx::Size PictureLayerImpl::CalculateTileSize(
660 const gfx::Size& content_bounds) const { 665 const gfx::Size& content_bounds) const {
661 int max_texture_size = 666 int max_texture_size =
662 layer_tree_impl()->resource_provider()->max_texture_size(); 667 layer_tree_impl()->resource_provider()->max_texture_size();
663 668
664 if (is_mask_) { 669 if (is_mask_) {
665 // Masks are not tiled, so if we can't cover the whole mask with one tile, 670 // Masks are not tiled, so if we can't cover the whole mask with one tile,
666 // we shouldn't have such a tiling at all. 671 // we shouldn't have such a tiling at all.
667 DCHECK_LE(content_bounds.width(), max_texture_size); 672 DCHECK_LE(content_bounds.width(), max_texture_size);
668 DCHECK_LE(content_bounds.height(), max_texture_size); 673 DCHECK_LE(content_bounds.height(), max_texture_size);
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1291
1287 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1292 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1288 if (!layer_tree_impl()->IsActiveTree()) 1293 if (!layer_tree_impl()->IsActiveTree())
1289 return true; 1294 return true;
1290 1295
1291 return AllTilesRequiredAreReadyToDraw( 1296 return AllTilesRequiredAreReadyToDraw(
1292 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1297 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1293 } 1298 }
1294 1299
1295 } // namespace cc 1300 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698