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

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

Issue 693943003: Update from https://crrev.com/302630 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/resources/picture_layer_tiling.cc ('k') | cc/resources/picture_layer_tiling_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/resources/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 TilingRange high_res_range(0, 0); 332 TilingRange high_res_range(0, 0);
333 TilingRange low_res_range(tilings_.size(), tilings_.size()); 333 TilingRange low_res_range(tilings_.size(), tilings_.size());
334 for (size_t i = 0; i < tilings_.size(); ++i) { 334 for (size_t i = 0; i < tilings_.size(); ++i) {
335 const PictureLayerTiling* tiling = tilings_[i]; 335 const PictureLayerTiling* tiling = tilings_[i];
336 if (tiling->resolution() == HIGH_RESOLUTION) 336 if (tiling->resolution() == HIGH_RESOLUTION)
337 high_res_range = TilingRange(i, i + 1); 337 high_res_range = TilingRange(i, i + 1);
338 if (tiling->resolution() == LOW_RESOLUTION) 338 if (tiling->resolution() == LOW_RESOLUTION)
339 low_res_range = TilingRange(i, i + 1); 339 low_res_range = TilingRange(i, i + 1);
340 } 340 }
341 341
342 TilingRange range(0, 0);
342 switch (type) { 343 switch (type) {
343 case HIGHER_THAN_HIGH_RES: 344 case HIGHER_THAN_HIGH_RES:
344 return TilingRange(0, high_res_range.start); 345 range = TilingRange(0, high_res_range.start);
346 break;
345 case HIGH_RES: 347 case HIGH_RES:
346 return high_res_range; 348 range = high_res_range;
349 break;
347 case BETWEEN_HIGH_AND_LOW_RES: 350 case BETWEEN_HIGH_AND_LOW_RES:
348 return TilingRange(high_res_range.end, low_res_range.start); 351 // TODO(vmpstr): This code assumes that high res tiling will come before
352 // low res tiling, however there are cases where this assumption is
353 // violated. As a result, it's better to be safe in these situations,
354 // since otherwise we can end up accessing a tiling that doesn't exist.
355 // See crbug.com/429397 for high res tiling appearing after low res
356 // tiling discussion/fixes.
357 if (high_res_range.start <= low_res_range.start)
358 range = TilingRange(high_res_range.end, low_res_range.start);
359 else
360 range = TilingRange(low_res_range.end, high_res_range.start);
361 break;
349 case LOW_RES: 362 case LOW_RES:
350 return low_res_range; 363 range = low_res_range;
364 break;
351 case LOWER_THAN_LOW_RES: 365 case LOWER_THAN_LOW_RES:
352 return TilingRange(low_res_range.end, tilings_.size()); 366 range = TilingRange(low_res_range.end, tilings_.size());
367 break;
353 } 368 }
354 369
355 NOTREACHED(); 370 DCHECK_LE(range.start, range.end);
356 return TilingRange(0, 0); 371 return range;
357 } 372 }
358 373
359 } // namespace cc 374 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698