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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 530 |
531 // Clip the skewport to |max_skewport|. | 531 // Clip the skewport to |max_skewport|. |
532 skewport.Intersect(max_skewport); | 532 skewport.Intersect(max_skewport); |
533 | 533 |
534 // Finally, ensure that visible rect is contained in the skewport. | 534 // Finally, ensure that visible rect is contained in the skewport. |
535 skewport.Union(visible_rect_in_content_space); | 535 skewport.Union(visible_rect_in_content_space); |
536 return skewport; | 536 return skewport; |
537 } | 537 } |
538 | 538 |
539 void PictureLayerTiling::ComputeTilePriorityRects( | 539 void PictureLayerTiling::ComputeTilePriorityRects( |
540 WhichTree tree, | |
541 const gfx::Rect& viewport_in_layer_space, | 540 const gfx::Rect& viewport_in_layer_space, |
542 float ideal_contents_scale, | 541 float ideal_contents_scale, |
543 double current_frame_time_in_seconds, | 542 double current_frame_time_in_seconds, |
544 const Occlusion& occlusion_in_layer_space) { | 543 const Occlusion& occlusion_in_layer_space) { |
545 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, | 544 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, |
546 viewport_in_layer_space)) { | 545 viewport_in_layer_space)) { |
547 // This should never be zero for the purposes of has_ever_been_updated(). | 546 // This should never be zero for the purposes of has_ever_been_updated(). |
548 DCHECK_NE(current_frame_time_in_seconds, 0.0); | 547 DCHECK_NE(current_frame_time_in_seconds, 0.0); |
549 return; | 548 return; |
550 } | 549 } |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 DCHECK(*this); | 1256 DCHECK(*this); |
1258 do { | 1257 do { |
1259 ++current_eviction_tiles_index_; | 1258 ++current_eviction_tiles_index_; |
1260 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1259 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
1261 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1260 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
1262 | 1261 |
1263 return *this; | 1262 return *this; |
1264 } | 1263 } |
1265 | 1264 |
1266 } // namespace cc | 1265 } // namespace cc |
OLD | NEW |