OLD | NEW |
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.h" | 5 #include "cc/tiles/picture_layer_tiling.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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (after_bottom > before_bottom) { | 249 if (after_bottom > before_bottom) { |
250 DCHECK_EQ(after_bottom, before_bottom + 1); | 250 DCHECK_EQ(after_bottom, before_bottom + 1); |
251 for (int i = before_left; i <= before_right; ++i) { | 251 for (int i = before_left; i <= before_right; ++i) { |
252 if (ShouldCreateTileAt(i, after_bottom)) | 252 if (ShouldCreateTileAt(i, after_bottom)) |
253 CreateTile(i, after_bottom); | 253 CreateTile(i, after_bottom); |
254 } | 254 } |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 void PictureLayerTiling::Invalidate(const Region& layer_invalidation) { | 258 void PictureLayerTiling::Invalidate(const Region& layer_invalidation) { |
259 DCHECK_IMPLIES(tree_ == ACTIVE_TREE, | 259 DCHECK(tree_ != ACTIVE_TREE || !client_->GetPendingOrActiveTwinTiling(this)); |
260 !client_->GetPendingOrActiveTwinTiling(this)); | |
261 RemoveTilesInRegion(layer_invalidation, true /* recreate tiles */); | 260 RemoveTilesInRegion(layer_invalidation, true /* recreate tiles */); |
262 } | 261 } |
263 | 262 |
264 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_invalidation, | 263 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_invalidation, |
265 bool recreate_tiles) { | 264 bool recreate_tiles) { |
266 // We only invalidate the active tiling when it's orphaned: it has no pending | 265 // We only invalidate the active tiling when it's orphaned: it has no pending |
267 // twin, so it's slated for removal in the future. | 266 // twin, so it's slated for removal in the future. |
268 if (live_tiles_rect_.IsEmpty()) | 267 if (live_tiles_rect_.IsEmpty()) |
269 return; | 268 return; |
270 // Pick 16 for the size of the SmallMap before it promotes to a hash_map. | 269 // Pick 16 for the size of the SmallMap before it promotes to a hash_map. |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 break; | 1110 break; |
1112 } | 1111 } |
1113 | 1112 |
1114 gfx::Rect result(origin_x, origin_y, width, height); | 1113 gfx::Rect result(origin_x, origin_y, width, height); |
1115 if (cache) | 1114 if (cache) |
1116 cache->previous_result = result; | 1115 cache->previous_result = result; |
1117 return result; | 1116 return result; |
1118 } | 1117 } |
1119 | 1118 |
1120 } // namespace cc | 1119 } // namespace cc |
OLD | NEW |