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/debug/trace_event_argument.h" | 10 #include "base/debug/trace_event_argument.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 LayerTreeImpl* tree_impl) { | 89 LayerTreeImpl* tree_impl) { |
| 90 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 90 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { | 93 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
| 94 // It's possible this layer was never drawn or updated (e.g. because it was | 94 // It's possible this layer was never drawn or updated (e.g. because it was |
| 95 // a descendant of an opacity 0 layer). | 95 // a descendant of an opacity 0 layer). |
| 96 DoPostCommitInitializationIfNeeded(); | 96 DoPostCommitInitializationIfNeeded(); |
| 97 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 97 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| 98 | 98 |
| 99 // We have already synced the important bits from the the active layer, and | |
| 100 // we will soon swap out its tilings and use them for recycling. However, | |
| 101 // there are now tiles in this layer's tilings that were unref'd and replaced | |
| 102 // with new tiles (due to invalidation). This resets all active priorities on | |
| 103 // the to-be-recycled tiling to ensure replaced tiles don't linger and take | |
| 104 // memory (due to a stale 'active' priority). | |
| 105 if (layer_impl->tilings_) | |
| 106 layer_impl->tilings_->DidBecomeRecycled(); | |
| 107 | |
| 108 LayerImpl::PushPropertiesTo(base_layer); | 99 LayerImpl::PushPropertiesTo(base_layer); |
| 109 | 100 |
| 110 // When the pending tree pushes to the active tree, the pending twin | 101 // When the pending tree pushes to the active tree, the pending twin |
| 111 // disappears. | 102 // disappears. |
| 112 layer_impl->twin_layer_ = NULL; | 103 layer_impl->twin_layer_ = NULL; |
| 113 twin_layer_ = NULL; | 104 twin_layer_ = NULL; |
| 114 | 105 |
| 115 layer_impl->SetIsMask(is_mask_); | 106 layer_impl->SetIsMask(is_mask_); |
| 116 layer_impl->pile_ = pile_; | 107 layer_impl->pile_ = pile_; |
| 117 | 108 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 float width; | 214 float width; |
| 224 if (*iter && iter->IsReadyToDraw()) { | 215 if (*iter && iter->IsReadyToDraw()) { |
| 225 ManagedTileState::TileVersion::Mode mode = | 216 ManagedTileState::TileVersion::Mode mode = |
| 226 iter->GetTileVersionForDrawing().mode(); | 217 iter->GetTileVersionForDrawing().mode(); |
| 227 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 218 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
| 228 color = DebugColors::SolidColorTileBorderColor(); | 219 color = DebugColors::SolidColorTileBorderColor(); |
| 229 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 220 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
| 230 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 221 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
| 231 color = DebugColors::PictureTileBorderColor(); | 222 color = DebugColors::PictureTileBorderColor(); |
| 232 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 223 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
| 233 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { | 224 } else if (iter.resolution() == HIGH_RESOLUTION) { |
| 234 color = DebugColors::HighResTileBorderColor(); | 225 color = DebugColors::HighResTileBorderColor(); |
| 235 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 226 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
| 236 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { | 227 } else if (iter.resolution() == LOW_RESOLUTION) { |
| 237 color = DebugColors::LowResTileBorderColor(); | 228 color = DebugColors::LowResTileBorderColor(); |
| 238 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 229 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
| 239 } else if (iter->contents_scale() > max_contents_scale) { | 230 } else if (iter->contents_scale() > max_contents_scale) { |
| 240 color = DebugColors::ExtraHighResTileBorderColor(); | 231 color = DebugColors::ExtraHighResTileBorderColor(); |
| 241 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 232 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
| 242 } else { | 233 } else { |
| 243 color = DebugColors::ExtraLowResTileBorderColor(); | 234 color = DebugColors::ExtraLowResTileBorderColor(); |
| 244 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 235 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
| 245 } | 236 } |
| 246 } else { | 237 } else { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 false); | 355 false); |
| 365 } | 356 } |
| 366 | 357 |
| 367 append_quads_data->num_missing_tiles++; | 358 append_quads_data->num_missing_tiles++; |
| 368 append_quads_data->approximated_visible_content_area += | 359 append_quads_data->approximated_visible_content_area += |
| 369 visible_geometry_rect.width() * visible_geometry_rect.height(); | 360 visible_geometry_rect.width() * visible_geometry_rect.height(); |
| 370 ++missing_tile_count; | 361 ++missing_tile_count; |
| 371 continue; | 362 continue; |
| 372 } | 363 } |
| 373 | 364 |
| 374 if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) { | 365 if (iter.resolution() != HIGH_RESOLUTION) { |
| 375 append_quads_data->approximated_visible_content_area += | 366 append_quads_data->approximated_visible_content_area += |
| 376 visible_geometry_rect.width() * visible_geometry_rect.height(); | 367 visible_geometry_rect.width() * visible_geometry_rect.height(); |
| 377 } | 368 } |
| 378 | 369 |
| 379 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) | 370 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) |
| 380 seen_tilings.push_back(iter.CurrentTiling()); | 371 seen_tilings.push_back(iter.CurrentTiling()); |
| 381 } | 372 } |
| 382 | 373 |
| 383 if (missing_tile_count) { | 374 if (missing_tile_count) { |
| 384 TRACE_EVENT_INSTANT2("cc", | 375 TRACE_EVENT_INSTANT2("cc", |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 DCHECK(raster_source_scale_); | 432 DCHECK(raster_source_scale_); |
| 442 DCHECK(raster_contents_scale_); | 433 DCHECK(raster_contents_scale_); |
| 443 DCHECK(low_res_raster_contents_scale_); | 434 DCHECK(low_res_raster_contents_scale_); |
| 444 | 435 |
| 445 was_screen_space_transform_animating_ = | 436 was_screen_space_transform_animating_ = |
| 446 draw_properties().screen_space_transform_is_animating; | 437 draw_properties().screen_space_transform_is_animating; |
| 447 | 438 |
| 448 should_update_tile_priorities_ = true; | 439 should_update_tile_priorities_ = true; |
| 449 | 440 |
| 450 UpdateTilePriorities(occlusion_tracker); | 441 UpdateTilePriorities(occlusion_tracker); |
| 451 | |
| 452 if (layer_tree_impl()->IsPendingTree()) | |
| 453 MarkVisibleResourcesAsRequired(); | |
| 454 } | 442 } |
| 455 | 443 |
| 456 void PictureLayerImpl::UpdateTilePriorities( | 444 void PictureLayerImpl::UpdateTilePriorities( |
| 457 const OcclusionTracker<LayerImpl>* occlusion_tracker) { | 445 const OcclusionTracker<LayerImpl>* occlusion_tracker) { |
| 458 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 446 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
| 459 | 447 |
| 460 double current_frame_time_in_seconds = | 448 double current_frame_time_in_seconds = |
| 461 (layer_tree_impl()->CurrentFrameTimeTicks() - | 449 (layer_tree_impl()->CurrentFrameTimeTicks() - |
| 462 base::TimeTicks()).InSecondsF(); | 450 base::TimeTicks()).InSecondsF(); |
| 463 | 451 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 501 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
| 514 if (layer_tree_impl()->IsActiveTree()) { | 502 if (layer_tree_impl()->IsActiveTree()) { |
| 515 gfx::RectF layer_damage_rect = | 503 gfx::RectF layer_damage_rect = |
| 516 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); | 504 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); |
| 517 AddDamageRect(layer_damage_rect); | 505 AddDamageRect(layer_damage_rect); |
| 518 } | 506 } |
| 519 } | 507 } |
| 520 | 508 |
| 521 void PictureLayerImpl::DidBecomeActive() { | 509 void PictureLayerImpl::DidBecomeActive() { |
| 522 LayerImpl::DidBecomeActive(); | 510 LayerImpl::DidBecomeActive(); |
| 523 tilings_->DidBecomeActive(); | |
| 524 layer_tree_impl()->DidModifyTilePriorities(); | 511 layer_tree_impl()->DidModifyTilePriorities(); |
| 525 } | 512 } |
| 526 | 513 |
| 527 void PictureLayerImpl::DidBeginTracing() { | 514 void PictureLayerImpl::DidBeginTracing() { |
| 528 pile_->DidBeginTracing(); | 515 pile_->DidBeginTracing(); |
| 529 } | 516 } |
| 530 | 517 |
| 531 void PictureLayerImpl::ReleaseResources() { | 518 void PictureLayerImpl::ReleaseResources() { |
| 532 if (tilings_) | 519 if (tilings_) |
| 533 RemoveAllTilings(); | 520 RemoveAllTilings(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * | 586 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * |
| 600 layer_tree_impl()->settings().skewport_target_time_multiplier; | 587 layer_tree_impl()->settings().skewport_target_time_multiplier; |
| 601 } | 588 } |
| 602 | 589 |
| 603 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { | 590 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { |
| 604 return layer_tree_impl() | 591 return layer_tree_impl() |
| 605 ->settings() | 592 ->settings() |
| 606 .skewport_extrapolation_limit_in_content_pixels; | 593 .skewport_extrapolation_limit_in_content_pixels; |
| 607 } | 594 } |
| 608 | 595 |
| 596 bool PictureLayerImpl::RequiresHighResToDraw() const { | |
| 597 const PictureLayerImpl* layer = this; | |
|
danakj
2014/08/18 19:29:13
nit: active_layer
| |
| 598 if (GetTree() == PENDING_TREE) | |
| 599 layer = twin_layer_; | |
| 600 if (layer) | |
| 601 return layer->layer_tree_impl()->RequiresHighResToDraw(); | |
| 602 return false; | |
| 603 } | |
| 604 | |
| 609 gfx::Size PictureLayerImpl::CalculateTileSize( | 605 gfx::Size PictureLayerImpl::CalculateTileSize( |
| 610 const gfx::Size& content_bounds) const { | 606 const gfx::Size& content_bounds) const { |
| 611 if (is_mask_) { | 607 if (is_mask_) { |
| 612 int max_size = layer_tree_impl()->MaxTextureSize(); | 608 int max_size = layer_tree_impl()->MaxTextureSize(); |
| 613 return gfx::Size( | 609 return gfx::Size( |
| 614 std::min(max_size, content_bounds.width()), | 610 std::min(max_size, content_bounds.width()), |
| 615 std::min(max_size, content_bounds.height())); | 611 std::min(max_size, content_bounds.height())); |
| 616 } | 612 } |
| 617 | 613 |
| 618 int max_texture_size = | 614 int max_texture_size = |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 | 739 |
| 744 const ManagedTileState::TileVersion& tile_version = | 740 const ManagedTileState::TileVersion& tile_version = |
| 745 iter->GetTileVersionForDrawing(); | 741 iter->GetTileVersionForDrawing(); |
| 746 if (!tile_version.IsReadyToDraw() || | 742 if (!tile_version.IsReadyToDraw() || |
| 747 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) | 743 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) |
| 748 return 0; | 744 return 0; |
| 749 | 745 |
| 750 return tile_version.get_resource_id(); | 746 return tile_version.get_resource_id(); |
| 751 } | 747 } |
| 752 | 748 |
| 753 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | |
| 754 DCHECK(layer_tree_impl()->IsPendingTree()); | |
| 755 DCHECK(ideal_contents_scale_); | |
| 756 DCHECK_GT(tilings_->num_tilings(), 0u); | |
| 757 | |
| 758 // The goal of this function is to find the minimum set of tiles that need to | |
| 759 // be ready to draw in order to activate without flashing content from a | |
| 760 // higher res on the active tree to a lower res on the pending tree. | |
| 761 | |
| 762 // First, early out for layers with no visible content. | |
| 763 if (visible_content_rect().IsEmpty()) | |
| 764 return; | |
| 765 | |
| 766 gfx::Rect rect(visible_content_rect()); | |
| 767 | |
| 768 float min_acceptable_scale = | |
| 769 std::min(raster_contents_scale_, ideal_contents_scale_); | |
| 770 | |
| 771 if (PictureLayerImpl* twin = twin_layer_) { | |
| 772 float twin_min_acceptable_scale = | |
| 773 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | |
| 774 // Ignore 0 scale in case CalculateContentsScale() has never been | |
| 775 // called for active twin. | |
| 776 if (twin_min_acceptable_scale != 0.0f) { | |
| 777 min_acceptable_scale = | |
| 778 std::min(min_acceptable_scale, twin_min_acceptable_scale); | |
| 779 } | |
| 780 } | |
| 781 | |
| 782 PictureLayerTiling* high_res = NULL; | |
| 783 PictureLayerTiling* low_res = NULL; | |
| 784 | |
| 785 // First pass: ready to draw tiles in acceptable but non-ideal tilings are | |
| 786 // marked as required for activation so that their textures are not thrown | |
| 787 // away; any non-ready tiles are not marked as required. | |
| 788 Region missing_region = rect; | |
| 789 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | |
| 790 PictureLayerTiling* tiling = tilings_->tiling_at(i); | |
| 791 DCHECK(tiling->has_ever_been_updated()); | |
| 792 | |
| 793 if (tiling->resolution() == LOW_RESOLUTION) { | |
| 794 DCHECK(!low_res) << "There can only be one low res tiling"; | |
| 795 low_res = tiling; | |
| 796 } | |
| 797 if (tiling->contents_scale() < min_acceptable_scale) | |
| 798 continue; | |
| 799 if (tiling->resolution() == HIGH_RESOLUTION) { | |
| 800 DCHECK(!high_res) << "There can only be one high res tiling"; | |
| 801 high_res = tiling; | |
| 802 continue; | |
| 803 } | |
| 804 for (PictureLayerTiling::CoverageIterator iter(tiling, | |
| 805 contents_scale_x(), | |
| 806 rect); | |
| 807 iter; | |
| 808 ++iter) { | |
| 809 if (!*iter || !iter->IsReadyToDraw()) | |
| 810 continue; | |
| 811 | |
| 812 missing_region.Subtract(iter.geometry_rect()); | |
| 813 iter->MarkRequiredForActivation(); | |
| 814 } | |
| 815 } | |
| 816 DCHECK(high_res) << "There must be one high res tiling"; | |
| 817 | |
| 818 // If these pointers are null (because no twin, no matching tiling, or the | |
| 819 // simpification just below), then high res tiles will be required to fill any | |
| 820 // holes left by the first pass above. If the pointers are valid, then this | |
| 821 // layer is allowed to skip any tiles that are not ready on its twin. | |
| 822 const PictureLayerTiling* twin_high_res = NULL; | |
| 823 const PictureLayerTiling* twin_low_res = NULL; | |
| 824 | |
| 825 if (twin_layer_) { | |
| 826 // As a simplification, only allow activating to skip twin tiles that the | |
| 827 // active layer is also missing when both this layer and its twin have | |
| 828 // "simple" sets of tilings: only 2 tilings (high and low) or only 1 high | |
| 829 // res tiling. This avoids having to iterate/track coverage of non-ideal | |
| 830 // tilings during the last draw call on the active layer. | |
| 831 if (tilings_->num_tilings() <= 2 && | |
| 832 twin_layer_->tilings_->num_tilings() <= tilings_->num_tilings()) { | |
| 833 twin_low_res = low_res ? GetTwinTiling(low_res) : NULL; | |
| 834 twin_high_res = high_res ? GetTwinTiling(high_res) : NULL; | |
| 835 } | |
| 836 | |
| 837 // If this layer and its twin have different transforms, then don't compare | |
| 838 // them and only allow activating to high res tiles, since tiles on each | |
| 839 // layer will be in different places on screen. | |
| 840 if (twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || | |
| 841 bounds() != twin_layer_->bounds() || | |
| 842 draw_properties().screen_space_transform != | |
| 843 twin_layer_->draw_properties().screen_space_transform) { | |
| 844 twin_high_res = NULL; | |
| 845 twin_low_res = NULL; | |
| 846 } | |
| 847 } | |
| 848 | |
| 849 // As a second pass, mark as required any visible high res tiles not filled in | |
| 850 // by acceptable non-ideal tiles from the first pass. | |
| 851 if (MarkVisibleTilesAsRequired( | |
| 852 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) { | |
| 853 // As an optional third pass, if a high res tile was skipped because its | |
| 854 // twin was also missing, then fall back to mark low res tiles as required | |
| 855 // in case the active twin is substituting those for missing high res | |
| 856 // content. Only suitable, when low res is enabled. | |
| 857 if (low_res) { | |
| 858 MarkVisibleTilesAsRequired( | |
| 859 low_res, twin_low_res, contents_scale_x(), rect, missing_region); | |
| 860 } | |
| 861 } | |
| 862 } | |
| 863 | |
| 864 bool PictureLayerImpl::MarkVisibleTilesAsRequired( | |
| 865 PictureLayerTiling* tiling, | |
| 866 const PictureLayerTiling* optional_twin_tiling, | |
| 867 float contents_scale, | |
| 868 const gfx::Rect& rect, | |
| 869 const Region& missing_region) const { | |
| 870 bool twin_had_missing_tile = false; | |
| 871 for (PictureLayerTiling::CoverageIterator iter(tiling, | |
| 872 contents_scale, | |
| 873 rect); | |
| 874 iter; | |
| 875 ++iter) { | |
| 876 Tile* tile = *iter; | |
| 877 // A null tile (i.e. missing recording) can just be skipped. | |
| 878 if (!tile) | |
| 879 continue; | |
| 880 | |
| 881 // If the tile is occluded, don't mark it as required for activation. | |
| 882 if (tile->is_occluded(PENDING_TREE)) | |
| 883 continue; | |
| 884 | |
| 885 // If the missing region doesn't cover it, this tile is fully | |
| 886 // covered by acceptable tiles at other scales. | |
| 887 if (!missing_region.Intersects(iter.geometry_rect())) | |
| 888 continue; | |
| 889 | |
| 890 // If the twin tile doesn't exist (i.e. missing recording or so far away | |
| 891 // that it is outside the visible tile rect) or this tile is shared between | |
| 892 // with the twin, then this tile isn't required to prevent flashing. | |
| 893 if (optional_twin_tiling) { | |
| 894 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); | |
| 895 if (!twin_tile || twin_tile == tile) { | |
| 896 twin_had_missing_tile = true; | |
| 897 continue; | |
| 898 } | |
| 899 } | |
| 900 | |
| 901 tile->MarkRequiredForActivation(); | |
| 902 } | |
| 903 return twin_had_missing_tile; | |
| 904 } | |
| 905 | |
| 906 void PictureLayerImpl::DoPostCommitInitialization() { | 749 void PictureLayerImpl::DoPostCommitInitialization() { |
| 907 DCHECK(needs_post_commit_initialization_); | 750 DCHECK(needs_post_commit_initialization_); |
| 908 DCHECK(layer_tree_impl()->IsPendingTree()); | 751 DCHECK(layer_tree_impl()->IsPendingTree()); |
| 909 | 752 |
| 910 if (!tilings_) | 753 if (!tilings_) |
| 911 tilings_.reset(new PictureLayerTilingSet(this, bounds())); | 754 tilings_.reset(new PictureLayerTilingSet(this, bounds())); |
| 912 | 755 |
| 913 DCHECK(!twin_layer_); | 756 DCHECK(!twin_layer_); |
| 914 twin_layer_ = static_cast<PictureLayerImpl*>( | 757 twin_layer_ = static_cast<PictureLayerImpl*>( |
| 915 layer_tree_impl()->FindActiveTreeLayerById(id())); | 758 layer_tree_impl()->FindActiveTreeLayerById(id())); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 if (layer_tree_impl()->IsRecycleTree()) | 1128 if (layer_tree_impl()->IsRecycleTree()) |
| 1286 return; | 1129 return; |
| 1287 | 1130 |
| 1288 if (!CanHaveTilings()) { | 1131 if (!CanHaveTilings()) { |
| 1289 DCHECK_EQ(0u, tilings_->num_tilings()); | 1132 DCHECK_EQ(0u, tilings_->num_tilings()); |
| 1290 return; | 1133 return; |
| 1291 } | 1134 } |
| 1292 if (tilings_->num_tilings() == 0) | 1135 if (tilings_->num_tilings() == 0) |
| 1293 return; | 1136 return; |
| 1294 | 1137 |
| 1295 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res | 1138 // We should only have one high res tiling. |
| 1296 // tiling to mark its tiles as being required for activation. | |
| 1297 DCHECK_EQ(1, tilings_->NumHighResTilings()); | 1139 DCHECK_EQ(1, tilings_->NumHighResTilings()); |
| 1298 #endif | 1140 #endif |
| 1299 } | 1141 } |
| 1300 | 1142 |
| 1301 float PictureLayerImpl::MaximumTilingContentsScale() const { | 1143 float PictureLayerImpl::MaximumTilingContentsScale() const { |
| 1302 float max_contents_scale = MinimumContentsScale(); | 1144 float max_contents_scale = MinimumContentsScale(); |
| 1303 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1145 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 1304 const PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1146 const PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 1305 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); | 1147 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); |
| 1306 } | 1148 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1414 tiling->resolution() != LOW_RESOLUTION) | 1256 tiling->resolution() != LOW_RESOLUTION) |
| 1415 continue; | 1257 continue; |
| 1416 | 1258 |
| 1417 gfx::Rect rect(visible_content_rect()); | 1259 gfx::Rect rect(visible_content_rect()); |
| 1418 for (PictureLayerTiling::CoverageIterator iter( | 1260 for (PictureLayerTiling::CoverageIterator iter( |
| 1419 tiling, contents_scale_x(), rect); | 1261 tiling, contents_scale_x(), rect); |
| 1420 iter; | 1262 iter; |
| 1421 ++iter) { | 1263 ++iter) { |
| 1422 const Tile* tile = *iter; | 1264 const Tile* tile = *iter; |
| 1423 // A null tile (i.e. missing recording) can just be skipped. | 1265 // A null tile (i.e. missing recording) can just be skipped. |
| 1266 // TODO(vmpstr): Verify this is true if we create tiles in raster | |
|
danakj
2014/08/18 19:29:13
Is this going to maybe cause us to activate checke
vmpstr
2014/08/18 19:49:52
This is not the case yet, but would definitely be
| |
| 1267 // iterators. | |
| 1424 if (!tile) | 1268 if (!tile) |
| 1425 continue; | 1269 continue; |
| 1426 | 1270 |
| 1427 if (tile->required_for_activation() && !tile->IsReadyToDraw()) | 1271 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) |
| 1428 return false; | 1272 return false; |
| 1429 } | 1273 } |
| 1430 } | 1274 } |
| 1431 | 1275 |
| 1432 return true; | 1276 return true; |
| 1433 } | 1277 } |
| 1434 | 1278 |
| 1435 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1279 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
| 1436 : layer_(NULL), current_stage_(arraysize(stages_)) { | 1280 : layer_(NULL), current_stage_(arraysize(stages_)) { |
| 1437 } | 1281 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1696 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1540 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1697 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1541 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1698 return tiling_range.end - 1 - current_tiling_range_offset; | 1542 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1699 } | 1543 } |
| 1700 } | 1544 } |
| 1701 NOTREACHED(); | 1545 NOTREACHED(); |
| 1702 return 0; | 1546 return 0; |
| 1703 } | 1547 } |
| 1704 | 1548 |
| 1705 } // namespace cc | 1549 } // namespace cc |
| OLD | NEW |