| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 PictureLayerTiling::PictureLayerTiling(float contents_scale, | 68 PictureLayerTiling::PictureLayerTiling(float contents_scale, |
| 69 const gfx::Size& layer_bounds, | 69 const gfx::Size& layer_bounds, |
| 70 PictureLayerTilingClient* client) | 70 PictureLayerTilingClient* client) |
| 71 : contents_scale_(contents_scale), | 71 : contents_scale_(contents_scale), |
| 72 layer_bounds_(layer_bounds), | 72 layer_bounds_(layer_bounds), |
| 73 resolution_(NON_IDEAL_RESOLUTION), | 73 resolution_(NON_IDEAL_RESOLUTION), |
| 74 client_(client), | 74 client_(client), |
| 75 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), | 75 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), |
| 76 last_impl_frame_time_in_seconds_(0.0), | 76 last_impl_frame_time_in_seconds_(0.0), |
| 77 content_to_screen_scale_(0.f), | |
| 78 can_require_tiles_for_activation_(false), | 77 can_require_tiles_for_activation_(false), |
| 78 current_content_to_screen_scale_(0.f), |
| 79 has_visible_rect_tiles_(false), | 79 has_visible_rect_tiles_(false), |
| 80 has_skewport_rect_tiles_(false), | 80 has_skewport_rect_tiles_(false), |
| 81 has_soon_border_rect_tiles_(false), | 81 has_soon_border_rect_tiles_(false), |
| 82 has_eventually_rect_tiles_(false), | 82 has_eventually_rect_tiles_(false), |
| 83 eviction_tiles_cache_valid_(false), | 83 eviction_tiles_cache_valid_(false), |
| 84 eviction_cache_tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES) { | 84 eviction_cache_tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES) { |
| 85 gfx::Size content_bounds = | 85 gfx::Size content_bounds = |
| 86 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); | 86 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); |
| 87 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 87 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
| 88 if (tile_size.IsEmpty()) { | 88 if (tile_size.IsEmpty()) { |
| 89 layer_bounds_ = gfx::Size(); | 89 layer_bounds_ = gfx::Size(); |
| 90 content_bounds = gfx::Size(); | 90 content_bounds = gfx::Size(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 DCHECK(!gfx::ToFlooredSize( | 93 DCHECK(!gfx::ToFlooredSize( |
| 94 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) << | 94 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) << |
| 95 "Tiling created with scale too small as contents become empty." << | 95 "Tiling created with scale too small as contents become empty." << |
| 96 " Layer bounds: " << layer_bounds.ToString() << | 96 " Layer bounds: " << layer_bounds.ToString() << |
| 97 " Contents scale: " << contents_scale; | 97 " Contents scale: " << contents_scale; |
| 98 | 98 |
| 99 tiling_data_.SetTilingSize(content_bounds); | 99 tiling_data_.SetTilingSize(content_bounds); |
| 100 tiling_data_.SetMaxTextureSize(tile_size); | 100 tiling_data_.SetMaxTextureSize(tile_size); |
| 101 } | 101 } |
| 102 | 102 |
| 103 PictureLayerTiling::~PictureLayerTiling() { | 103 PictureLayerTiling::~PictureLayerTiling() { |
| 104 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 104 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 105 it->second->set_shared(false); | 105 it->second->set_shared(false); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { | |
| 109 client_ = client; | |
| 110 } | |
| 111 | |
| 112 Tile* PictureLayerTiling::CreateTile(int i, | 108 Tile* PictureLayerTiling::CreateTile(int i, |
| 113 int j, | 109 int j, |
| 114 const PictureLayerTiling* twin_tiling) { | 110 const PictureLayerTiling* twin_tiling) { |
| 115 TileMapKey key(i, j); | 111 TileMapKey key(i, j); |
| 116 DCHECK(tiles_.find(key) == tiles_.end()); | 112 DCHECK(tiles_.find(key) == tiles_.end()); |
| 117 | 113 |
| 118 gfx::Rect paint_rect = tiling_data_.TileBoundsWithBorder(i, j); | 114 gfx::Rect paint_rect = tiling_data_.TileBoundsWithBorder(i, j); |
| 119 gfx::Rect tile_rect = paint_rect; | 115 gfx::Rect tile_rect = paint_rect; |
| 120 tile_rect.set_size(tiling_data_.max_texture_size()); | 116 tile_rect.set_size(tiling_data_.max_texture_size()); |
| 121 | 117 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 TileMapKey key = iter.index(); | 156 TileMapKey key = iter.index(); |
| 161 TileMap::iterator find = tiles_.find(key); | 157 TileMap::iterator find = tiles_.find(key); |
| 162 if (find != tiles_.end()) | 158 if (find != tiles_.end()) |
| 163 continue; | 159 continue; |
| 164 CreateTile(key.first, key.second, twin_tiling); | 160 CreateTile(key.first, key.second, twin_tiling); |
| 165 } | 161 } |
| 166 | 162 |
| 167 VerifyLiveTilesRect(); | 163 VerifyLiveTilesRect(); |
| 168 } | 164 } |
| 169 | 165 |
| 166 void PictureLayerTiling::CloneTilesAndPropertiesFrom( |
| 167 const PictureLayerTiling& other) { |
| 168 DCHECK_EQ(&other, client_->GetPendingOrActiveTwinTiling(this)); |
| 169 |
| 170 DCHECK_EQ(other.contents_scale_, contents_scale_); |
| 171 DCHECK_EQ(other.layer_bounds_.ToString(), layer_bounds_.ToString()); |
| 172 resolution_ = other.resolution_; |
| 173 |
| 174 SetLiveTilesRect(other.live_tiles_rect()); |
| 175 DCHECK_EQ(other.tiles_.size(), tiles_.size()); |
| 176 |
| 177 UpdateTilePriorityRects( |
| 178 other.current_content_to_screen_scale_, other.current_visible_rect_, |
| 179 other.current_skewport_rect_, other.current_soon_border_rect_, |
| 180 other.current_eventually_rect_, other.current_occlusion_in_layer_space_); |
| 181 } |
| 182 |
| 170 void PictureLayerTiling::UpdateTilesToCurrentRasterSource( | 183 void PictureLayerTiling::UpdateTilesToCurrentRasterSource( |
| 171 RasterSource* raster_source, | 184 RasterSource* raster_source, |
| 172 const Region& layer_invalidation, | 185 const Region& layer_invalidation, |
| 173 const gfx::Size& new_layer_bounds) { | 186 const gfx::Size& new_layer_bounds) { |
| 174 DCHECK(!new_layer_bounds.IsEmpty()); | 187 DCHECK(!new_layer_bounds.IsEmpty()); |
| 175 | 188 |
| 176 gfx::Size content_bounds = | 189 gfx::Size content_bounds = |
| 177 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); | 190 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); |
| 178 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 191 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
| 179 | 192 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 203 | 216 |
| 204 int after_right = -1; | 217 int after_right = -1; |
| 205 int after_bottom = -1; | 218 int after_bottom = -1; |
| 206 if (!live_tiles_rect_.IsEmpty()) { | 219 if (!live_tiles_rect_.IsEmpty()) { |
| 207 after_right = | 220 after_right = |
| 208 tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.right() - 1); | 221 tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.right() - 1); |
| 209 after_bottom = | 222 after_bottom = |
| 210 tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.bottom() - 1); | 223 tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.bottom() - 1); |
| 211 } | 224 } |
| 212 | 225 |
| 213 // There is no recycled twin since this is run on the pending tiling. | 226 // There is no recycled twin since this is run on the pending tiling |
| 227 // during commit, and on the active tree during activate. |
| 214 PictureLayerTiling* recycled_twin = NULL; | 228 PictureLayerTiling* recycled_twin = NULL; |
| 215 DCHECK_EQ(recycled_twin, client_->GetRecycledTwinTiling(this)); | 229 DCHECK_EQ(recycled_twin, client_->GetRecycledTwinTiling(this)); |
| 216 DCHECK_EQ(PENDING_TREE, client_->GetTree()); | |
| 217 | 230 |
| 218 // Drop tiles outside the new layer bounds if the layer shrank. | 231 // Drop tiles outside the new layer bounds if the layer shrank. |
| 219 for (int i = after_right + 1; i <= before_right; ++i) { | 232 for (int i = after_right + 1; i <= before_right; ++i) { |
| 220 for (int j = before_top; j <= before_bottom; ++j) | 233 for (int j = before_top; j <= before_bottom; ++j) |
| 221 RemoveTileAt(i, j, recycled_twin); | 234 RemoveTileAt(i, j, recycled_twin); |
| 222 } | 235 } |
| 223 for (int i = before_left; i <= after_right; ++i) { | 236 for (int i = before_left; i <= after_right; ++i) { |
| 224 for (int j = after_bottom + 1; j <= before_bottom; ++j) | 237 for (int j = after_bottom + 1; j <= before_bottom; ++j) |
| 225 RemoveTileAt(i, j, recycled_twin); | 238 RemoveTileAt(i, j, recycled_twin); |
| 226 } | 239 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 243 | 256 |
| 244 if (tile_size != tiling_data_.max_texture_size()) { | 257 if (tile_size != tiling_data_.max_texture_size()) { |
| 245 tiling_data_.SetMaxTextureSize(tile_size); | 258 tiling_data_.SetMaxTextureSize(tile_size); |
| 246 // When the tile size changes, the TilingData positions no longer work | 259 // When the tile size changes, the TilingData positions no longer work |
| 247 // as valid keys to the TileMap, so just drop all tiles. | 260 // as valid keys to the TileMap, so just drop all tiles. |
| 248 Reset(); | 261 Reset(); |
| 249 } else { | 262 } else { |
| 250 Invalidate(layer_invalidation); | 263 Invalidate(layer_invalidation); |
| 251 } | 264 } |
| 252 | 265 |
| 253 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 266 // Shared (ie. non-invalidated) tiles on the pending tree are updated to use |
| 254 it->second->set_raster_source(raster_source); | 267 // the new raster source. When this raster source is activated, the raster |
| 268 // source will remain valid for shared tiles in the active tree. |
| 269 // TODO(danakj): Clean this up, pass it in or make it a separate function call |
| 270 // or something. |
| 271 // TODO(danakj): This breaks if we commit to active tree! We really need to do |
| 272 // this for the sync tree. |
| 273 bool set_tiles_to_raster_source = client_->GetTree() == PENDING_TREE; |
| 274 if (set_tiles_to_raster_source) { |
| 275 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 276 it->second->set_raster_source(raster_source); |
| 277 } |
| 255 VerifyLiveTilesRect(); | 278 VerifyLiveTilesRect(); |
| 256 } | 279 } |
| 257 | 280 |
| 258 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_region) { | |
| 259 bool recreate_invalidated_tiles = false; | |
| 260 DoInvalidate(layer_region, recreate_invalidated_tiles); | |
| 261 } | |
| 262 | |
| 263 void PictureLayerTiling::Invalidate(const Region& layer_region) { | 281 void PictureLayerTiling::Invalidate(const Region& layer_region) { |
| 264 bool recreate_invalidated_tiles = true; | |
| 265 DoInvalidate(layer_region, recreate_invalidated_tiles); | |
| 266 } | |
| 267 | |
| 268 void PictureLayerTiling::DoInvalidate(const Region& layer_region, | |
| 269 bool recreate_invalidated_tiles) { | |
| 270 std::vector<TileMapKey> new_tile_keys; | 282 std::vector<TileMapKey> new_tile_keys; |
| 271 gfx::Rect expanded_live_tiles_rect = | 283 gfx::Rect expanded_live_tiles_rect = |
| 272 tiling_data_.ExpandRectIgnoringBordersToTileBounds(live_tiles_rect_); | 284 tiling_data_.ExpandRectIgnoringBordersToTileBounds(live_tiles_rect_); |
| 273 for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) { | 285 for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) { |
| 274 gfx::Rect layer_rect = iter.rect(); | 286 gfx::Rect layer_rect = iter.rect(); |
| 275 gfx::Rect content_rect = | 287 gfx::Rect content_rect = |
| 276 gfx::ScaleToEnclosingRect(layer_rect, contents_scale_); | 288 gfx::ScaleToEnclosingRect(layer_rect, contents_scale_); |
| 277 // Consider tiles inside the live tiles rect even if only their border | 289 // Consider tiles inside the live tiles rect even if only their border |
| 278 // pixels intersect the invalidation. But don't consider tiles outside | 290 // pixels intersect the invalidation. But don't consider tiles outside |
| 279 // the live tiles rect with the same conditions, as they won't exist. | 291 // the live tiles rect with the same conditions, as they won't exist. |
| 280 int border_pixels = tiling_data_.border_texels(); | 292 int border_pixels = tiling_data_.border_texels(); |
| 281 content_rect.Inset(-border_pixels, -border_pixels); | 293 content_rect.Inset(-border_pixels, -border_pixels); |
| 282 // Avoid needless work by not bothering to invalidate where there aren't | 294 // Avoid needless work by not bothering to invalidate where there aren't |
| 283 // tiles. | 295 // tiles. |
| 284 content_rect.Intersect(expanded_live_tiles_rect); | 296 content_rect.Intersect(expanded_live_tiles_rect); |
| 285 if (content_rect.IsEmpty()) | 297 if (content_rect.IsEmpty()) |
| 286 continue; | 298 continue; |
| 287 // Since the content_rect includes border pixels already, don't include | 299 // Since the content_rect includes border pixels already, don't include |
| 288 // borders when iterating to avoid double counting them. | 300 // borders when iterating to avoid double counting them. |
| 289 bool include_borders = false; | 301 bool include_borders = false; |
| 290 for (TilingData::Iterator iter( | 302 for (TilingData::Iterator iter( |
| 291 &tiling_data_, content_rect, include_borders); | 303 &tiling_data_, content_rect, include_borders); |
| 292 iter; | 304 iter; |
| 293 ++iter) { | 305 ++iter) { |
| 294 // There is no recycled twin since this is run on the pending tiling. | 306 // There is no recycled twin for the peding tree during commit, or for the |
| 307 // active tree during activation. |
| 295 PictureLayerTiling* recycled_twin = NULL; | 308 PictureLayerTiling* recycled_twin = NULL; |
| 296 DCHECK_EQ(recycled_twin, client_->GetRecycledTwinTiling(this)); | 309 DCHECK_EQ(recycled_twin, client_->GetRecycledTwinTiling(this)); |
| 297 DCHECK_EQ(PENDING_TREE, client_->GetTree()); | |
| 298 if (RemoveTileAt(iter.index_x(), iter.index_y(), recycled_twin)) | 310 if (RemoveTileAt(iter.index_x(), iter.index_y(), recycled_twin)) |
| 299 new_tile_keys.push_back(iter.index()); | 311 new_tile_keys.push_back(iter.index()); |
| 300 } | 312 } |
| 301 } | 313 } |
| 302 | 314 |
| 303 if (recreate_invalidated_tiles && !new_tile_keys.empty()) { | 315 if (!new_tile_keys.empty()) { |
| 316 // During commit to the pending tree, invalidations can never be shared with |
| 317 // the active tree since the active tree has different content there. |
| 318 // However, during activation, invalidations on the active tree can be |
| 319 // shared with the pending tree always. |
| 320 const PictureLayerTiling* twin_tiling = nullptr; |
| 321 if (client_->GetTree() == ACTIVE_TREE) |
| 322 twin_tiling = client_->GetPendingOrActiveTwinTiling(this); |
| 304 for (size_t i = 0; i < new_tile_keys.size(); ++i) { | 323 for (size_t i = 0; i < new_tile_keys.size(); ++i) { |
| 305 // Don't try to share a tile with the twin layer, it's been invalidated so | |
| 306 // we have to make our own tile here. | |
| 307 const PictureLayerTiling* twin_tiling = NULL; | |
| 308 CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, twin_tiling); | 324 CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, twin_tiling); |
| 309 } | 325 } |
| 310 } | 326 } |
| 311 } | 327 } |
| 312 | 328 |
| 313 PictureLayerTiling::CoverageIterator::CoverageIterator() | 329 PictureLayerTiling::CoverageIterator::CoverageIterator() |
| 314 : tiling_(NULL), | 330 : tiling_(NULL), |
| 315 current_tile_(NULL), | 331 current_tile_(NULL), |
| 316 tile_i_(0), | 332 tile_i_(0), |
| 317 tile_j_(0), | 333 tile_j_(0), |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 eventually_rect_area, | 591 eventually_rect_area, |
| 576 gfx::Rect(tiling_size()), | 592 gfx::Rect(tiling_size()), |
| 577 &expansion_cache_); | 593 &expansion_cache_); |
| 578 | 594 |
| 579 DCHECK(eventually_rect.IsEmpty() || | 595 DCHECK(eventually_rect.IsEmpty() || |
| 580 gfx::Rect(tiling_size()).Contains(eventually_rect)) | 596 gfx::Rect(tiling_size()).Contains(eventually_rect)) |
| 581 << "tiling_size: " << tiling_size().ToString() | 597 << "tiling_size: " << tiling_size().ToString() |
| 582 << " eventually_rect: " << eventually_rect.ToString(); | 598 << " eventually_rect: " << eventually_rect.ToString(); |
| 583 | 599 |
| 584 // Calculate the soon border rect. | 600 // Calculate the soon border rect. |
| 585 content_to_screen_scale_ = ideal_contents_scale / contents_scale_; | 601 float content_to_screen_scale = ideal_contents_scale / contents_scale_; |
| 586 gfx::Rect soon_border_rect = visible_rect_in_content_space; | 602 gfx::Rect soon_border_rect = visible_rect_in_content_space; |
| 587 float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale_; | 603 float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale; |
| 588 soon_border_rect.Inset(-border, -border, -border, -border); | 604 soon_border_rect.Inset(-border, -border, -border, -border); |
| 589 | 605 |
| 590 // Update the tiling state. | |
| 591 SetLiveTilesRect(eventually_rect); | |
| 592 | |
| 593 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 606 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 594 last_viewport_in_layer_space_ = viewport_in_layer_space; | 607 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 595 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 608 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 596 | 609 |
| 597 eviction_tiles_cache_valid_ = false; | 610 SetLiveTilesRect(eventually_rect); |
| 611 UpdateTilePriorityRects( |
| 612 content_to_screen_scale, visible_rect_in_content_space, skewport, |
| 613 soon_border_rect, eventually_rect, occlusion_in_layer_space); |
| 614 } |
| 598 | 615 |
| 616 void PictureLayerTiling::UpdateTilePriorityRects( |
| 617 float content_to_screen_scale, |
| 618 const gfx::Rect& visible_rect_in_content_space, |
| 619 const gfx::Rect& skewport, |
| 620 const gfx::Rect& soon_border_rect, |
| 621 const gfx::Rect& eventually_rect, |
| 622 const Occlusion& occlusion_in_layer_space) { |
| 599 current_visible_rect_ = visible_rect_in_content_space; | 623 current_visible_rect_ = visible_rect_in_content_space; |
| 600 current_skewport_rect_ = skewport; | 624 current_skewport_rect_ = skewport; |
| 601 current_soon_border_rect_ = soon_border_rect; | 625 current_soon_border_rect_ = soon_border_rect; |
| 602 current_eventually_rect_ = eventually_rect; | 626 current_eventually_rect_ = eventually_rect; |
| 603 current_occlusion_in_layer_space_ = occlusion_in_layer_space; | 627 current_occlusion_in_layer_space_ = occlusion_in_layer_space; |
| 628 current_content_to_screen_scale_ = content_to_screen_scale; |
| 604 | 629 |
| 605 // Update has_*_tiles state. | |
| 606 gfx::Rect tiling_rect(tiling_size()); | 630 gfx::Rect tiling_rect(tiling_size()); |
| 607 | |
| 608 has_visible_rect_tiles_ = tiling_rect.Intersects(current_visible_rect_); | 631 has_visible_rect_tiles_ = tiling_rect.Intersects(current_visible_rect_); |
| 609 has_skewport_rect_tiles_ = tiling_rect.Intersects(current_skewport_rect_); | 632 has_skewport_rect_tiles_ = tiling_rect.Intersects(current_skewport_rect_); |
| 610 has_soon_border_rect_tiles_ = | 633 has_soon_border_rect_tiles_ = |
| 611 tiling_rect.Intersects(current_soon_border_rect_); | 634 tiling_rect.Intersects(current_soon_border_rect_); |
| 612 has_eventually_rect_tiles_ = tiling_rect.Intersects(current_eventually_rect_); | 635 has_eventually_rect_tiles_ = tiling_rect.Intersects(current_eventually_rect_); |
| 636 |
| 637 eviction_tiles_cache_valid_ = false; |
| 613 } | 638 } |
| 614 | 639 |
| 615 void PictureLayerTiling::SetLiveTilesRect( | 640 void PictureLayerTiling::SetLiveTilesRect( |
| 616 const gfx::Rect& new_live_tiles_rect) { | 641 const gfx::Rect& new_live_tiles_rect) { |
| 617 DCHECK(new_live_tiles_rect.IsEmpty() || | 642 DCHECK(new_live_tiles_rect.IsEmpty() || |
| 618 gfx::Rect(tiling_size()).Contains(new_live_tiles_rect)) | 643 gfx::Rect(tiling_size()).Contains(new_live_tiles_rect)) |
| 619 << "tiling_size: " << tiling_size().ToString() | 644 << "tiling_size: " << tiling_size().ToString() |
| 620 << " new_live_tiles_rect: " << new_live_tiles_rect.ToString(); | 645 << " new_live_tiles_rect: " << new_live_tiles_rect.ToString(); |
| 621 if (live_tiles_rect_ == new_live_tiles_rect) | 646 if (live_tiles_rect_ == new_live_tiles_rect) |
| 622 return; | 647 return; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 tile->set_is_occluded(tree, IsTileOccluded(tile)); | 823 tile->set_is_occluded(tree, IsTileOccluded(tile)); |
| 799 return; | 824 return; |
| 800 } | 825 } |
| 801 | 826 |
| 802 if (tree == PENDING_TREE) | 827 if (tree == PENDING_TREE) |
| 803 tile->set_required_for_activation(false); | 828 tile->set_required_for_activation(false); |
| 804 else | 829 else |
| 805 tile->set_required_for_draw(false); | 830 tile->set_required_for_draw(false); |
| 806 tile->set_is_occluded(tree, false); | 831 tile->set_is_occluded(tree, false); |
| 807 | 832 |
| 808 DCHECK_GT(content_to_screen_scale_, 0.f); | 833 DCHECK_GT(current_content_to_screen_scale_, 0.f); |
| 809 float distance_to_visible = | 834 float distance_to_visible = |
| 810 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * | 835 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * |
| 811 content_to_screen_scale_; | 836 current_content_to_screen_scale_; |
| 812 | 837 |
| 813 if (max_tile_priority_bin <= TilePriority::SOON && | 838 if (max_tile_priority_bin <= TilePriority::SOON && |
| 814 (current_soon_border_rect_.Intersects(tile_bounds) || | 839 (current_soon_border_rect_.Intersects(tile_bounds) || |
| 815 current_skewport_rect_.Intersects(tile_bounds))) { | 840 current_skewport_rect_.Intersects(tile_bounds))) { |
| 816 tile->SetPriority( | 841 tile->SetPriority( |
| 817 tree, | 842 tree, |
| 818 TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); | 843 TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); |
| 819 return; | 844 return; |
| 820 } | 845 } |
| 821 | 846 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 } | 1235 } |
| 1211 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); | 1236 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); |
| 1212 } | 1237 } |
| 1213 | 1238 |
| 1214 if (current_tile_) | 1239 if (current_tile_) |
| 1215 tiling_->UpdateTileAndTwinPriority(current_tile_); | 1240 tiling_->UpdateTileAndTwinPriority(current_tile_); |
| 1216 return *this; | 1241 return *this; |
| 1217 } | 1242 } |
| 1218 | 1243 |
| 1219 } // namespace cc | 1244 } // namespace cc |
| OLD | NEW |