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

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

Issue 2629233002: cc: Remove separate x/y raster scales. (Closed)
Patch Set: Created 3 years, 11 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/tiles/picture_layer_tiling_set.h ('k') | cc/tiles/picture_layer_tiling_set_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/tiles/picture_layer_tiling_set.h" 5 #include "cc/tiles/picture_layer_tiling_set.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "cc/playback/raster_source.h" 15 #include "cc/playback/raster_source.h"
16 #include "ui/gfx/geometry/rect_conversions.h" 16 #include "ui/gfx/geometry/rect_conversions.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 namespace { 20 namespace {
21 21
22 class LargestToSmallestScaleFunctor { 22 class LargestToSmallestScaleFunctor {
23 public: 23 public:
24 bool operator()(const std::unique_ptr<PictureLayerTiling>& left, 24 bool operator()(const std::unique_ptr<PictureLayerTiling>& left,
25 const std::unique_ptr<PictureLayerTiling>& right) { 25 const std::unique_ptr<PictureLayerTiling>& right) {
26 return left->contents_scale_key() > right->contents_scale_key(); 26 return left->contents_scale() > right->contents_scale();
27 } 27 }
28 }; 28 };
29 29
30 inline float LargerRatio(float float1, float float2) { 30 inline float LargerRatio(float float1, float float2) {
31 DCHECK_GT(float1, 0.f); 31 DCHECK_GT(float1, 0.f);
32 DCHECK_GT(float2, 0.f); 32 DCHECK_GT(float2, 0.f);
33 return float1 > float2 ? float1 / float2 : float2 / float1; 33 return float1 > float2 ? float1 / float2 : float2 / float1;
34 } 34 }
35 35
36 const float kSoonBorderDistanceViewportPercentage = 0.15f; 36 const float kSoonBorderDistanceViewportPercentage = 0.15f;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // If the twin (pending) tiling set is empty, it was not updated for the 77 // If the twin (pending) tiling set is empty, it was not updated for the
78 // current frame. So we drop tilings from our set as well, instead of 78 // current frame. So we drop tilings from our set as well, instead of
79 // leaving behind unshared tilings that are all non-ideal. 79 // leaving behind unshared tilings that are all non-ideal.
80 RemoveAllTilings(); 80 RemoveAllTilings();
81 return; 81 return;
82 } 82 }
83 83
84 bool tiling_sort_required = false; 84 bool tiling_sort_required = false;
85 for (const auto& pending_twin_tiling : pending_twin_set->tilings_) { 85 for (const auto& pending_twin_tiling : pending_twin_set->tilings_) {
86 PictureLayerTiling* this_tiling = 86 PictureLayerTiling* this_tiling =
87 FindTilingWithScaleKey(pending_twin_tiling->contents_scale_key()); 87 FindTilingWithScaleKey(pending_twin_tiling->contents_scale());
88 if (!this_tiling) { 88 if (!this_tiling) {
89 std::unique_ptr<PictureLayerTiling> new_tiling(new PictureLayerTiling( 89 std::unique_ptr<PictureLayerTiling> new_tiling(new PictureLayerTiling(
90 tree_, pending_twin_tiling->raster_scales(), raster_source_, client_, 90 tree_, pending_twin_tiling->contents_scale(), raster_source_, client_,
91 kMaxSoonBorderDistanceInScreenPixels, max_preraster_distance_)); 91 kMaxSoonBorderDistanceInScreenPixels, max_preraster_distance_));
92 tilings_.push_back(std::move(new_tiling)); 92 tilings_.push_back(std::move(new_tiling));
93 this_tiling = tilings_.back().get(); 93 this_tiling = tilings_.back().get();
94 tiling_sort_required = true; 94 tiling_sort_required = true;
95 state_since_last_tile_priority_update_.added_tilings = true; 95 state_since_last_tile_priority_update_.added_tilings = true;
96 } 96 }
97 this_tiling->TakeTilesAndPropertiesFrom(pending_twin_tiling.get(), 97 this_tiling->TakeTilesAndPropertiesFrom(pending_twin_tiling.get(),
98 layer_invalidation); 98 layer_invalidation);
99 } 99 }
100 100
101 if (tiling_sort_required) { 101 if (tiling_sort_required) {
102 std::sort(tilings_.begin(), tilings_.end(), 102 std::sort(tilings_.begin(), tilings_.end(),
103 LargestToSmallestScaleFunctor()); 103 LargestToSmallestScaleFunctor());
104 } 104 }
105 } 105 }
106 106
107 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation( 107 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation(
108 scoped_refptr<RasterSource> raster_source, 108 scoped_refptr<RasterSource> raster_source,
109 const PictureLayerTilingSet* pending_twin_set, 109 const PictureLayerTilingSet* pending_twin_set,
110 const Region& layer_invalidation, 110 const Region& layer_invalidation,
111 float minimum_contents_scale_key, 111 float minimum_contents_scale,
112 float maximum_contents_scale_key) { 112 float maximum_contents_scale) {
113 RemoveTilingsBelowScaleKey(minimum_contents_scale_key); 113 RemoveTilingsBelowScaleKey(minimum_contents_scale);
114 RemoveTilingsAboveScaleKey(maximum_contents_scale_key); 114 RemoveTilingsAboveScaleKey(maximum_contents_scale);
115 115
116 raster_source_ = raster_source; 116 raster_source_ = raster_source;
117 117
118 // Copy over tilings that are shared with the |pending_twin_set| tiling set. 118 // Copy over tilings that are shared with the |pending_twin_set| tiling set.
119 // Also, copy all of the properties from twin tilings. 119 // Also, copy all of the properties from twin tilings.
120 CopyTilingsAndPropertiesFromPendingTwin(pending_twin_set, raster_source, 120 CopyTilingsAndPropertiesFromPendingTwin(pending_twin_set, raster_source,
121 layer_invalidation); 121 layer_invalidation);
122 122
123 // If the tiling is not shared (FindTilingWithScale returns nullptr), then 123 // If the tiling is not shared (FindTilingWithScale returns nullptr), then
124 // invalidate tiles and update them to the new raster source. 124 // invalidate tiles and update them to the new raster source.
125 for (const auto& tiling : tilings_) { 125 for (const auto& tiling : tilings_) {
126 if (pending_twin_set->FindTilingWithScaleKey(tiling->contents_scale_key())) 126 if (pending_twin_set->FindTilingWithScaleKey(tiling->contents_scale()))
127 continue; 127 continue;
128 128
129 tiling->SetRasterSourceAndResize(raster_source); 129 tiling->SetRasterSourceAndResize(raster_source);
130 tiling->Invalidate(layer_invalidation); 130 tiling->Invalidate(layer_invalidation);
131 state_since_last_tile_priority_update_.invalidated = true; 131 state_since_last_tile_priority_update_.invalidated = true;
132 // This is needed for cases where the live tiles rect didn't change but 132 // This is needed for cases where the live tiles rect didn't change but
133 // recordings exist in the raster source that did not exist on the last 133 // recordings exist in the raster source that did not exist on the last
134 // raster source. 134 // raster source.
135 tiling->CreateMissingTilesInLiveTilesRect(); 135 tiling->CreateMissingTilesInLiveTilesRect();
136 136
137 // |this| is active set and |tiling| is not in the pending set, which means 137 // |this| is active set and |tiling| is not in the pending set, which means
138 // it is now NON_IDEAL_RESOLUTION. The exception is for LOW_RESOLUTION 138 // it is now NON_IDEAL_RESOLUTION. The exception is for LOW_RESOLUTION
139 // tilings, which are computed and created entirely on the active tree. 139 // tilings, which are computed and created entirely on the active tree.
140 // Since the pending tree does not have them, we should just leave them as 140 // Since the pending tree does not have them, we should just leave them as
141 // low resolution to not lose them. 141 // low resolution to not lose them.
142 if (tiling->resolution() != LOW_RESOLUTION) 142 if (tiling->resolution() != LOW_RESOLUTION)
143 tiling->set_resolution(NON_IDEAL_RESOLUTION); 143 tiling->set_resolution(NON_IDEAL_RESOLUTION);
144 } 144 }
145 145
146 VerifyTilings(pending_twin_set); 146 VerifyTilings(pending_twin_set);
147 } 147 }
148 148
149 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForCommit( 149 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForCommit(
150 scoped_refptr<RasterSource> raster_source, 150 scoped_refptr<RasterSource> raster_source,
151 const Region& layer_invalidation, 151 const Region& layer_invalidation,
152 float minimum_contents_scale_key, 152 float minimum_contents_scale,
153 float maximum_contents_scale_key) { 153 float maximum_contents_scale) {
154 RemoveTilingsBelowScaleKey(minimum_contents_scale_key); 154 RemoveTilingsBelowScaleKey(minimum_contents_scale);
155 RemoveTilingsAboveScaleKey(maximum_contents_scale_key); 155 RemoveTilingsAboveScaleKey(maximum_contents_scale);
156 156
157 raster_source_ = raster_source; 157 raster_source_ = raster_source;
158 158
159 // Invalidate tiles and update them to the new raster source. 159 // Invalidate tiles and update them to the new raster source.
160 for (const std::unique_ptr<PictureLayerTiling>& tiling : tilings_) { 160 for (const std::unique_ptr<PictureLayerTiling>& tiling : tilings_) {
161 DCHECK(tree_ != PENDING_TREE || !tiling->has_tiles()); 161 DCHECK(tree_ != PENDING_TREE || !tiling->has_tiles());
162 tiling->SetRasterSourceAndResize(raster_source); 162 tiling->SetRasterSourceAndResize(raster_source);
163 163
164 // Force |UpdateTilePriorities| on commit for cases where the compositor is 164 // Force |UpdateTilePriorities| on commit for cases where the compositor is
165 // heavily pipelined resulting in back to back draw and commit. This 165 // heavily pipelined resulting in back to back draw and commit. This
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 225
226 void PictureLayerTilingSet::CleanUpTilings( 226 void PictureLayerTilingSet::CleanUpTilings(
227 float min_acceptable_high_res_scale_key, 227 float min_acceptable_high_res_scale_key,
228 float max_acceptable_high_res_scale_key, 228 float max_acceptable_high_res_scale_key,
229 const std::vector<PictureLayerTiling*>& needed_tilings, 229 const std::vector<PictureLayerTiling*>& needed_tilings,
230 PictureLayerTilingSet* twin_set) { 230 PictureLayerTilingSet* twin_set) {
231 std::vector<PictureLayerTiling*> to_remove; 231 std::vector<PictureLayerTiling*> to_remove;
232 for (const auto& tiling : tilings_) { 232 for (const auto& tiling : tilings_) {
233 // Keep all tilings within the min/max scales. 233 // Keep all tilings within the min/max scales.
234 if (tiling->contents_scale_key() >= min_acceptable_high_res_scale_key && 234 if (tiling->contents_scale() >= min_acceptable_high_res_scale_key &&
235 tiling->contents_scale_key() <= max_acceptable_high_res_scale_key) { 235 tiling->contents_scale() <= max_acceptable_high_res_scale_key) {
236 continue; 236 continue;
237 } 237 }
238 238
239 // Keep low resolution tilings. 239 // Keep low resolution tilings.
240 if (tiling->resolution() == LOW_RESOLUTION) 240 if (tiling->resolution() == LOW_RESOLUTION)
241 continue; 241 continue;
242 242
243 // Don't remove tilings that are required. 243 // Don't remove tilings that are required.
244 if (std::find(needed_tilings.begin(), needed_tilings.end(), tiling.get()) != 244 if (std::find(needed_tilings.begin(), needed_tilings.end(), tiling.get()) !=
245 needed_tilings.end()) { 245 needed_tilings.end()) {
(...skipping 17 matching lines...) Expand all
263 }); 263 });
264 tilings_.erase(to_remove, tilings_.end()); 264 tilings_.erase(to_remove, tilings_.end());
265 } 265 }
266 266
267 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() { 267 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() {
268 for (const auto& tiling : tilings_) 268 for (const auto& tiling : tilings_)
269 tiling->set_resolution(NON_IDEAL_RESOLUTION); 269 tiling->set_resolution(NON_IDEAL_RESOLUTION);
270 } 270 }
271 271
272 PictureLayerTiling* PictureLayerTilingSet::AddTiling( 272 PictureLayerTiling* PictureLayerTilingSet::AddTiling(
273 float contents_scale_key, 273 float contents_scale,
274 scoped_refptr<RasterSource> raster_source) { 274 scoped_refptr<RasterSource> raster_source) {
275 if (!raster_source_) 275 if (!raster_source_)
276 raster_source_ = raster_source; 276 raster_source_ = raster_source;
277 277
278 #if DCHECK_IS_ON() 278 #if DCHECK_IS_ON()
279 for (size_t i = 0; i < tilings_.size(); ++i) { 279 for (size_t i = 0; i < tilings_.size(); ++i) {
280 DCHECK_NE(tilings_[i]->contents_scale_key(), contents_scale_key); 280 DCHECK_NE(tilings_[i]->contents_scale(), contents_scale);
281 DCHECK_EQ(tilings_[i]->raster_source(), raster_source.get()); 281 DCHECK_EQ(tilings_[i]->raster_source(), raster_source.get());
282 } 282 }
283 #endif // DCHECK_IS_ON() 283 #endif // DCHECK_IS_ON()
284 284
285 gfx::SizeF raster_scales(contents_scale_key,
286 contents_scale_key / aspect_ratio_);
287 tilings_.push_back(base::MakeUnique<PictureLayerTiling>( 285 tilings_.push_back(base::MakeUnique<PictureLayerTiling>(
288 tree_, raster_scales, raster_source, client_, 286 tree_, contents_scale, raster_source, client_,
289 kMaxSoonBorderDistanceInScreenPixels, max_preraster_distance_)); 287 kMaxSoonBorderDistanceInScreenPixels, max_preraster_distance_));
290 PictureLayerTiling* appended = tilings_.back().get(); 288 PictureLayerTiling* appended = tilings_.back().get();
291 state_since_last_tile_priority_update_.added_tilings = true; 289 state_since_last_tile_priority_update_.added_tilings = true;
292 290
293 std::sort(tilings_.begin(), tilings_.end(), LargestToSmallestScaleFunctor()); 291 std::sort(tilings_.begin(), tilings_.end(), LargestToSmallestScaleFunctor());
294 return appended; 292 return appended;
295 } 293 }
296 294
297 int PictureLayerTilingSet::NumHighResTilings() const { 295 int PictureLayerTilingSet::NumHighResTilings() const {
298 return std::count_if(tilings_.begin(), tilings_.end(), 296 return std::count_if(tilings_.begin(), tilings_.end(),
299 [](const std::unique_ptr<PictureLayerTiling>& tiling) { 297 [](const std::unique_ptr<PictureLayerTiling>& tiling) {
300 return tiling->resolution() == HIGH_RESOLUTION; 298 return tiling->resolution() == HIGH_RESOLUTION;
301 }); 299 });
302 } 300 }
303 301
304 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScaleKey( 302 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScaleKey(
305 float scale_key) const { 303 float scale_key) const {
306 for (size_t i = 0; i < tilings_.size(); ++i) { 304 for (size_t i = 0; i < tilings_.size(); ++i) {
307 if (tilings_[i]->contents_scale_key() == scale_key) 305 if (tilings_[i]->contents_scale() == scale_key)
308 return tilings_[i].get(); 306 return tilings_[i].get();
309 } 307 }
310 return nullptr; 308 return nullptr;
311 } 309 }
312 310
313 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithResolution( 311 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithResolution(
314 TileResolution resolution) const { 312 TileResolution resolution) const {
315 auto iter = std::find_if( 313 auto iter = std::find_if(
316 tilings_.begin(), tilings_.end(), 314 tilings_.begin(), tilings_.end(),
317 [resolution](const std::unique_ptr<PictureLayerTiling>& tiling) { 315 [resolution](const std::unique_ptr<PictureLayerTiling>& tiling) {
318 return tiling->resolution() == resolution; 316 return tiling->resolution() == resolution;
319 }); 317 });
320 if (iter == tilings_.end()) 318 if (iter == tilings_.end())
321 return nullptr; 319 return nullptr;
322 return iter->get(); 320 return iter->get();
323 } 321 }
324 322
325 void PictureLayerTilingSet::RemoveTilingsBelowScaleKey( 323 void PictureLayerTilingSet::RemoveTilingsBelowScaleKey(
326 float minimum_scale_key) { 324 float minimum_scale_key) {
327 auto to_remove = std::remove_if( 325 auto to_remove = std::remove_if(
328 tilings_.begin(), tilings_.end(), 326 tilings_.begin(), tilings_.end(),
329 [minimum_scale_key](const std::unique_ptr<PictureLayerTiling>& tiling) { 327 [minimum_scale_key](const std::unique_ptr<PictureLayerTiling>& tiling) {
330 return tiling->contents_scale_key() < minimum_scale_key; 328 return tiling->contents_scale() < minimum_scale_key;
331 }); 329 });
332 tilings_.erase(to_remove, tilings_.end()); 330 tilings_.erase(to_remove, tilings_.end());
333 } 331 }
334 332
335 void PictureLayerTilingSet::RemoveTilingsAboveScaleKey( 333 void PictureLayerTilingSet::RemoveTilingsAboveScaleKey(
336 float maximum_scale_key) { 334 float maximum_scale_key) {
337 auto to_remove = std::remove_if( 335 auto to_remove = std::remove_if(
338 tilings_.begin(), tilings_.end(), 336 tilings_.begin(), tilings_.end(),
339 [maximum_scale_key](const std::unique_ptr<PictureLayerTiling>& tiling) { 337 [maximum_scale_key](const std::unique_ptr<PictureLayerTiling>& tiling) {
340 return tiling->contents_scale_key() > maximum_scale_key; 338 return tiling->contents_scale() > maximum_scale_key;
341 }); 339 });
342 tilings_.erase(to_remove, tilings_.end()); 340 tilings_.erase(to_remove, tilings_.end());
343 } 341 }
344 342
345 void PictureLayerTilingSet::RemoveAllTilings() { 343 void PictureLayerTilingSet::RemoveAllTilings() {
346 tilings_.clear(); 344 tilings_.clear();
347 } 345 }
348 346
349 void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) { 347 void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) {
350 auto iter = std::find_if( 348 auto iter = std::find_if(
(...skipping 11 matching lines...) Expand all
362 tilings_[i]->Reset(); 360 tilings_[i]->Reset();
363 } 361 }
364 362
365 float PictureLayerTilingSet::GetSnappedContentsScaleKey( 363 float PictureLayerTilingSet::GetSnappedContentsScaleKey(
366 float start_scale, 364 float start_scale,
367 float snap_to_existing_tiling_ratio) const { 365 float snap_to_existing_tiling_ratio) const {
368 // If a tiling exists within the max snapping ratio, snap to its scale. 366 // If a tiling exists within the max snapping ratio, snap to its scale.
369 float snapped_contents_scale = start_scale; 367 float snapped_contents_scale = start_scale;
370 float snapped_ratio = snap_to_existing_tiling_ratio; 368 float snapped_ratio = snap_to_existing_tiling_ratio;
371 for (const auto& tiling : tilings_) { 369 for (const auto& tiling : tilings_) {
372 float tiling_contents_scale = tiling->contents_scale_key(); 370 float tiling_contents_scale = tiling->contents_scale();
373 float ratio = LargerRatio(tiling_contents_scale, start_scale); 371 float ratio = LargerRatio(tiling_contents_scale, start_scale);
374 if (ratio < snapped_ratio) { 372 if (ratio < snapped_ratio) {
375 snapped_contents_scale = tiling_contents_scale; 373 snapped_contents_scale = tiling_contents_scale;
376 snapped_ratio = ratio; 374 snapped_ratio = ratio;
377 } 375 }
378 } 376 }
379 return snapped_contents_scale; 377 return snapped_contents_scale;
380 } 378 }
381 379
382 float PictureLayerTilingSet::GetMaximumContentsScale() const { 380 float PictureLayerTilingSet::GetMaximumContentsScale() const {
383 if (tilings_.empty()) 381 if (tilings_.empty())
384 return 0.f; 382 return 0.f;
385 // The first tiling has the largest contents scale. 383 // The first tiling has the largest contents scale.
386 return std::max(tilings_[0]->raster_scales().width(), 384 return tilings_[0]->contents_scale();
387 tilings_[0]->raster_scales().height());
388 } 385 }
389 386
390 bool PictureLayerTilingSet::TilingsNeedUpdate( 387 bool PictureLayerTilingSet::TilingsNeedUpdate(
391 const gfx::Rect& visible_rect_in_layer_space, 388 const gfx::Rect& visible_rect_in_layer_space,
392 double current_frame_time_in_seconds) { 389 double current_frame_time_in_seconds) {
393 // If we don't have any tilings, we don't need an update. 390 // If we don't have any tilings, we don't need an update.
394 if (num_tilings() == 0) 391 if (num_tilings() == 0)
395 return false; 392 return false;
396 393
397 // If we never updated the tiling set, then our history is empty. We should 394 // If we never updated the tiling set, then our history is empty. We should
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 tiling->set_can_require_tiles_for_activation( 541 tiling->set_can_require_tiles_for_activation(
545 can_require_tiles_for_activation); 542 can_require_tiles_for_activation);
546 tiling->ComputeTilePriorityRects( 543 tiling->ComputeTilePriorityRects(
547 visible_rect_in_layer_space_, skewport_in_layer_space_, 544 visible_rect_in_layer_space_, skewport_in_layer_space_,
548 soon_border_rect_in_layer_space_, eventually_rect_in_layer_space_, 545 soon_border_rect_in_layer_space_, eventually_rect_in_layer_space_,
549 ideal_contents_scale, occlusion_in_layer_space); 546 ideal_contents_scale, occlusion_in_layer_space);
550 } 547 }
551 return true; 548 return true;
552 } 549 }
553 550
554 void PictureLayerTilingSet::SetAspectRatio(float ratio) {
555 if (std::abs(ratio - aspect_ratio_) < std::numeric_limits<float>::epsilon())
556 return;
557 TRACE_EVENT1("cc", "PictureLayerTilingSet::SetAspectRatio", "aspect_ratio",
558 ratio);
559 aspect_ratio_ = ratio;
560 RemoveAllTilings();
561 }
562
563 void PictureLayerTilingSet::GetAllPrioritizedTilesForTracing( 551 void PictureLayerTilingSet::GetAllPrioritizedTilesForTracing(
564 std::vector<PrioritizedTile>* prioritized_tiles) const { 552 std::vector<PrioritizedTile>* prioritized_tiles) const {
565 for (const auto& tiling : tilings_) 553 for (const auto& tiling : tilings_)
566 tiling->GetAllPrioritizedTilesForTracing(prioritized_tiles); 554 tiling->GetAllPrioritizedTilesForTracing(prioritized_tiles);
567 } 555 }
568 556
569 PictureLayerTilingSet::CoverageIterator::CoverageIterator( 557 PictureLayerTilingSet::CoverageIterator::CoverageIterator(
570 const PictureLayerTilingSet* set, 558 const PictureLayerTilingSet* set,
571 float coverage_scale, 559 float coverage_scale,
572 const gfx::Rect& coverage_rect, 560 const gfx::Rect& coverage_rect,
573 float ideal_contents_scale) 561 float ideal_contents_scale)
574 : set_(set), 562 : set_(set),
575 coverage_scale_(coverage_scale), 563 coverage_scale_(coverage_scale),
576 current_tiling_(std::numeric_limits<size_t>::max()) { 564 current_tiling_(std::numeric_limits<size_t>::max()) {
577 missing_region_.Union(coverage_rect); 565 missing_region_.Union(coverage_rect);
578 566
579 // Determine the smallest content_scale tiling which a scale higher than the 567 // Determine the smallest content_scale tiling which a scale higher than the
580 // ideal (or the first tiling if all tilings have a scale less than ideal). 568 // ideal (or the first tiling if all tilings have a scale less than ideal).
581 size_t tilings_size = set_->tilings_.size(); 569 size_t tilings_size = set_->tilings_.size();
582 for (ideal_tiling_ = 0; ideal_tiling_ < tilings_size; ++ideal_tiling_) { 570 for (ideal_tiling_ = 0; ideal_tiling_ < tilings_size; ++ideal_tiling_) {
583 PictureLayerTiling* tiling = set_->tilings_[ideal_tiling_].get(); 571 PictureLayerTiling* tiling = set_->tilings_[ideal_tiling_].get();
584 if (tiling->contents_scale_key() < ideal_contents_scale) { 572 if (tiling->contents_scale() < ideal_contents_scale) {
585 if (ideal_tiling_ > 0) 573 if (ideal_tiling_ > 0)
586 ideal_tiling_--; 574 ideal_tiling_--;
587 break; 575 break;
588 } 576 }
589 } 577 }
590 578
591 // If all tilings have a scale larger than the ideal, then use the smallest 579 // If all tilings have a scale larger than the ideal, then use the smallest
592 // scale (which is the last one). 580 // scale (which is the last one).
593 if (ideal_tiling_ == tilings_size && ideal_tiling_ > 0) 581 if (ideal_tiling_ == tilings_size && ideal_tiling_ > 0)
594 ideal_tiling_--; 582 ideal_tiling_--;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 case LOWER_THAN_LOW_RES: 771 case LOWER_THAN_LOW_RES:
784 range = TilingRange(low_res_range.end, tilings_size); 772 range = TilingRange(low_res_range.end, tilings_size);
785 break; 773 break;
786 } 774 }
787 775
788 DCHECK_LE(range.start, range.end); 776 DCHECK_LE(range.start, range.end);
789 return range; 777 return range;
790 } 778 }
791 779
792 } // namespace cc 780 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling_set.h ('k') | cc/tiles/picture_layer_tiling_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698