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

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

Issue 775483002: cc: Remove max tiles and skewport constants from tiling client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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/resources/picture_layer_tiling.h » ('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 <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 PictureLayerImpl::Pair::~Pair() { 63 PictureLayerImpl::Pair::~Pair() {
64 } 64 }
65 65
66 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, 66 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl,
67 int id, 67 int id,
68 bool is_mask) 68 bool is_mask)
69 : LayerImpl(tree_impl, id), 69 : LayerImpl(tree_impl, id),
70 twin_layer_(nullptr), 70 twin_layer_(nullptr),
71 tilings_(PictureLayerTilingSet::Create(this)), 71 tilings_(CreatePictureLayerTilingSet()),
72 // TODO(danakj): Can this be null to start? 72 // TODO(danakj): Can this be null to start?
73 raster_source_(PicturePileImpl::Create()), 73 raster_source_(PicturePileImpl::Create()),
74 ideal_page_scale_(0.f), 74 ideal_page_scale_(0.f),
75 ideal_device_scale_(0.f), 75 ideal_device_scale_(0.f),
76 ideal_source_scale_(0.f), 76 ideal_source_scale_(0.f),
77 ideal_contents_scale_(0.f), 77 ideal_contents_scale_(0.f),
78 raster_page_scale_(0.f), 78 raster_page_scale_(0.f),
79 raster_device_scale_(0.f), 79 raster_device_scale_(0.f),
80 raster_source_scale_(0.f), 80 raster_source_scale_(0.f),
81 raster_contents_scale_(0.f), 81 raster_contents_scale_(0.f),
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 LayerImpl::DidBecomeActive(); 617 LayerImpl::DidBecomeActive();
618 // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI 618 // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI
619 layer_tree_impl()->DidModifyTilePriorities(); 619 layer_tree_impl()->DidModifyTilePriorities();
620 } 620 }
621 621
622 void PictureLayerImpl::DidBeginTracing() { 622 void PictureLayerImpl::DidBeginTracing() {
623 raster_source_->DidBeginTracing(); 623 raster_source_->DidBeginTracing();
624 } 624 }
625 625
626 void PictureLayerImpl::ReleaseResources() { 626 void PictureLayerImpl::ReleaseResources() {
627 // Recreate tilings with new settings, since some of those might change when
628 // we release resources. If tilings_ is null, then leave it as null.
627 if (tilings_) 629 if (tilings_)
628 RemoveAllTilings(); 630 tilings_ = CreatePictureLayerTilingSet();
629
630 ResetRasterScale(); 631 ResetRasterScale();
631 632
632 // To avoid an edge case after lost context where the tree is up to date but 633 // To avoid an edge case after lost context where the tree is up to date but
633 // the tilings have not been managed, request an update draw properties 634 // the tilings have not been managed, request an update draw properties
634 // to force tilings to get managed. 635 // to force tilings to get managed.
635 layer_tree_impl()->set_needs_update_draw_properties(); 636 layer_tree_impl()->set_needs_update_draw_properties();
636 } 637 }
637 638
638 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { 639 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() {
639 return raster_source_->GetFlattenedPicture(); 640 return raster_source_->GetFlattenedPicture();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return nullptr; 683 return nullptr;
683 return recycled_twin->tilings_->FindTilingWithScale(tiling->contents_scale()); 684 return recycled_twin->tilings_->FindTilingWithScale(tiling->contents_scale());
684 } 685 }
685 686
686 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { 687 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const {
687 if (!HasValidTilePriorities()) 688 if (!HasValidTilePriorities())
688 return TilePriority::EVENTUALLY; 689 return TilePriority::EVENTUALLY;
689 return TilePriority::NOW; 690 return TilePriority::NOW;
690 } 691 }
691 692
692 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const {
693 return layer_tree_impl()->settings().max_tiles_for_interest_area;
694 }
695
696 float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const {
697 return layer_tree_impl()->use_gpu_rasterization()
698 ? 0.f
699 : layer_tree_impl()->settings().skewport_target_time_in_seconds;
700 }
701
702 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const {
703 return layer_tree_impl()
704 ->settings()
705 .skewport_extrapolation_limit_in_content_pixels;
706 }
707
708 bool PictureLayerImpl::RequiresHighResToDraw() const { 693 bool PictureLayerImpl::RequiresHighResToDraw() const {
709 return layer_tree_impl()->RequiresHighResToDraw(); 694 return layer_tree_impl()->RequiresHighResToDraw();
710 } 695 }
711 696
712 gfx::Size PictureLayerImpl::CalculateTileSize( 697 gfx::Size PictureLayerImpl::CalculateTileSize(
713 const gfx::Size& content_bounds) const { 698 const gfx::Size& content_bounds) const {
714 int max_texture_size = 699 int max_texture_size =
715 layer_tree_impl()->resource_provider()->max_texture_size(); 700 layer_tree_impl()->resource_provider()->max_texture_size();
716 701
717 if (is_mask_) { 702 if (is_mask_) {
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1132
1148 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { 1133 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const {
1149 return layer_tree_impl()->use_gpu_rasterization(); 1134 return layer_tree_impl()->use_gpu_rasterization();
1150 } 1135 }
1151 1136
1152 float PictureLayerImpl::MaximumTilingContentsScale() const { 1137 float PictureLayerImpl::MaximumTilingContentsScale() const {
1153 float max_contents_scale = tilings_->GetMaximumContentsScale(); 1138 float max_contents_scale = tilings_->GetMaximumContentsScale();
1154 return std::max(max_contents_scale, MinimumContentsScale()); 1139 return std::max(max_contents_scale, MinimumContentsScale());
1155 } 1140 }
1156 1141
1142 scoped_ptr<PictureLayerTilingSet>
1143 PictureLayerImpl::CreatePictureLayerTilingSet() {
1144 const LayerTreeSettings& settings = layer_tree_impl()->settings();
1145 return PictureLayerTilingSet::Create(
1146 this, settings.max_tiles_for_interest_area,
1147 layer_tree_impl()->use_gpu_rasterization()
1148 ? 0.f
1149 : settings.skewport_target_time_in_seconds,
1150 settings.skewport_extrapolation_limit_in_content_pixels);
1151 }
1152
1157 void PictureLayerImpl::UpdateIdealScales() { 1153 void PictureLayerImpl::UpdateIdealScales() {
1158 DCHECK(CanHaveTilings()); 1154 DCHECK(CanHaveTilings());
1159 1155
1160 float min_contents_scale = MinimumContentsScale(); 1156 float min_contents_scale = MinimumContentsScale();
1161 DCHECK_GT(min_contents_scale, 0.f); 1157 DCHECK_GT(min_contents_scale, 0.f);
1162 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); 1158 float min_page_scale = layer_tree_impl()->min_page_scale_factor();
1163 DCHECK_GT(min_page_scale, 0.f); 1159 DCHECK_GT(min_page_scale, 0.f);
1164 float min_device_scale = 1.f; 1160 float min_device_scale = 1.f;
1165 float min_source_scale = 1161 float min_source_scale =
1166 min_contents_scale / min_page_scale / min_device_scale; 1162 min_contents_scale / min_page_scale / min_device_scale;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 1309
1314 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1310 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1315 if (!layer_tree_impl()->IsActiveTree()) 1311 if (!layer_tree_impl()->IsActiveTree())
1316 return true; 1312 return true;
1317 1313
1318 return AllTilesRequiredAreReadyToDraw( 1314 return AllTilesRequiredAreReadyToDraw(
1319 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1315 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1320 } 1316 }
1321 1317
1322 } // namespace cc 1318 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698