Chromium Code Reviews| 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 if (!tiling_needs_update) | 332 if (!tiling_needs_update) |
| 333 return; | 333 return; |
| 334 | 334 |
| 335 UpdateLCDTextStatus(can_use_lcd_text()); | 335 UpdateLCDTextStatus(can_use_lcd_text()); |
| 336 | 336 |
| 337 gfx::Transform current_screen_space_transform = screen_space_transform(); | 337 gfx::Transform current_screen_space_transform = screen_space_transform(); |
| 338 | 338 |
| 339 gfx::Size viewport_size = layer_tree_impl()->DrawViewportSize(); | 339 gfx::Size viewport_size = layer_tree_impl()->DrawViewportSize(); |
| 340 gfx::Rect viewport_in_content_space; | 340 gfx::Rect viewport_in_content_space; |
| 341 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); | 341 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); |
| 342 if (screen_space_transform().GetInverse(&screen_to_layer)) { | 342 if (screen_space_transform().GetInverse(&screen_to_layer)) { |
|
enne (OOO)
2014/01/31 23:33:36
Maybe we only need this projection if the viewport
vmpstr
2014/02/03 20:27:24
Done.
| |
| 343 viewport_in_content_space = | 343 viewport_in_content_space = |
| 344 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 344 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
| 345 screen_to_layer, gfx::Rect(viewport_size))); | 345 screen_to_layer, gfx::Rect(viewport_size))); |
| 346 } | 346 } |
| 347 | 347 |
| 348 WhichTree tree = | 348 WhichTree tree = |
| 349 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 349 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 350 size_t max_tiles_for_interest_area = | 350 size_t max_tiles_for_interest_area = |
| 351 layer_tree_impl()->settings().max_tiles_for_interest_area; | 351 layer_tree_impl()->settings().max_tiles_for_interest_area; |
| 352 tilings_->UpdateTilePriorities( | 352 tilings_->UpdateTilePriorities( |
| 353 tree, | 353 tree, |
| 354 viewport_size, | |
| 355 viewport_in_content_space, | 354 viewport_in_content_space, |
| 356 visible_content_rect(), | 355 visible_content_rect(), |
| 357 last_bounds_, | |
| 358 bounds(), | |
| 359 last_content_scale_, | |
| 360 contents_scale_x(), | 356 contents_scale_x(), |
| 361 last_screen_space_transform_, | |
| 362 current_screen_space_transform, | |
| 363 current_frame_time_in_seconds, | 357 current_frame_time_in_seconds, |
| 364 max_tiles_for_interest_area); | 358 max_tiles_for_interest_area); |
| 365 | 359 |
| 366 if (layer_tree_impl()->IsPendingTree()) | 360 if (layer_tree_impl()->IsPendingTree()) |
| 367 MarkVisibleResourcesAsRequired(); | 361 MarkVisibleResourcesAsRequired(); |
| 368 | 362 |
| 369 last_screen_space_transform_ = current_screen_space_transform; | 363 last_screen_space_transform_ = current_screen_space_transform; |
|
enne (OOO)
2014/01/31 23:33:36
Do we need this still?
vmpstr
2014/02/03 20:27:24
Nope. Removed.
| |
| 370 last_bounds_ = bounds(); | 364 last_bounds_ = bounds(); |
| 371 last_content_scale_ = contents_scale_x(); | 365 last_content_scale_ = contents_scale_x(); |
| 372 | 366 |
| 373 // Tile priorities were modified. | 367 // Tile priorities were modified. |
| 374 layer_tree_impl()->DidModifyTilePriorities(); | 368 layer_tree_impl()->DidModifyTilePriorities(); |
| 375 } | 369 } |
| 376 | 370 |
| 377 void PictureLayerImpl::DidBecomeActive() { | 371 void PictureLayerImpl::DidBecomeActive() { |
| 378 LayerImpl::DidBecomeActive(); | 372 LayerImpl::DidBecomeActive(); |
| 379 tilings_->DidBecomeActive(); | 373 tilings_->DidBecomeActive(); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 contents_scale_x(), | 713 contents_scale_x(), |
| 720 rect); | 714 rect); |
| 721 iter; | 715 iter; |
| 722 ++iter) { | 716 ++iter) { |
| 723 if (!*iter || !iter->IsReadyToDraw()) | 717 if (!*iter || !iter->IsReadyToDraw()) |
| 724 continue; | 718 continue; |
| 725 | 719 |
| 726 // This iteration is over the visible content rect which is potentially | 720 // This iteration is over the visible content rect which is potentially |
| 727 // less conservative than projecting the viewport into the layer. | 721 // less conservative than projecting the viewport into the layer. |
| 728 // Ignore tiles that are know to be outside the viewport. | 722 // Ignore tiles that are know to be outside the viewport. |
| 729 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) | 723 if (iter->priority(PENDING_TREE).distance_to_visible != 0) |
|
enne (OOO)
2014/01/31 23:33:36
I think this can go away as we only mark tiles in
vmpstr
2014/02/03 20:27:24
Good point. Done.
| |
| 730 continue; | 724 continue; |
| 731 | 725 |
| 732 missing_region.Subtract(iter.geometry_rect()); | 726 missing_region.Subtract(iter.geometry_rect()); |
| 733 iter->MarkRequiredForActivation(); | 727 iter->MarkRequiredForActivation(); |
| 734 } | 728 } |
| 735 } | 729 } |
| 736 DCHECK(high_res) << "There must be one high res tiling"; | 730 DCHECK(high_res) << "There must be one high res tiling"; |
| 737 | 731 |
| 738 // If these pointers are null (because no twin, no matching tiling, or the | 732 // If these pointers are null (because no twin, no matching tiling, or the |
| 739 // simpification just below), then high res tiles will be required to fill any | 733 // simpification just below), then high res tiles will be required to fill any |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 iter; | 782 iter; |
| 789 ++iter) { | 783 ++iter) { |
| 790 Tile* tile = *iter; | 784 Tile* tile = *iter; |
| 791 // A null tile (i.e. missing recording) can just be skipped. | 785 // A null tile (i.e. missing recording) can just be skipped. |
| 792 if (!tile) | 786 if (!tile) |
| 793 continue; | 787 continue; |
| 794 | 788 |
| 795 // This iteration is over the visible content rect which is potentially | 789 // This iteration is over the visible content rect which is potentially |
| 796 // less conservative than projecting the viewport into the layer. | 790 // less conservative than projecting the viewport into the layer. |
| 797 // Ignore tiles that are know to be outside the viewport. | 791 // Ignore tiles that are know to be outside the viewport. |
| 798 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) | 792 if (tile->priority(PENDING_TREE).distance_to_visible != 0) |
| 799 continue; | 793 continue; |
| 800 | 794 |
| 801 // If the missing region doesn't cover it, this tile is fully | 795 // If the missing region doesn't cover it, this tile is fully |
| 802 // covered by acceptable tiles at other scales. | 796 // covered by acceptable tiles at other scales. |
| 803 if (!missing_region.Intersects(iter.geometry_rect())) | 797 if (!missing_region.Intersects(iter.geometry_rect())) |
| 804 continue; | 798 continue; |
| 805 | 799 |
| 806 // If the twin tile doesn't exist (i.e. missing recording or so far away | 800 // If the twin tile doesn't exist (i.e. missing recording or so far away |
| 807 // that it is outside the visible tile rect) or this tile is shared between | 801 // that it is outside the visible tile rect) or this tile is shared between |
| 808 // with the twin, then this tile isn't required to prevent flashing. | 802 // with the twin, then this tile isn't required to prevent flashing. |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1225 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
| 1232 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1226 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
| 1233 return tilings_->GPUMemoryUsageInBytes(); | 1227 return tilings_->GPUMemoryUsageInBytes(); |
| 1234 } | 1228 } |
| 1235 | 1229 |
| 1236 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1230 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1237 benchmark->RunOnLayer(this); | 1231 benchmark->RunOnLayer(this); |
| 1238 } | 1232 } |
| 1239 | 1233 |
| 1240 } // namespace cc | 1234 } // namespace cc |
| OLD | NEW |