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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return true; | 379 return true; |
380 | 380 |
381 // If the active tree can't create a tile, because of its raster source, then | 381 // If the active tree can't create a tile, because of its raster source, then |
382 // the pending tree should create one. | 382 // the pending tree should create one. |
383 if (!active_twin->raster_source()->CoversRect(info.enclosing_layer_rect)) | 383 if (!active_twin->raster_source()->CoversRect(info.enclosing_layer_rect)) |
384 return true; | 384 return true; |
385 | 385 |
386 const Region* layer_invalidation = client_->GetPendingInvalidation(); | 386 const Region* layer_invalidation = client_->GetPendingInvalidation(); |
387 | 387 |
388 // If this tile is invalidated, then the pending tree should create one. | 388 // If this tile is invalidated, then the pending tree should create one. |
389 if (layer_invalidation && | 389 // Do the intersection test in content space to match the corresponding check |
390 layer_invalidation->Intersects(info.enclosing_layer_rect)) | 390 // on the active tree and avoid floating point inconsistencies. |
391 return true; | 391 for (Region::Iterator iter(*layer_invalidation); iter.has_rect(); |
392 | 392 iter.next()) { |
| 393 gfx::Rect invalid_content_rect = |
| 394 gfx::ScaleToEnclosingRect(iter.rect(), contents_scale_); |
| 395 if (invalid_content_rect.Intersects(info.content_rect)) |
| 396 return true; |
| 397 } |
393 // If the active tree doesn't have a tile here, but it's in the pending tree's | 398 // If the active tree doesn't have a tile here, but it's in the pending tree's |
394 // visible rect, then the pending tree should create a tile. This can happen | 399 // visible rect, then the pending tree should create a tile. This can happen |
395 // if the pending visible rect is outside of the active tree's live tiles | 400 // if the pending visible rect is outside of the active tree's live tiles |
396 // rect. In those situations, we need to block activation until we're ready to | 401 // rect. In those situations, we need to block activation until we're ready to |
397 // display content, which will have to come from the pending tree. | 402 // display content, which will have to come from the pending tree. |
398 if (!active_twin->TileAt(i, j) && | 403 if (!active_twin->TileAt(i, j) && |
399 current_visible_rect_.Intersects(info.content_rect)) | 404 current_visible_rect_.Intersects(info.content_rect)) |
400 return true; | 405 return true; |
401 | 406 |
402 // In all other cases, the pending tree doesn't need to create a tile. | 407 // In all other cases, the pending tree doesn't need to create a tile. |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { | 1039 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { |
1035 size_t amount = 0; | 1040 size_t amount = 0; |
1036 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 1041 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
1037 const Tile* tile = it->second.get(); | 1042 const Tile* tile = it->second.get(); |
1038 amount += tile->GPUMemoryUsageInBytes(); | 1043 amount += tile->GPUMemoryUsageInBytes(); |
1039 } | 1044 } |
1040 return amount; | 1045 return amount; |
1041 } | 1046 } |
1042 | 1047 |
1043 } // namespace cc | 1048 } // namespace cc |
OLD | NEW |