| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const float kSoonBorderDistanceInScreenPixels = 312.f; | 26 const float kSoonBorderDistanceInScreenPixels = 312.f; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( | 30 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( |
| 31 float contents_scale, | 31 float contents_scale, |
| 32 const gfx::Size& layer_bounds, | 32 scoped_refptr<RasterSource> raster_source, |
| 33 PictureLayerTilingClient* client, | 33 PictureLayerTilingClient* client, |
| 34 size_t max_tiles_for_interest_area, | 34 size_t max_tiles_for_interest_area, |
| 35 float skewport_target_time_in_seconds, | 35 float skewport_target_time_in_seconds, |
| 36 int skewport_extrapolation_limit_in_content_pixels) { | 36 int skewport_extrapolation_limit_in_content_pixels) { |
| 37 return make_scoped_ptr(new PictureLayerTiling( | 37 return make_scoped_ptr(new PictureLayerTiling( |
| 38 contents_scale, layer_bounds, client, max_tiles_for_interest_area, | 38 contents_scale, raster_source, client, max_tiles_for_interest_area, |
| 39 skewport_target_time_in_seconds, | 39 skewport_target_time_in_seconds, |
| 40 skewport_extrapolation_limit_in_content_pixels)); | 40 skewport_extrapolation_limit_in_content_pixels)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 PictureLayerTiling::PictureLayerTiling( | 43 PictureLayerTiling::PictureLayerTiling( |
| 44 float contents_scale, | 44 float contents_scale, |
| 45 const gfx::Size& layer_bounds, | 45 scoped_refptr<RasterSource> raster_source, |
| 46 PictureLayerTilingClient* client, | 46 PictureLayerTilingClient* client, |
| 47 size_t max_tiles_for_interest_area, | 47 size_t max_tiles_for_interest_area, |
| 48 float skewport_target_time_in_seconds, | 48 float skewport_target_time_in_seconds, |
| 49 int skewport_extrapolation_limit_in_content_pixels) | 49 int skewport_extrapolation_limit_in_content_pixels) |
| 50 : max_tiles_for_interest_area_(max_tiles_for_interest_area), | 50 : max_tiles_for_interest_area_(max_tiles_for_interest_area), |
| 51 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), | 51 skewport_target_time_in_seconds_(skewport_target_time_in_seconds), |
| 52 skewport_extrapolation_limit_in_content_pixels_( | 52 skewport_extrapolation_limit_in_content_pixels_( |
| 53 skewport_extrapolation_limit_in_content_pixels), | 53 skewport_extrapolation_limit_in_content_pixels), |
| 54 contents_scale_(contents_scale), | 54 contents_scale_(contents_scale), |
| 55 client_(client), | 55 client_(client), |
| 56 layer_bounds_(layer_bounds), | 56 raster_source_(raster_source), |
| 57 resolution_(NON_IDEAL_RESOLUTION), | 57 resolution_(NON_IDEAL_RESOLUTION), |
| 58 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), | 58 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), |
| 59 last_impl_frame_time_in_seconds_(0.0), | 59 last_impl_frame_time_in_seconds_(0.0), |
| 60 can_require_tiles_for_activation_(false), | 60 can_require_tiles_for_activation_(false), |
| 61 current_content_to_screen_scale_(0.f), | 61 current_content_to_screen_scale_(0.f), |
| 62 has_visible_rect_tiles_(false), | 62 has_visible_rect_tiles_(false), |
| 63 has_skewport_rect_tiles_(false), | 63 has_skewport_rect_tiles_(false), |
| 64 has_soon_border_rect_tiles_(false), | 64 has_soon_border_rect_tiles_(false), |
| 65 has_eventually_rect_tiles_(false) { | 65 has_eventually_rect_tiles_(false) { |
| 66 gfx::Size content_bounds = | 66 DCHECK(!raster_source->IsSolidColor()); |
| 67 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); | 67 gfx::Size content_bounds = gfx::ToCeiledSize( |
| 68 gfx::ScaleSize(raster_source_->GetSize(), contents_scale)); |
| 68 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 69 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
| 69 if (tile_size.IsEmpty()) { | |
| 70 layer_bounds_ = gfx::Size(); | |
| 71 content_bounds = gfx::Size(); | |
| 72 } | |
| 73 | 70 |
| 74 DCHECK(!gfx::ToFlooredSize( | 71 DCHECK(!gfx::ToFlooredSize(gfx::ScaleSize(raster_source_->GetSize(), |
| 75 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) << | 72 contents_scale)).IsEmpty()) |
| 76 "Tiling created with scale too small as contents become empty." << | 73 << "Tiling created with scale too small as contents become empty." |
| 77 " Layer bounds: " << layer_bounds.ToString() << | 74 << " Layer bounds: " << raster_source_->GetSize().ToString() |
| 78 " Contents scale: " << contents_scale; | 75 << " Contents scale: " << contents_scale; |
| 79 | 76 |
| 80 tiling_data_.SetTilingSize(content_bounds); | 77 tiling_data_.SetTilingSize(content_bounds); |
| 81 tiling_data_.SetMaxTextureSize(tile_size); | 78 tiling_data_.SetMaxTextureSize(tile_size); |
| 82 } | 79 } |
| 83 | 80 |
| 84 PictureLayerTiling::~PictureLayerTiling() { | 81 PictureLayerTiling::~PictureLayerTiling() { |
| 85 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 82 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 86 it->second->set_shared(false); | 83 it->second->set_shared(false); |
| 87 } | 84 } |
| 88 | 85 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 112 DCHECK(!candidate_tile->is_shared()); | 109 DCHECK(!candidate_tile->is_shared()); |
| 113 DCHECK_EQ(i, candidate_tile->tiling_i_index()); | 110 DCHECK_EQ(i, candidate_tile->tiling_i_index()); |
| 114 DCHECK_EQ(j, candidate_tile->tiling_j_index()); | 111 DCHECK_EQ(j, candidate_tile->tiling_j_index()); |
| 115 candidate_tile->set_shared(true); | 112 candidate_tile->set_shared(true); |
| 116 tiles_[key] = candidate_tile; | 113 tiles_[key] = candidate_tile; |
| 117 return candidate_tile; | 114 return candidate_tile; |
| 118 } | 115 } |
| 119 } | 116 } |
| 120 } | 117 } |
| 121 | 118 |
| 119 if (!raster_source_->CoversRect(tile_rect, contents_scale_)) |
| 120 return nullptr; |
| 121 |
| 122 // Create a new tile because our twin didn't have a valid one. | 122 // Create a new tile because our twin didn't have a valid one. |
| 123 scoped_refptr<Tile> tile = client_->CreateTile(this, tile_rect); | 123 scoped_refptr<Tile> tile = client_->CreateTile(contents_scale_, tile_rect); |
| 124 if (tile.get()) { | 124 DCHECK(!tile->is_shared()); |
| 125 DCHECK(!tile->is_shared()); | 125 tile->set_tiling_index(i, j); |
| 126 tile->set_tiling_index(i, j); | 126 tiles_[key] = tile; |
| 127 tiles_[key] = tile; | |
| 128 | 127 |
| 129 if (recycled_twin) { | 128 if (recycled_twin) { |
| 130 DCHECK(recycled_twin->tiles_.find(key) == recycled_twin->tiles_.end()); | 129 DCHECK(recycled_twin->tiles_.find(key) == recycled_twin->tiles_.end()); |
| 131 // Do what recycled_twin->CreateTile() would do. | 130 // Do what recycled_twin->CreateTile() would do. |
| 132 tile->set_shared(true); | 131 tile->set_shared(true); |
| 133 recycled_twin->tiles_[key] = tile; | 132 recycled_twin->tiles_[key] = tile; |
| 134 } | |
| 135 } | 133 } |
| 136 return tile.get(); | 134 return tile.get(); |
| 137 } | 135 } |
| 138 | 136 |
| 139 void PictureLayerTiling::CreateMissingTilesInLiveTilesRect() { | 137 void PictureLayerTiling::CreateMissingTilesInLiveTilesRect() { |
| 140 const PictureLayerTiling* twin_tiling = | 138 const PictureLayerTiling* twin_tiling = |
| 141 client_->GetPendingOrActiveTwinTiling(this); | 139 client_->GetPendingOrActiveTwinTiling(this); |
| 142 // There is no recycled twin during commit from the main thread which is when | 140 // There is no recycled twin during commit from the main thread which is when |
| 143 // this occurs. | 141 // this occurs. |
| 144 PictureLayerTiling* null_recycled_twin = nullptr; | 142 PictureLayerTiling* null_recycled_twin = nullptr; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 155 CreateTile(key.first, key.second, twin_tiling, null_recycled_twin); | 153 CreateTile(key.first, key.second, twin_tiling, null_recycled_twin); |
| 156 } | 154 } |
| 157 | 155 |
| 158 VerifyLiveTilesRect(false); | 156 VerifyLiveTilesRect(false); |
| 159 } | 157 } |
| 160 | 158 |
| 161 void PictureLayerTiling::CloneTilesAndPropertiesFrom( | 159 void PictureLayerTiling::CloneTilesAndPropertiesFrom( |
| 162 const PictureLayerTiling& twin_tiling) { | 160 const PictureLayerTiling& twin_tiling) { |
| 163 DCHECK_EQ(&twin_tiling, client_->GetPendingOrActiveTwinTiling(this)); | 161 DCHECK_EQ(&twin_tiling, client_->GetPendingOrActiveTwinTiling(this)); |
| 164 | 162 |
| 165 Resize(twin_tiling.layer_bounds_); | 163 SetRasterSourceAndResize(twin_tiling.raster_source_); |
| 166 DCHECK_EQ(twin_tiling.contents_scale_, contents_scale_); | 164 DCHECK_EQ(twin_tiling.contents_scale_, contents_scale_); |
| 167 DCHECK_EQ(twin_tiling.layer_bounds().ToString(), layer_bounds().ToString()); | 165 DCHECK_EQ(twin_tiling.raster_source_, raster_source_); |
| 168 DCHECK_EQ(twin_tiling.tile_size().ToString(), tile_size().ToString()); | 166 DCHECK_EQ(twin_tiling.tile_size().ToString(), tile_size().ToString()); |
| 169 | 167 |
| 170 resolution_ = twin_tiling.resolution_; | 168 resolution_ = twin_tiling.resolution_; |
| 171 | 169 |
| 172 SetLiveTilesRect(twin_tiling.live_tiles_rect()); | 170 SetLiveTilesRect(twin_tiling.live_tiles_rect()); |
| 173 | 171 |
| 174 // Recreate unshared tiles. | 172 // Recreate unshared tiles. |
| 175 std::vector<TileMapKey> to_remove; | 173 std::vector<TileMapKey> to_remove; |
| 176 for (const auto& tile_map_pair : tiles_) { | 174 for (const auto& tile_map_pair : tiles_) { |
| 177 TileMapKey key = tile_map_pair.first; | 175 TileMapKey key = tile_map_pair.first; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 204 #endif | 202 #endif |
| 205 | 203 |
| 206 UpdateTilePriorityRects(twin_tiling.current_content_to_screen_scale_, | 204 UpdateTilePriorityRects(twin_tiling.current_content_to_screen_scale_, |
| 207 twin_tiling.current_visible_rect_, | 205 twin_tiling.current_visible_rect_, |
| 208 twin_tiling.current_skewport_rect_, | 206 twin_tiling.current_skewport_rect_, |
| 209 twin_tiling.current_soon_border_rect_, | 207 twin_tiling.current_soon_border_rect_, |
| 210 twin_tiling.current_eventually_rect_, | 208 twin_tiling.current_eventually_rect_, |
| 211 twin_tiling.current_occlusion_in_layer_space_); | 209 twin_tiling.current_occlusion_in_layer_space_); |
| 212 } | 210 } |
| 213 | 211 |
| 214 void PictureLayerTiling::Resize(const gfx::Size& new_layer_bounds) { | 212 void PictureLayerTiling::SetRasterSourceAndResize( |
| 215 gfx::Size layer_bounds = new_layer_bounds; | 213 scoped_refptr<RasterSource> raster_source) { |
| 214 DCHECK(!raster_source->IsSolidColor()); |
| 215 gfx::Size old_layer_bounds = raster_source_->GetSize(); |
| 216 raster_source_.swap(raster_source); |
| 217 gfx::Size new_layer_bounds = raster_source_->GetSize(); |
| 216 gfx::Size content_bounds = | 218 gfx::Size content_bounds = |
| 217 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); | 219 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); |
| 218 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 220 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
| 219 | 221 |
| 220 if (tile_size.IsEmpty()) { | |
| 221 layer_bounds = gfx::Size(); | |
| 222 content_bounds = gfx::Size(); | |
| 223 } | |
| 224 | |
| 225 // The layer bounds are only allowed to be empty when the tile size is empty. | |
| 226 // Otherwise we should not have such a tiling in the first place. | |
| 227 DCHECK_IMPLIES(!tile_size.IsEmpty(), !layer_bounds_.IsEmpty()); | |
| 228 | |
| 229 bool resized = layer_bounds != layer_bounds_; | |
| 230 layer_bounds_ = layer_bounds; | |
| 231 | |
| 232 if (tile_size != tiling_data_.max_texture_size()) { | 222 if (tile_size != tiling_data_.max_texture_size()) { |
| 233 tiling_data_.SetTilingSize(content_bounds); | 223 tiling_data_.SetTilingSize(content_bounds); |
| 234 tiling_data_.SetMaxTextureSize(tile_size); | 224 tiling_data_.SetMaxTextureSize(tile_size); |
| 235 // When the tile size changes, the TilingData positions no longer work | 225 // When the tile size changes, the TilingData positions no longer work |
| 236 // as valid keys to the TileMap, so just drop all tiles and clear the live | 226 // as valid keys to the TileMap, so just drop all tiles and clear the live |
| 237 // tiles rect. | 227 // tiles rect. |
| 238 Reset(); | 228 Reset(); |
| 239 return; | 229 return; |
| 240 } | 230 } |
| 241 | 231 |
| 242 if (!resized) | 232 if (old_layer_bounds == new_layer_bounds) |
| 243 return; | 233 return; |
| 244 | 234 |
| 245 // The SetLiveTilesRect() method would drop tiles outside the new bounds, | 235 // The SetLiveTilesRect() method would drop tiles outside the new bounds, |
| 246 // but may do so incorrectly if resizing the tiling causes the number of | 236 // but may do so incorrectly if resizing the tiling causes the number of |
| 247 // tiles in the tiling_data_ to change. | 237 // tiles in the tiling_data_ to change. |
| 248 gfx::Rect content_rect(content_bounds); | 238 gfx::Rect content_rect(content_bounds); |
| 249 int before_left = tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.x()); | 239 int before_left = tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.x()); |
| 250 int before_top = tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.y()); | 240 int before_top = tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.y()); |
| 251 int before_right = | 241 int before_right = |
| 252 tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.right() - 1); | 242 tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.right() - 1); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 const PictureLayerTiling* null_twin_tiling = nullptr; | 333 const PictureLayerTiling* null_twin_tiling = nullptr; |
| 344 PictureLayerTiling* null_recycled_twin = nullptr; | 334 PictureLayerTiling* null_recycled_twin = nullptr; |
| 345 DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this)); | 335 DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this)); |
| 346 for (size_t i = 0; i < new_tile_keys.size(); ++i) { | 336 for (size_t i = 0; i < new_tile_keys.size(); ++i) { |
| 347 CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, | 337 CreateTile(new_tile_keys[i].first, new_tile_keys[i].second, |
| 348 null_twin_tiling, null_recycled_twin); | 338 null_twin_tiling, null_recycled_twin); |
| 349 } | 339 } |
| 350 } | 340 } |
| 351 } | 341 } |
| 352 | 342 |
| 353 void PictureLayerTiling::SetRasterSource( | 343 void PictureLayerTiling::SetRasterSourceOnTiles() { |
| 354 scoped_refptr<RasterSource> raster_source) { | |
| 355 // Shared (ie. non-invalidated) tiles on the pending tree are updated to use | 344 // Shared (ie. non-invalidated) tiles on the pending tree are updated to use |
| 356 // the new raster source. When this raster source is activated, the raster | 345 // the new raster source. When this raster source is activated, the raster |
| 357 // source will remain valid for shared tiles in the active tree. | 346 // source will remain valid for shared tiles in the active tree. |
| 358 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 347 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 359 it->second->set_raster_source(raster_source); | 348 it->second->set_raster_source(raster_source_); |
| 360 VerifyLiveTilesRect(false); | 349 VerifyLiveTilesRect(false); |
| 361 } | 350 } |
| 362 | 351 |
| 363 PictureLayerTiling::CoverageIterator::CoverageIterator() | 352 PictureLayerTiling::CoverageIterator::CoverageIterator() |
| 364 : tiling_(NULL), | 353 : tiling_(NULL), |
| 365 current_tile_(NULL), | 354 current_tile_(NULL), |
| 366 tile_i_(0), | 355 tile_i_(0), |
| 367 tile_j_(0), | 356 tile_j_(0), |
| 368 left_(0), | 357 left_(0), |
| 369 top_(0), | 358 top_(0), |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 extrapolation_multiplier * (old_bottom - new_bottom)); | 563 extrapolation_multiplier * (old_bottom - new_bottom)); |
| 575 | 564 |
| 576 // Clip the skewport to |max_skewport|. | 565 // Clip the skewport to |max_skewport|. |
| 577 skewport.Intersect(max_skewport); | 566 skewport.Intersect(max_skewport); |
| 578 | 567 |
| 579 // Finally, ensure that visible rect is contained in the skewport. | 568 // Finally, ensure that visible rect is contained in the skewport. |
| 580 skewport.Union(visible_rect_in_content_space); | 569 skewport.Union(visible_rect_in_content_space); |
| 581 return skewport; | 570 return skewport; |
| 582 } | 571 } |
| 583 | 572 |
| 584 void PictureLayerTiling::ComputeTilePriorityRects( | 573 bool PictureLayerTiling::ComputeTilePriorityRects( |
| 585 const gfx::Rect& viewport_in_layer_space, | 574 const gfx::Rect& viewport_in_layer_space, |
| 586 float ideal_contents_scale, | 575 float ideal_contents_scale, |
| 587 double current_frame_time_in_seconds, | 576 double current_frame_time_in_seconds, |
| 588 const Occlusion& occlusion_in_layer_space) { | 577 const Occlusion& occlusion_in_layer_space) { |
| 589 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, | 578 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, |
| 590 viewport_in_layer_space)) { | 579 viewport_in_layer_space)) { |
| 591 // This should never be zero for the purposes of has_ever_been_updated(). | 580 // This should never be zero for the purposes of has_ever_been_updated(). |
| 592 DCHECK_NE(current_frame_time_in_seconds, 0.0); | 581 DCHECK_NE(current_frame_time_in_seconds, 0.0); |
| 593 return; | 582 return false; |
| 594 } | 583 } |
| 595 | 584 |
| 596 gfx::Rect visible_rect_in_content_space = | 585 gfx::Rect visible_rect_in_content_space = |
| 597 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); | 586 gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_); |
| 598 | 587 |
| 599 if (tiling_size().IsEmpty()) { | 588 if (tiling_size().IsEmpty()) { |
| 600 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 589 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 601 last_viewport_in_layer_space_ = viewport_in_layer_space; | 590 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 602 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 591 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 603 return; | 592 return false; |
| 604 } | 593 } |
| 605 | 594 |
| 606 // Calculate the skewport. | 595 // Calculate the skewport. |
| 607 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, | 596 gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, |
| 608 visible_rect_in_content_space); | 597 visible_rect_in_content_space); |
| 609 DCHECK(skewport.Contains(visible_rect_in_content_space)); | 598 DCHECK(skewport.Contains(visible_rect_in_content_space)); |
| 610 | 599 |
| 611 // Calculate the eventually/live tiles rect. | 600 // Calculate the eventually/live tiles rect. |
| 612 gfx::Size tile_size = tiling_data_.max_texture_size(); | 601 gfx::Size tile_size = tiling_data_.max_texture_size(); |
| 613 int64 eventually_rect_area = | 602 int64 eventually_rect_area = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 631 soon_border_rect.Inset(-border, -border, -border, -border); | 620 soon_border_rect.Inset(-border, -border, -border, -border); |
| 632 | 621 |
| 633 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; | 622 last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; |
| 634 last_viewport_in_layer_space_ = viewport_in_layer_space; | 623 last_viewport_in_layer_space_ = viewport_in_layer_space; |
| 635 last_visible_rect_in_content_space_ = visible_rect_in_content_space; | 624 last_visible_rect_in_content_space_ = visible_rect_in_content_space; |
| 636 | 625 |
| 637 SetLiveTilesRect(eventually_rect); | 626 SetLiveTilesRect(eventually_rect); |
| 638 UpdateTilePriorityRects( | 627 UpdateTilePriorityRects( |
| 639 content_to_screen_scale, visible_rect_in_content_space, skewport, | 628 content_to_screen_scale, visible_rect_in_content_space, skewport, |
| 640 soon_border_rect, eventually_rect, occlusion_in_layer_space); | 629 soon_border_rect, eventually_rect, occlusion_in_layer_space); |
| 630 return true; |
| 641 } | 631 } |
| 642 | 632 |
| 643 void PictureLayerTiling::UpdateTilePriorityRects( | 633 void PictureLayerTiling::UpdateTilePriorityRects( |
| 644 float content_to_screen_scale, | 634 float content_to_screen_scale, |
| 645 const gfx::Rect& visible_rect_in_content_space, | 635 const gfx::Rect& visible_rect_in_content_space, |
| 646 const gfx::Rect& skewport, | 636 const gfx::Rect& skewport, |
| 647 const gfx::Rect& soon_border_rect, | 637 const gfx::Rect& soon_border_rect, |
| 648 const gfx::Rect& eventually_rect, | 638 const gfx::Rect& eventually_rect, |
| 649 const Occlusion& occlusion_in_layer_space) { | 639 const Occlusion& occlusion_in_layer_space) { |
| 650 current_visible_rect_ = visible_rect_in_content_space; | 640 current_visible_rect_ = visible_rect_in_content_space; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 return false; | 762 return false; |
| 773 | 763 |
| 774 if (client_->RequiresHighResToDraw()) | 764 if (client_->RequiresHighResToDraw()) |
| 775 return true; | 765 return true; |
| 776 | 766 |
| 777 const PictureLayerTiling* twin_tiling = | 767 const PictureLayerTiling* twin_tiling = |
| 778 client_->GetPendingOrActiveTwinTiling(this); | 768 client_->GetPendingOrActiveTwinTiling(this); |
| 779 if (!twin_tiling) | 769 if (!twin_tiling) |
| 780 return true; | 770 return true; |
| 781 | 771 |
| 782 if (twin_tiling->layer_bounds() != layer_bounds()) | 772 if (twin_tiling->raster_source()->GetSize() != raster_source()->GetSize()) |
| 783 return true; | 773 return true; |
| 784 | 774 |
| 785 if (twin_tiling->current_visible_rect_ != current_visible_rect_) | 775 if (twin_tiling->current_visible_rect_ != current_visible_rect_) |
| 786 return true; | 776 return true; |
| 787 | 777 |
| 788 Tile* twin_tile = | 778 Tile* twin_tile = |
| 789 twin_tiling->TileAt(tile->tiling_i_index(), tile->tiling_j_index()); | 779 twin_tiling->TileAt(tile->tiling_i_index(), tile->tiling_j_index()); |
| 790 // If twin tile is missing, it might not have a recording, so we don't need | 780 // If twin tile is missing, it might not have a recording, so we don't need |
| 791 // this tile to be required for activation. | 781 // this tile to be required for activation. |
| 792 if (!twin_tile) | 782 if (!twin_tile) |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 } | 1170 } |
| 1181 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); | 1171 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); |
| 1182 } | 1172 } |
| 1183 | 1173 |
| 1184 if (current_tile_) | 1174 if (current_tile_) |
| 1185 tiling_->UpdateTileAndTwinPriority(current_tile_); | 1175 tiling_->UpdateTileAndTwinPriority(current_tile_); |
| 1186 return *this; | 1176 return *this; |
| 1187 } | 1177 } |
| 1188 | 1178 |
| 1189 } // namespace cc | 1179 } // namespace cc |
| OLD | NEW |