| 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 #include <set> | 10 #include <set> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 TileMap::iterator find = tiles_.find(key); | 161 TileMap::iterator find = tiles_.find(key); |
| 162 if (find != tiles_.end()) | 162 if (find != tiles_.end()) |
| 163 continue; | 163 continue; |
| 164 CreateTile(key.first, key.second, twin_tiling); | 164 CreateTile(key.first, key.second, twin_tiling); |
| 165 } | 165 } |
| 166 | 166 |
| 167 VerifyLiveTilesRect(); | 167 VerifyLiveTilesRect(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void PictureLayerTiling::UpdateTilesToCurrentRasterSource( | 170 void PictureLayerTiling::UpdateTilesToCurrentRasterSource( |
| 171 RasterSource* raster_source, |
| 171 const Region& layer_invalidation, | 172 const Region& layer_invalidation, |
| 172 const gfx::Size& new_layer_bounds) { | 173 const gfx::Size& new_layer_bounds) { |
| 173 DCHECK(!new_layer_bounds.IsEmpty()); | 174 DCHECK(!new_layer_bounds.IsEmpty()); |
| 174 | 175 |
| 175 gfx::Size content_bounds = | 176 gfx::Size content_bounds = |
| 176 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); | 177 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); |
| 177 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 178 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
| 178 | 179 |
| 179 if (new_layer_bounds != layer_bounds_) { | 180 if (new_layer_bounds != layer_bounds_) { |
| 180 if (tile_size.IsEmpty()) { | 181 if (tile_size.IsEmpty()) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 243 |
| 243 if (tile_size != tiling_data_.max_texture_size()) { | 244 if (tile_size != tiling_data_.max_texture_size()) { |
| 244 tiling_data_.SetMaxTextureSize(tile_size); | 245 tiling_data_.SetMaxTextureSize(tile_size); |
| 245 // When the tile size changes, the TilingData positions no longer work | 246 // When the tile size changes, the TilingData positions no longer work |
| 246 // as valid keys to the TileMap, so just drop all tiles. | 247 // as valid keys to the TileMap, so just drop all tiles. |
| 247 Reset(); | 248 Reset(); |
| 248 } else { | 249 } else { |
| 249 Invalidate(layer_invalidation); | 250 Invalidate(layer_invalidation); |
| 250 } | 251 } |
| 251 | 252 |
| 252 RasterSource* raster_source = client_->GetRasterSource(); | |
| 253 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 253 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 254 it->second->set_raster_source(raster_source); | 254 it->second->set_raster_source(raster_source); |
| 255 VerifyLiveTilesRect(); | 255 VerifyLiveTilesRect(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_region) { | 258 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_region) { |
| 259 bool recreate_invalidated_tiles = false; | 259 bool recreate_invalidated_tiles = false; |
| 260 DoInvalidate(layer_region, recreate_invalidated_tiles); | 260 DoInvalidate(layer_region, recreate_invalidated_tiles); |
| 261 } | 261 } |
| 262 | 262 |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 DCHECK(*this); | 1257 DCHECK(*this); |
| 1258 do { | 1258 do { |
| 1259 ++current_eviction_tiles_index_; | 1259 ++current_eviction_tiles_index_; |
| 1260 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1260 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
| 1261 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1261 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
| 1262 | 1262 |
| 1263 return *this; | 1263 return *this; |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 } // namespace cc | 1266 } // namespace cc |
| OLD | NEW |