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 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 LayerTreeImpl* tree_impl) { | 90 LayerTreeImpl* tree_impl) { |
91 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 91 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
92 } | 92 } |
93 | 93 |
94 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { | 94 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
95 // It's possible this layer was never drawn or updated (e.g. because it was | 95 // It's possible this layer was never drawn or updated (e.g. because it was |
96 // a descendant of an opacity 0 layer). | 96 // a descendant of an opacity 0 layer). |
97 DoPostCommitInitializationIfNeeded(); | 97 DoPostCommitInitializationIfNeeded(); |
98 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 98 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
99 | 99 |
100 // We have already synced the important bits from the the active layer, and | |
101 // we will soon swap out its tilings and use them for recycling. However, | |
102 // there are now tiles in this layer's tilings that were unref'd and replaced | |
103 // with new tiles (due to invalidation). This resets all active priorities on | |
104 // the to-be-recycled tiling to ensure replaced tiles don't linger and take | |
105 // memory (due to a stale 'active' priority). | |
106 if (layer_impl->tilings_) | |
107 layer_impl->tilings_->DidBecomeRecycled(); | |
108 | |
109 LayerImpl::PushPropertiesTo(base_layer); | 100 LayerImpl::PushPropertiesTo(base_layer); |
110 | 101 |
111 // When the pending tree pushes to the active tree, the pending twin | 102 // When the pending tree pushes to the active tree, the pending twin |
112 // becomes recycled. | 103 // becomes recycled. |
113 layer_impl->twin_layer_ = NULL; | 104 layer_impl->twin_layer_ = NULL; |
114 twin_layer_ = NULL; | 105 twin_layer_ = NULL; |
115 | 106 |
116 layer_impl->pile_ = pile_; | 107 layer_impl->pile_ = pile_; |
117 | 108 |
118 // Tilings would be expensive to push, so we swap. | 109 // Tilings would be expensive to push, so we swap. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 float width; | 213 float width; |
223 if (*iter && iter->IsReadyToDraw()) { | 214 if (*iter && iter->IsReadyToDraw()) { |
224 ManagedTileState::TileVersion::Mode mode = | 215 ManagedTileState::TileVersion::Mode mode = |
225 iter->GetTileVersionForDrawing().mode(); | 216 iter->GetTileVersionForDrawing().mode(); |
226 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 217 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
227 color = DebugColors::SolidColorTileBorderColor(); | 218 color = DebugColors::SolidColorTileBorderColor(); |
228 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 219 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
229 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 220 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
230 color = DebugColors::PictureTileBorderColor(); | 221 color = DebugColors::PictureTileBorderColor(); |
231 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 222 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
232 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { | 223 } else if (iter.resolution() == HIGH_RESOLUTION) { |
233 color = DebugColors::HighResTileBorderColor(); | 224 color = DebugColors::HighResTileBorderColor(); |
234 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 225 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
235 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { | 226 } else if (iter.resolution() == LOW_RESOLUTION) { |
236 color = DebugColors::LowResTileBorderColor(); | 227 color = DebugColors::LowResTileBorderColor(); |
237 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 228 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
238 } else if (iter->contents_scale() > max_contents_scale) { | 229 } else if (iter->contents_scale() > max_contents_scale) { |
239 color = DebugColors::ExtraHighResTileBorderColor(); | 230 color = DebugColors::ExtraHighResTileBorderColor(); |
240 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 231 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
241 } else { | 232 } else { |
242 color = DebugColors::ExtraLowResTileBorderColor(); | 233 color = DebugColors::ExtraLowResTileBorderColor(); |
243 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 234 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
244 } | 235 } |
245 } else { | 236 } else { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 377 |
387 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { | 378 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { |
388 append_quads_data->num_missing_tiles++; | 379 append_quads_data->num_missing_tiles++; |
389 ++missing_tile_count; | 380 ++missing_tile_count; |
390 } | 381 } |
391 append_quads_data->approximated_visible_content_area += | 382 append_quads_data->approximated_visible_content_area += |
392 visible_geometry_rect.width() * visible_geometry_rect.height(); | 383 visible_geometry_rect.width() * visible_geometry_rect.height(); |
393 continue; | 384 continue; |
394 } | 385 } |
395 | 386 |
396 if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) { | 387 if (iter.resolution() != HIGH_RESOLUTION) { |
397 append_quads_data->approximated_visible_content_area += | 388 append_quads_data->approximated_visible_content_area += |
398 visible_geometry_rect.width() * visible_geometry_rect.height(); | 389 visible_geometry_rect.width() * visible_geometry_rect.height(); |
399 } | 390 } |
400 | 391 |
401 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) | 392 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) |
402 seen_tilings.push_back(iter.CurrentTiling()); | 393 seen_tilings.push_back(iter.CurrentTiling()); |
403 } | 394 } |
404 | 395 |
405 if (missing_tile_count) { | 396 if (missing_tile_count) { |
406 TRACE_EVENT_INSTANT2("cc", | 397 TRACE_EVENT_INSTANT2("cc", |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 DCHECK(raster_source_scale_); | 444 DCHECK(raster_source_scale_); |
454 DCHECK(raster_contents_scale_); | 445 DCHECK(raster_contents_scale_); |
455 DCHECK(low_res_raster_contents_scale_); | 446 DCHECK(low_res_raster_contents_scale_); |
456 | 447 |
457 was_screen_space_transform_animating_ = | 448 was_screen_space_transform_animating_ = |
458 draw_properties().screen_space_transform_is_animating; | 449 draw_properties().screen_space_transform_is_animating; |
459 | 450 |
460 should_update_tile_priorities_ = true; | 451 should_update_tile_priorities_ = true; |
461 | 452 |
462 UpdateTilePriorities(occlusion_in_content_space); | 453 UpdateTilePriorities(occlusion_in_content_space); |
463 | |
464 if (layer_tree_impl()->IsPendingTree()) | |
465 MarkVisibleResourcesAsRequired(); | |
466 } | 454 } |
467 | 455 |
468 void PictureLayerImpl::UpdateTilePriorities( | 456 void PictureLayerImpl::UpdateTilePriorities( |
469 const Occlusion& occlusion_in_content_space) { | 457 const Occlusion& occlusion_in_content_space) { |
470 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 458 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
471 | 459 |
472 double current_frame_time_in_seconds = | 460 double current_frame_time_in_seconds = |
473 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - | 461 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - |
474 base::TimeTicks()).InSecondsF(); | 462 base::TimeTicks()).InSecondsF(); |
475 | 463 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 524 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
537 if (layer_tree_impl()->IsActiveTree()) { | 525 if (layer_tree_impl()->IsActiveTree()) { |
538 gfx::RectF layer_damage_rect = | 526 gfx::RectF layer_damage_rect = |
539 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); | 527 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); |
540 AddDamageRect(layer_damage_rect); | 528 AddDamageRect(layer_damage_rect); |
541 } | 529 } |
542 } | 530 } |
543 | 531 |
544 void PictureLayerImpl::DidBecomeActive() { | 532 void PictureLayerImpl::DidBecomeActive() { |
545 LayerImpl::DidBecomeActive(); | 533 LayerImpl::DidBecomeActive(); |
546 tilings_->DidBecomeActive(); | |
547 layer_tree_impl()->DidModifyTilePriorities(); | 534 layer_tree_impl()->DidModifyTilePriorities(); |
548 } | 535 } |
549 | 536 |
550 void PictureLayerImpl::DidBeginTracing() { | 537 void PictureLayerImpl::DidBeginTracing() { |
551 pile_->DidBeginTracing(); | 538 pile_->DidBeginTracing(); |
552 } | 539 } |
553 | 540 |
554 void PictureLayerImpl::ReleaseResources() { | 541 void PictureLayerImpl::ReleaseResources() { |
555 if (tilings_) | 542 if (tilings_) |
556 RemoveAllTilings(); | 543 RemoveAllTilings(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * | 617 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * |
631 layer_tree_impl()->settings().skewport_target_time_multiplier; | 618 layer_tree_impl()->settings().skewport_target_time_multiplier; |
632 } | 619 } |
633 | 620 |
634 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { | 621 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { |
635 return layer_tree_impl() | 622 return layer_tree_impl() |
636 ->settings() | 623 ->settings() |
637 .skewport_extrapolation_limit_in_content_pixels; | 624 .skewport_extrapolation_limit_in_content_pixels; |
638 } | 625 } |
639 | 626 |
| 627 bool PictureLayerImpl::RequiresHighResToDraw() const { |
| 628 const PictureLayerImpl* layer = this; |
| 629 if (GetTree() == PENDING_TREE) |
| 630 layer = twin_layer_; |
| 631 if (layer) |
| 632 return layer->layer_tree_impl()->RequiresHighResToDraw(); |
| 633 return false; |
| 634 } |
| 635 |
640 gfx::Size PictureLayerImpl::CalculateTileSize( | 636 gfx::Size PictureLayerImpl::CalculateTileSize( |
641 const gfx::Size& content_bounds) const { | 637 const gfx::Size& content_bounds) const { |
642 int max_texture_size = | 638 int max_texture_size = |
643 layer_tree_impl()->resource_provider()->max_texture_size(); | 639 layer_tree_impl()->resource_provider()->max_texture_size(); |
644 | 640 |
645 if (pile_->is_mask()) { | 641 if (pile_->is_mask()) { |
646 // Masks are not tiled, so if we can't cover the whole mask with one tile, | 642 // Masks are not tiled, so if we can't cover the whole mask with one tile, |
647 // don't make any tiles at all. Returning an empty size signals this. | 643 // don't make any tiles at all. Returning an empty size signals this. |
648 if (content_bounds.width() > max_texture_size || | 644 if (content_bounds.width() > max_texture_size || |
649 content_bounds.height() > max_texture_size) | 645 content_bounds.height() > max_texture_size) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 765 |
770 const ManagedTileState::TileVersion& tile_version = | 766 const ManagedTileState::TileVersion& tile_version = |
771 iter->GetTileVersionForDrawing(); | 767 iter->GetTileVersionForDrawing(); |
772 if (!tile_version.IsReadyToDraw() || | 768 if (!tile_version.IsReadyToDraw() || |
773 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) | 769 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) |
774 return 0; | 770 return 0; |
775 | 771 |
776 return tile_version.get_resource_id(); | 772 return tile_version.get_resource_id(); |
777 } | 773 } |
778 | 774 |
779 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | |
780 DCHECK(layer_tree_impl()->IsPendingTree()); | |
781 DCHECK(ideal_contents_scale_); | |
782 DCHECK_GT(tilings_->num_tilings(), 0u); | |
783 | |
784 // The goal of this function is to find the minimum set of tiles that need to | |
785 // be ready to draw in order to activate without flashing content from a | |
786 // higher res on the active tree to a lower res on the pending tree. | |
787 | |
788 // First, early out for layers with no visible content. | |
789 if (visible_content_rect().IsEmpty()) | |
790 return; | |
791 | |
792 gfx::Rect rect(visible_content_rect()); | |
793 | |
794 // Only mark tiles inside the viewport for tile priority as required for | |
795 // activation. This viewport is normally the same as the draw viewport but | |
796 // can be independently overridden by embedders like Android WebView with | |
797 // SetExternalDrawConstraints. | |
798 rect.Intersect(GetViewportForTilePriorityInContentSpace()); | |
799 | |
800 float min_acceptable_scale = | |
801 std::min(raster_contents_scale_, ideal_contents_scale_); | |
802 | |
803 if (PictureLayerImpl* twin = twin_layer_) { | |
804 float twin_min_acceptable_scale = | |
805 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | |
806 // Ignore 0 scale in case CalculateContentsScale() has never been | |
807 // called for active twin. | |
808 if (twin_min_acceptable_scale != 0.0f) { | |
809 min_acceptable_scale = | |
810 std::min(min_acceptable_scale, twin_min_acceptable_scale); | |
811 } | |
812 } | |
813 | |
814 PictureLayerTiling* high_res = NULL; | |
815 PictureLayerTiling* low_res = NULL; | |
816 | |
817 // First pass: ready to draw tiles in acceptable but non-ideal tilings are | |
818 // marked as required for activation so that their textures are not thrown | |
819 // away; any non-ready tiles are not marked as required. | |
820 Region missing_region = rect; | |
821 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | |
822 PictureLayerTiling* tiling = tilings_->tiling_at(i); | |
823 DCHECK(tiling->has_ever_been_updated()); | |
824 | |
825 if (tiling->resolution() == LOW_RESOLUTION) { | |
826 DCHECK(!low_res) << "There can only be one low res tiling"; | |
827 low_res = tiling; | |
828 } | |
829 if (tiling->contents_scale() < min_acceptable_scale) | |
830 continue; | |
831 if (tiling->resolution() == HIGH_RESOLUTION) { | |
832 DCHECK(!high_res) << "There can only be one high res tiling"; | |
833 high_res = tiling; | |
834 continue; | |
835 } | |
836 for (PictureLayerTiling::CoverageIterator iter(tiling, | |
837 contents_scale_x(), | |
838 rect); | |
839 iter; | |
840 ++iter) { | |
841 if (!*iter || !iter->IsReadyToDraw()) | |
842 continue; | |
843 | |
844 missing_region.Subtract(iter.geometry_rect()); | |
845 iter->MarkRequiredForActivation(); | |
846 } | |
847 } | |
848 DCHECK(high_res) << "There must be one high res tiling"; | |
849 | |
850 // If these pointers are null (because no twin, no matching tiling, or the | |
851 // simpification just below), then high res tiles will be required to fill any | |
852 // holes left by the first pass above. If the pointers are valid, then this | |
853 // layer is allowed to skip any tiles that are not ready on its twin. | |
854 const PictureLayerTiling* twin_high_res = NULL; | |
855 const PictureLayerTiling* twin_low_res = NULL; | |
856 | |
857 if (twin_layer_) { | |
858 // As a simplification, only allow activating to skip twin tiles that the | |
859 // active layer is also missing when both this layer and its twin have | |
860 // "simple" sets of tilings: only 2 tilings (high and low) or only 1 high | |
861 // res tiling. This avoids having to iterate/track coverage of non-ideal | |
862 // tilings during the last draw call on the active layer. | |
863 if (tilings_->num_tilings() <= 2 && | |
864 twin_layer_->tilings_->num_tilings() <= tilings_->num_tilings()) { | |
865 twin_low_res = low_res ? GetTwinTiling(low_res) : NULL; | |
866 twin_high_res = high_res ? GetTwinTiling(high_res) : NULL; | |
867 } | |
868 | |
869 // If this layer and its twin have different transforms, then don't compare | |
870 // them and only allow activating to high res tiles, since tiles on each | |
871 // layer will be in different places on screen. | |
872 if (twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || | |
873 bounds() != twin_layer_->bounds() || | |
874 draw_properties().screen_space_transform != | |
875 twin_layer_->draw_properties().screen_space_transform) { | |
876 twin_high_res = NULL; | |
877 twin_low_res = NULL; | |
878 } | |
879 } | |
880 | |
881 // As a second pass, mark as required any visible high res tiles not filled in | |
882 // by acceptable non-ideal tiles from the first pass. | |
883 if (MarkVisibleTilesAsRequired( | |
884 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) { | |
885 // As an optional third pass, if a high res tile was skipped because its | |
886 // twin was also missing, then fall back to mark low res tiles as required | |
887 // in case the active twin is substituting those for missing high res | |
888 // content. Only suitable, when low res is enabled. | |
889 if (low_res) { | |
890 MarkVisibleTilesAsRequired( | |
891 low_res, twin_low_res, contents_scale_x(), rect, missing_region); | |
892 } | |
893 } | |
894 } | |
895 | |
896 bool PictureLayerImpl::MarkVisibleTilesAsRequired( | |
897 PictureLayerTiling* tiling, | |
898 const PictureLayerTiling* optional_twin_tiling, | |
899 float contents_scale, | |
900 const gfx::Rect& rect, | |
901 const Region& missing_region) const { | |
902 bool twin_had_missing_tile = false; | |
903 for (PictureLayerTiling::CoverageIterator iter(tiling, | |
904 contents_scale, | |
905 rect); | |
906 iter; | |
907 ++iter) { | |
908 Tile* tile = *iter; | |
909 // A null tile (i.e. missing recording) can just be skipped. | |
910 if (!tile) | |
911 continue; | |
912 | |
913 // If the tile is occluded, don't mark it as required for activation. | |
914 if (tile->is_occluded(PENDING_TREE)) | |
915 continue; | |
916 | |
917 // If the missing region doesn't cover it, this tile is fully | |
918 // covered by acceptable tiles at other scales. | |
919 if (!missing_region.Intersects(iter.geometry_rect())) | |
920 continue; | |
921 | |
922 // If the twin tile doesn't exist (i.e. missing recording or so far away | |
923 // that it is outside the visible tile rect) or this tile is shared between | |
924 // with the twin, then this tile isn't required to prevent flashing. | |
925 if (optional_twin_tiling) { | |
926 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); | |
927 if (!twin_tile || twin_tile == tile) { | |
928 // However if the shared tile is being used on the active tree, then | |
929 // there's no missing content in this place, and low res is not needed. | |
930 if (!twin_tile || !twin_tile->IsReadyToDraw()) | |
931 twin_had_missing_tile = true; | |
932 continue; | |
933 } | |
934 } | |
935 | |
936 tile->MarkRequiredForActivation(); | |
937 } | |
938 return twin_had_missing_tile; | |
939 } | |
940 | |
941 void PictureLayerImpl::DoPostCommitInitialization() { | 775 void PictureLayerImpl::DoPostCommitInitialization() { |
942 DCHECK(needs_post_commit_initialization_); | 776 DCHECK(needs_post_commit_initialization_); |
943 DCHECK(layer_tree_impl()->IsPendingTree()); | 777 DCHECK(layer_tree_impl()->IsPendingTree()); |
944 | 778 |
945 if (!tilings_) | 779 if (!tilings_) |
946 tilings_.reset(new PictureLayerTilingSet(this, bounds())); | 780 tilings_.reset(new PictureLayerTilingSet(this, bounds())); |
947 | 781 |
948 DCHECK(!twin_layer_); | 782 DCHECK(!twin_layer_); |
949 twin_layer_ = static_cast<PictureLayerImpl*>( | 783 twin_layer_ = static_cast<PictureLayerImpl*>( |
950 layer_tree_impl()->FindActiveTreeLayerById(id())); | 784 layer_tree_impl()->FindActiveTreeLayerById(id())); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 if (layer_tree_impl()->IsRecycleTree()) | 1160 if (layer_tree_impl()->IsRecycleTree()) |
1327 return; | 1161 return; |
1328 | 1162 |
1329 if (!CanHaveTilings()) { | 1163 if (!CanHaveTilings()) { |
1330 DCHECK_EQ(0u, tilings_->num_tilings()); | 1164 DCHECK_EQ(0u, tilings_->num_tilings()); |
1331 return; | 1165 return; |
1332 } | 1166 } |
1333 if (tilings_->num_tilings() == 0) | 1167 if (tilings_->num_tilings() == 0) |
1334 return; | 1168 return; |
1335 | 1169 |
1336 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res | 1170 // We should only have one high res tiling. |
1337 // tiling to mark its tiles as being required for activation. | |
1338 DCHECK_EQ(1, tilings_->NumHighResTilings()); | 1171 DCHECK_EQ(1, tilings_->NumHighResTilings()); |
1339 #endif | 1172 #endif |
1340 } | 1173 } |
1341 | 1174 |
1342 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { | 1175 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { |
1343 if (!layer_tree_impl()->use_gpu_rasterization()) | 1176 if (!layer_tree_impl()->use_gpu_rasterization()) |
1344 return false; | 1177 return false; |
1345 | 1178 |
1346 // Re-rastering text at different scales using GPU rasterization causes | 1179 // Re-rastering text at different scales using GPU rasterization causes |
1347 // texture uploads for glyphs at each scale (see crbug.com/366225). To | 1180 // texture uploads for glyphs at each scale (see crbug.com/366225). To |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 tiling->resolution() != LOW_RESOLUTION) | 1313 tiling->resolution() != LOW_RESOLUTION) |
1481 continue; | 1314 continue; |
1482 | 1315 |
1483 gfx::Rect rect(visible_content_rect()); | 1316 gfx::Rect rect(visible_content_rect()); |
1484 for (PictureLayerTiling::CoverageIterator iter( | 1317 for (PictureLayerTiling::CoverageIterator iter( |
1485 tiling, contents_scale_x(), rect); | 1318 tiling, contents_scale_x(), rect); |
1486 iter; | 1319 iter; |
1487 ++iter) { | 1320 ++iter) { |
1488 const Tile* tile = *iter; | 1321 const Tile* tile = *iter; |
1489 // A null tile (i.e. missing recording) can just be skipped. | 1322 // A null tile (i.e. missing recording) can just be skipped. |
| 1323 // TODO(vmpstr): Verify this is true if we create tiles in raster |
| 1324 // iterators. |
1490 if (!tile) | 1325 if (!tile) |
1491 continue; | 1326 continue; |
1492 | 1327 |
1493 if (tile->required_for_activation() && !tile->IsReadyToDraw()) | 1328 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) |
1494 return false; | 1329 return false; |
1495 } | 1330 } |
1496 } | 1331 } |
1497 | 1332 |
1498 return true; | 1333 return true; |
1499 } | 1334 } |
1500 | 1335 |
1501 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1336 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
1502 : layer_(NULL), current_stage_(arraysize(stages_)) { | 1337 : layer_(NULL), current_stage_(arraysize(stages_)) { |
1503 } | 1338 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1601 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1767 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1602 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1768 return tiling_range.end - 1 - current_tiling_range_offset; | 1603 return tiling_range.end - 1 - current_tiling_range_offset; |
1769 } | 1604 } |
1770 } | 1605 } |
1771 NOTREACHED(); | 1606 NOTREACHED(); |
1772 return 0; | 1607 return 0; |
1773 } | 1608 } |
1774 | 1609 |
1775 } // namespace cc | 1610 } // namespace cc |
OLD | NEW |