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

Side by Side Diff: cc/resources/picture_layer_tiling_set.cc

Issue 820703002: c:: Give the raster source to the PictureLayerTilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rastersource: . 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
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/resources/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), 47 skewport_target_time_in_seconds_(skewport_target_time_in_seconds),
48 skewport_extrapolation_limit_in_content_pixels_( 48 skewport_extrapolation_limit_in_content_pixels_(
49 skewport_extrapolation_limit_in_content_pixels), 49 skewport_extrapolation_limit_in_content_pixels),
50 client_(client) { 50 client_(client) {
51 } 51 }
52 52
53 PictureLayerTilingSet::~PictureLayerTilingSet() { 53 PictureLayerTilingSet::~PictureLayerTilingSet() {
54 } 54 }
55 55
56 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSource( 56 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSource(
57 RasterSource* raster_source, 57 scoped_refptr<RasterSource> raster_source,
58 const PictureLayerTilingSet* twin_set, 58 const PictureLayerTilingSet* twin_set,
59 const Region& layer_invalidation, 59 const Region& layer_invalidation,
60 float minimum_contents_scale, 60 float minimum_contents_scale,
61 float maximum_contents_scale) { 61 float maximum_contents_scale) {
62 RemoveTilingsBelowScale(minimum_contents_scale); 62 RemoveTilingsBelowScale(minimum_contents_scale);
63 RemoveTilingsAboveScale(maximum_contents_scale); 63 RemoveTilingsAboveScale(maximum_contents_scale);
64 64
65 gfx::Size layer_bounds = raster_source->GetSize();
66
67 // Copy over tilings that are shared with the |twin_set| tiling set (if it 65 // Copy over tilings that are shared with the |twin_set| tiling set (if it
68 // exists). 66 // exists).
69 if (twin_set) { 67 if (twin_set) {
70 for (PictureLayerTiling* twin_tiling : twin_set->tilings_) { 68 for (PictureLayerTiling* twin_tiling : twin_set->tilings_) {
71 float contents_scale = twin_tiling->contents_scale(); 69 float contents_scale = twin_tiling->contents_scale();
72 DCHECK_GE(contents_scale, minimum_contents_scale); 70 DCHECK_GE(contents_scale, minimum_contents_scale);
73 DCHECK_LE(contents_scale, maximum_contents_scale); 71 DCHECK_LE(contents_scale, maximum_contents_scale);
74 72
75 PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale); 73 PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale);
76 if (!this_tiling) { 74 if (!this_tiling) {
77 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create( 75 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create(
78 contents_scale, layer_bounds, client_, max_tiles_for_interest_area_, 76 contents_scale, raster_source, client_,
79 skewport_target_time_in_seconds_, 77 max_tiles_for_interest_area_, skewport_target_time_in_seconds_,
80 skewport_extrapolation_limit_in_content_pixels_); 78 skewport_extrapolation_limit_in_content_pixels_);
81 tilings_.push_back(new_tiling.Pass()); 79 tilings_.push_back(new_tiling.Pass());
82 this_tiling = tilings_.back(); 80 this_tiling = tilings_.back();
83 } 81 }
84 this_tiling->CloneTilesAndPropertiesFrom(*twin_tiling); 82 this_tiling->CloneTilesAndPropertiesFrom(*twin_tiling);
85 } 83 }
86 } 84 }
87 85
88 // For unshared tilings, invalidate tiles and update them to the new raster 86 // For unshared tilings, invalidate tiles and update them to the new raster
89 // source. 87 // source.
90 for (PictureLayerTiling* tiling : tilings_) { 88 for (PictureLayerTiling* tiling : tilings_) {
91 if (twin_set && twin_set->FindTilingWithScale(tiling->contents_scale())) 89 if (twin_set && twin_set->FindTilingWithScale(tiling->contents_scale()))
92 continue; 90 continue;
93 91
94 tiling->Resize(layer_bounds); 92 tiling->SetRasterSourceAndResize(raster_source);
95 tiling->Invalidate(layer_invalidation); 93 tiling->Invalidate(layer_invalidation);
96 tiling->SetRasterSource(raster_source); 94 tiling->SetRasterSourceOnTiles();
97 // This is needed for cases where the live tiles rect didn't change but 95 // This is needed for cases where the live tiles rect didn't change but
98 // recordings exist in the raster source that did not exist on the last 96 // recordings exist in the raster source that did not exist on the last
99 // raster source. 97 // raster source.
100 tiling->CreateMissingTilesInLiveTilesRect(); 98 tiling->CreateMissingTilesInLiveTilesRect();
101 99
102 // If |twin_set| is present, use the resolutions from there. Otherwise leave 100 // If |twin_set| is present, use the resolutions from there. Otherwise leave
103 // all resolutions as they are. 101 // all resolutions as they are.
104 if (twin_set) 102 if (twin_set)
105 tiling->set_resolution(NON_IDEAL_RESOLUTION); 103 tiling->set_resolution(NON_IDEAL_RESOLUTION);
106 } 104 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 tilings_.erase(to_remove, tilings_.end()); 190 tilings_.erase(to_remove, tilings_.end());
193 } 191 }
194 192
195 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() { 193 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() {
196 for (auto* tiling : tilings_) 194 for (auto* tiling : tilings_)
197 tiling->set_resolution(NON_IDEAL_RESOLUTION); 195 tiling->set_resolution(NON_IDEAL_RESOLUTION);
198 } 196 }
199 197
200 PictureLayerTiling* PictureLayerTilingSet::AddTiling( 198 PictureLayerTiling* PictureLayerTilingSet::AddTiling(
201 float contents_scale, 199 float contents_scale,
202 const gfx::Size& layer_bounds) { 200 scoped_refptr<RasterSource> raster_source) {
203 for (size_t i = 0; i < tilings_.size(); ++i) 201 for (size_t i = 0; i < tilings_.size(); ++i) {
204 DCHECK_NE(tilings_[i]->contents_scale(), contents_scale); 202 DCHECK_NE(tilings_[i]->contents_scale(), contents_scale);
203 DCHECK_EQ(tilings_[i]->raster_source(), raster_source.get());
204 }
205 205
206 tilings_.push_back(PictureLayerTiling::Create( 206 tilings_.push_back(PictureLayerTiling::Create(
207 contents_scale, layer_bounds, client_, max_tiles_for_interest_area_, 207 contents_scale, raster_source, client_, max_tiles_for_interest_area_,
208 skewport_target_time_in_seconds_, 208 skewport_target_time_in_seconds_,
209 skewport_extrapolation_limit_in_content_pixels_)); 209 skewport_extrapolation_limit_in_content_pixels_));
210 PictureLayerTiling* appended = tilings_.back(); 210 PictureLayerTiling* appended = tilings_.back();
211 211
212 tilings_.sort(LargestToSmallestScaleFunctor()); 212 tilings_.sort(LargestToSmallestScaleFunctor());
213 return appended; 213 return appended;
214 } 214 }
215 215
216 int PictureLayerTilingSet::NumHighResTilings() const { 216 int PictureLayerTilingSet::NumHighResTilings() const {
217 int num_high_res = 0; 217 int num_high_res = 0;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 case LOWER_THAN_LOW_RES: 542 case LOWER_THAN_LOW_RES:
543 range = TilingRange(low_res_range.end, tilings_.size()); 543 range = TilingRange(low_res_range.end, tilings_.size());
544 break; 544 break;
545 } 545 }
546 546
547 DCHECK_LE(range.start, range.end); 547 DCHECK_LE(range.start, range.end);
548 return range; 548 return range;
549 } 549 }
550 550
551 } // namespace cc 551 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set.h ('k') | cc/resources/picture_layer_tiling_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698