| 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/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 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 Invalidate(layer_invalidation); | 167 Invalidate(layer_invalidation); |
| 168 } | 168 } |
| 169 | 169 |
| 170 PicturePileImpl* pile = client_->GetPile(); | 170 PicturePileImpl* pile = client_->GetPile(); |
| 171 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 171 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 172 it->second->set_picture_pile(pile); | 172 it->second->set_picture_pile(pile); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void PictureLayerTiling::Invalidate(const Region& layer_region) { | 175 void PictureLayerTiling::Invalidate(const Region& layer_region) { |
| 176 std::vector<TileMapKey> new_tile_keys; | 176 std::vector<TileMapKey> new_tile_keys; |
| 177 // TODO(danakj): What we really want is to ignore border pixels that intersect | |
| 178 // the rect when choosing which tiles it covers, then expand to those tiles | |
| 179 // plus their border pixels. | |
| 180 gfx::Rect expanded_live_tiles_rect = | 177 gfx::Rect expanded_live_tiles_rect = |
| 181 tiling_data_.ExpandRectToTileBounds(live_tiles_rect_); | 178 tiling_data_.ExpandRectIgnoringBordersToTileBoundsWithBorders( |
| 179 live_tiles_rect_); |
| 182 for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) { | 180 for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) { |
| 183 gfx::Rect layer_rect = iter.rect(); | 181 gfx::Rect layer_rect = iter.rect(); |
| 184 gfx::Rect content_rect = | 182 gfx::Rect content_rect = |
| 185 gfx::ScaleToEnclosingRect(layer_rect, contents_scale_); | 183 gfx::ScaleToEnclosingRect(layer_rect, contents_scale_); |
| 186 // Avoid needless work by not bothering to invalidate where there aren't | 184 // Avoid needless work by not bothering to invalidate where there aren't |
| 187 // tiles. | 185 // tiles. |
| 188 content_rect.Intersect(expanded_live_tiles_rect); | 186 content_rect.Intersect(expanded_live_tiles_rect); |
| 189 if (content_rect.IsEmpty()) | 187 if (content_rect.IsEmpty()) |
| 190 continue; | 188 continue; |
| 191 bool include_borders = true; | 189 bool include_borders = true; |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_); | 963 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_); |
| 966 tile_iterator_ = tiling_->eviction_tiles_cache_.begin(); | 964 tile_iterator_ = tiling_->eviction_tiles_cache_.begin(); |
| 967 is_valid_ = true; | 965 is_valid_ = true; |
| 968 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && | 966 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && |
| 969 !(*tile_iterator_)->HasResources()) { | 967 !(*tile_iterator_)->HasResources()) { |
| 970 ++(*this); | 968 ++(*this); |
| 971 } | 969 } |
| 972 } | 970 } |
| 973 | 971 |
| 974 } // namespace cc | 972 } // namespace cc |
| OLD | NEW |