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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 | 374 |
384 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { | 375 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { |
385 append_quads_data->num_missing_tiles++; | 376 append_quads_data->num_missing_tiles++; |
386 ++missing_tile_count; | 377 ++missing_tile_count; |
387 } | 378 } |
388 append_quads_data->approximated_visible_content_area += | 379 append_quads_data->approximated_visible_content_area += |
389 visible_geometry_rect.width() * visible_geometry_rect.height(); | 380 visible_geometry_rect.width() * visible_geometry_rect.height(); |
390 continue; | 381 continue; |
391 } | 382 } |
392 | 383 |
393 if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) { | 384 if (iter.resolution() != HIGH_RESOLUTION) { |
394 append_quads_data->approximated_visible_content_area += | 385 append_quads_data->approximated_visible_content_area += |
395 visible_geometry_rect.width() * visible_geometry_rect.height(); | 386 visible_geometry_rect.width() * visible_geometry_rect.height(); |
396 } | 387 } |
397 | 388 |
398 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) | 389 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) |
399 seen_tilings.push_back(iter.CurrentTiling()); | 390 seen_tilings.push_back(iter.CurrentTiling()); |
400 } | 391 } |
401 | 392 |
402 if (missing_tile_count) { | 393 if (missing_tile_count) { |
403 TRACE_EVENT_INSTANT2("cc", | 394 TRACE_EVENT_INSTANT2("cc", |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 DCHECK(raster_source_scale_); | 443 DCHECK(raster_source_scale_); |
453 DCHECK(raster_contents_scale_); | 444 DCHECK(raster_contents_scale_); |
454 DCHECK(low_res_raster_contents_scale_); | 445 DCHECK(low_res_raster_contents_scale_); |
455 | 446 |
456 was_screen_space_transform_animating_ = | 447 was_screen_space_transform_animating_ = |
457 draw_properties().screen_space_transform_is_animating; | 448 draw_properties().screen_space_transform_is_animating; |
458 | 449 |
459 should_update_tile_priorities_ = true; | 450 should_update_tile_priorities_ = true; |
460 | 451 |
461 UpdateTilePriorities(occlusion_in_content_space); | 452 UpdateTilePriorities(occlusion_in_content_space); |
462 | |
463 if (layer_tree_impl()->IsPendingTree()) | |
464 MarkVisibleResourcesAsRequired(); | |
465 } | 453 } |
466 | 454 |
467 void PictureLayerImpl::UpdateTilePriorities( | 455 void PictureLayerImpl::UpdateTilePriorities( |
468 const Occlusion& occlusion_in_content_space) { | 456 const Occlusion& occlusion_in_content_space) { |
469 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 457 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
470 | 458 |
471 double current_frame_time_in_seconds = | 459 double current_frame_time_in_seconds = |
472 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - | 460 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - |
473 base::TimeTicks()).InSecondsF(); | 461 base::TimeTicks()).InSecondsF(); |
474 | 462 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 522 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
535 if (layer_tree_impl()->IsActiveTree()) { | 523 if (layer_tree_impl()->IsActiveTree()) { |
536 gfx::RectF layer_damage_rect = | 524 gfx::RectF layer_damage_rect = |
537 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); | 525 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); |
538 AddDamageRect(layer_damage_rect); | 526 AddDamageRect(layer_damage_rect); |
539 } | 527 } |
540 } | 528 } |
541 | 529 |
542 void PictureLayerImpl::DidBecomeActive() { | 530 void PictureLayerImpl::DidBecomeActive() { |
543 LayerImpl::DidBecomeActive(); | 531 LayerImpl::DidBecomeActive(); |
544 tilings_->DidBecomeActive(); | |
545 layer_tree_impl()->DidModifyTilePriorities(); | 532 layer_tree_impl()->DidModifyTilePriorities(); |
danakj
2014/09/19 01:41:46
Can we do this from LayerTreeHostImpl directly and
vmpstr
2014/09/19 21:22:52
I've tried to just call DidModifyTilePriorities fr
| |
546 } | 533 } |
547 | 534 |
548 void PictureLayerImpl::DidBeginTracing() { | 535 void PictureLayerImpl::DidBeginTracing() { |
549 pile_->DidBeginTracing(); | 536 pile_->DidBeginTracing(); |
550 } | 537 } |
551 | 538 |
552 void PictureLayerImpl::ReleaseResources() { | 539 void PictureLayerImpl::ReleaseResources() { |
553 if (tilings_) | 540 if (tilings_) |
554 RemoveAllTilings(); | 541 RemoveAllTilings(); |
555 | 542 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * | 614 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * |
628 layer_tree_impl()->settings().skewport_target_time_multiplier; | 615 layer_tree_impl()->settings().skewport_target_time_multiplier; |
629 } | 616 } |
630 | 617 |
631 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { | 618 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { |
632 return layer_tree_impl() | 619 return layer_tree_impl() |
633 ->settings() | 620 ->settings() |
634 .skewport_extrapolation_limit_in_content_pixels; | 621 .skewport_extrapolation_limit_in_content_pixels; |
635 } | 622 } |
636 | 623 |
624 bool PictureLayerImpl::RequiresHighResToDraw() const { | |
625 const PictureLayerImpl* layer = this; | |
626 if (GetTree() == PENDING_TREE) | |
danakj
2014/09/19 01:41:46
GetTree() is a virtual function call, how about ju
vmpstr
2014/09/19 21:22:52
Done.
| |
627 layer = twin_layer_; | |
628 if (layer) | |
629 return layer->layer_tree_impl()->RequiresHighResToDraw(); | |
630 return false; | |
631 } | |
632 | |
637 gfx::Size PictureLayerImpl::CalculateTileSize( | 633 gfx::Size PictureLayerImpl::CalculateTileSize( |
638 const gfx::Size& content_bounds) const { | 634 const gfx::Size& content_bounds) const { |
639 int max_texture_size = | 635 int max_texture_size = |
640 layer_tree_impl()->resource_provider()->max_texture_size(); | 636 layer_tree_impl()->resource_provider()->max_texture_size(); |
641 | 637 |
642 if (pile_->is_mask()) { | 638 if (pile_->is_mask()) { |
643 // Masks are not tiled, so if we can't cover the whole mask with one tile, | 639 // Masks are not tiled, so if we can't cover the whole mask with one tile, |
644 // don't make any tiles at all. Returning an empty size signals this. | 640 // don't make any tiles at all. Returning an empty size signals this. |
645 if (content_bounds.width() > max_texture_size || | 641 if (content_bounds.width() > max_texture_size || |
646 content_bounds.height() > max_texture_size) | 642 content_bounds.height() > max_texture_size) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
765 | 761 |
766 const ManagedTileState::TileVersion& tile_version = | 762 const ManagedTileState::TileVersion& tile_version = |
767 iter->GetTileVersionForDrawing(); | 763 iter->GetTileVersionForDrawing(); |
768 if (!tile_version.IsReadyToDraw() || | 764 if (!tile_version.IsReadyToDraw() || |
769 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) | 765 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) |
770 return 0; | 766 return 0; |
771 | 767 |
772 return tile_version.get_resource_id(); | 768 return tile_version.get_resource_id(); |
773 } | 769 } |
774 | 770 |
775 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | |
776 DCHECK(layer_tree_impl()->IsPendingTree()); | |
777 DCHECK(ideal_contents_scale_); | |
778 DCHECK_GT(tilings_->num_tilings(), 0u); | |
779 | |
780 // The goal of this function is to find the minimum set of tiles that need to | |
781 // be ready to draw in order to activate without flashing content from a | |
782 // higher res on the active tree to a lower res on the pending tree. | |
783 | |
784 // First, early out for layers with no visible content. | |
785 if (visible_content_rect().IsEmpty()) | |
786 return; | |
787 | |
788 // Only mark tiles inside the viewport for tile priority as required for | |
789 // activation. This viewport is normally the same as the draw viewport but | |
790 // can be independently overridden by embedders like Android WebView with | |
791 // SetExternalDrawConstraints. | |
792 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | |
793 | |
794 float min_acceptable_scale = | |
795 std::min(raster_contents_scale_, ideal_contents_scale_); | |
796 | |
797 if (PictureLayerImpl* twin = twin_layer_) { | |
798 float twin_min_acceptable_scale = | |
799 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); | |
800 // Ignore 0 scale in case CalculateContentsScale() has never been | |
801 // called for active twin. | |
802 if (twin_min_acceptable_scale != 0.0f) { | |
803 min_acceptable_scale = | |
804 std::min(min_acceptable_scale, twin_min_acceptable_scale); | |
805 } | |
806 } | |
807 | |
808 PictureLayerTiling* high_res = NULL; | |
809 PictureLayerTiling* low_res = NULL; | |
810 | |
811 // First pass: ready to draw tiles in acceptable but non-ideal tilings are | |
812 // marked as required for activation so that their textures are not thrown | |
813 // away; any non-ready tiles are not marked as required. | |
814 Region missing_region = rect; | |
815 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | |
816 PictureLayerTiling* tiling = tilings_->tiling_at(i); | |
817 DCHECK(tiling->has_ever_been_updated()); | |
818 | |
819 if (tiling->resolution() == LOW_RESOLUTION) { | |
820 DCHECK(!low_res) << "There can only be one low res tiling"; | |
821 low_res = tiling; | |
822 } | |
823 if (tiling->contents_scale() < min_acceptable_scale) | |
824 continue; | |
825 if (tiling->resolution() == HIGH_RESOLUTION) { | |
826 DCHECK(!high_res) << "There can only be one high res tiling"; | |
827 high_res = tiling; | |
828 continue; | |
829 } | |
830 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | |
831 ++iter) { | |
832 if (!*iter || !iter->IsReadyToDraw()) | |
833 continue; | |
834 | |
835 missing_region.Subtract(iter.geometry_rect()); | |
836 iter->MarkRequiredForActivation(); | |
837 } | |
838 } | |
839 DCHECK(high_res) << "There must be one high res tiling"; | |
840 | |
841 // If these pointers are null (because no twin, no matching tiling, or the | |
842 // simpification just below), then high res tiles will be required to fill any | |
843 // holes left by the first pass above. If the pointers are valid, then this | |
844 // layer is allowed to skip any tiles that are not ready on its twin. | |
845 const PictureLayerTiling* twin_high_res = NULL; | |
846 const PictureLayerTiling* twin_low_res = NULL; | |
847 | |
848 if (twin_layer_) { | |
849 // As a simplification, only allow activating to skip twin tiles that the | |
850 // active layer is also missing when both this layer and its twin have | |
851 // "simple" sets of tilings: only 2 tilings (high and low) or only 1 high | |
852 // res tiling. This avoids having to iterate/track coverage of non-ideal | |
853 // tilings during the last draw call on the active layer. | |
854 if (tilings_->num_tilings() <= 2 && | |
855 twin_layer_->tilings_->num_tilings() <= tilings_->num_tilings()) { | |
856 twin_low_res = low_res ? GetTwinTiling(low_res) : NULL; | |
857 twin_high_res = high_res ? GetTwinTiling(high_res) : NULL; | |
858 } | |
859 | |
860 // If this layer and its twin have different transforms, then don't compare | |
861 // them and only allow activating to high res tiles, since tiles on each | |
862 // layer will be in different places on screen. | |
863 if (twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || | |
864 bounds() != twin_layer_->bounds() || | |
865 draw_properties().screen_space_transform != | |
866 twin_layer_->draw_properties().screen_space_transform) { | |
867 twin_high_res = NULL; | |
868 twin_low_res = NULL; | |
869 } | |
870 } | |
871 | |
872 // As a second pass, mark as required any visible high res tiles not filled in | |
873 // by acceptable non-ideal tiles from the first pass. | |
874 if (MarkVisibleTilesAsRequired( | |
875 high_res, twin_high_res, rect, missing_region)) { | |
876 // As an optional third pass, if a high res tile was skipped because its | |
877 // twin was also missing, then fall back to mark low res tiles as required | |
878 // in case the active twin is substituting those for missing high res | |
879 // content. Only suitable, when low res is enabled. | |
880 if (low_res) { | |
881 MarkVisibleTilesAsRequired(low_res, twin_low_res, rect, missing_region); | |
882 } | |
883 } | |
884 } | |
885 | |
886 bool PictureLayerImpl::MarkVisibleTilesAsRequired( | |
887 PictureLayerTiling* tiling, | |
888 const PictureLayerTiling* optional_twin_tiling, | |
889 const gfx::Rect& rect, | |
890 const Region& missing_region) const { | |
891 bool twin_had_missing_tile = false; | |
892 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | |
893 ++iter) { | |
894 Tile* tile = *iter; | |
895 // A null tile (i.e. missing recording) can just be skipped. | |
896 if (!tile) | |
897 continue; | |
898 | |
899 // If the tile is occluded, don't mark it as required for activation. | |
900 if (tile->is_occluded(PENDING_TREE)) | |
901 continue; | |
902 | |
903 // If the missing region doesn't cover it, this tile is fully | |
904 // covered by acceptable tiles at other scales. | |
905 if (!missing_region.Intersects(iter.geometry_rect())) | |
906 continue; | |
907 | |
908 // If the twin tile doesn't exist (i.e. missing recording or so far away | |
909 // that it is outside the visible tile rect) or this tile is shared between | |
910 // with the twin, then this tile isn't required to prevent flashing. | |
911 if (optional_twin_tiling) { | |
912 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); | |
913 if (!twin_tile || twin_tile == tile) { | |
914 // However if the shared tile is being used on the active tree, then | |
915 // there's no missing content in this place, and low res is not needed. | |
916 if (!twin_tile || !twin_tile->IsReadyToDraw()) | |
917 twin_had_missing_tile = true; | |
918 continue; | |
919 } | |
920 } | |
921 | |
922 tile->MarkRequiredForActivation(); | |
923 } | |
924 return twin_had_missing_tile; | |
925 } | |
926 | |
927 void PictureLayerImpl::DoPostCommitInitialization() { | 771 void PictureLayerImpl::DoPostCommitInitialization() { |
928 DCHECK(needs_post_commit_initialization_); | 772 DCHECK(needs_post_commit_initialization_); |
929 DCHECK(layer_tree_impl()->IsPendingTree()); | 773 DCHECK(layer_tree_impl()->IsPendingTree()); |
930 | 774 |
931 if (!tilings_) | 775 if (!tilings_) |
932 tilings_.reset(new PictureLayerTilingSet(this, bounds())); | 776 tilings_.reset(new PictureLayerTilingSet(this, bounds())); |
933 | 777 |
934 DCHECK(!twin_layer_); | 778 DCHECK(!twin_layer_); |
935 twin_layer_ = static_cast<PictureLayerImpl*>( | 779 twin_layer_ = static_cast<PictureLayerImpl*>( |
936 layer_tree_impl()->FindActiveTreeLayerById(id())); | 780 layer_tree_impl()->FindActiveTreeLayerById(id())); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1312 if (layer_tree_impl()->IsRecycleTree()) | 1156 if (layer_tree_impl()->IsRecycleTree()) |
1313 return; | 1157 return; |
1314 | 1158 |
1315 if (!CanHaveTilings()) { | 1159 if (!CanHaveTilings()) { |
1316 DCHECK_EQ(0u, tilings_->num_tilings()); | 1160 DCHECK_EQ(0u, tilings_->num_tilings()); |
1317 return; | 1161 return; |
1318 } | 1162 } |
1319 if (tilings_->num_tilings() == 0) | 1163 if (tilings_->num_tilings() == 0) |
1320 return; | 1164 return; |
1321 | 1165 |
1322 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res | 1166 // We should only have one high res tiling. |
1323 // tiling to mark its tiles as being required for activation. | |
1324 DCHECK_EQ(1, tilings_->NumHighResTilings()); | 1167 DCHECK_EQ(1, tilings_->NumHighResTilings()); |
1325 #endif | 1168 #endif |
1326 } | 1169 } |
1327 | 1170 |
1328 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { | 1171 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { |
1329 if (!layer_tree_impl()->use_gpu_rasterization()) | 1172 if (!layer_tree_impl()->use_gpu_rasterization()) |
1330 return false; | 1173 return false; |
1331 | 1174 |
1332 // Re-rastering text at different scales using GPU rasterization causes | 1175 // Re-rastering text at different scales using GPU rasterization causes |
1333 // texture uploads for glyphs at each scale (see crbug.com/366225). To | 1176 // texture uploads for glyphs at each scale (see crbug.com/366225). To |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1472 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1315 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
1473 if (tiling->resolution() != HIGH_RESOLUTION && | 1316 if (tiling->resolution() != HIGH_RESOLUTION && |
1474 tiling->resolution() != LOW_RESOLUTION) | 1317 tiling->resolution() != LOW_RESOLUTION) |
1475 continue; | 1318 continue; |
1476 | 1319 |
1477 gfx::Rect rect(visible_content_rect()); | 1320 gfx::Rect rect(visible_content_rect()); |
1478 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | 1321 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; |
1479 ++iter) { | 1322 ++iter) { |
1480 const Tile* tile = *iter; | 1323 const Tile* tile = *iter; |
1481 // A null tile (i.e. missing recording) can just be skipped. | 1324 // A null tile (i.e. missing recording) can just be skipped. |
1325 // TODO(vmpstr): Verify this is true if we create tiles in raster | |
1326 // iterators. | |
1482 if (!tile) | 1327 if (!tile) |
1483 continue; | 1328 continue; |
1484 | 1329 |
1485 if (tile->required_for_activation() && !tile->IsReadyToDraw()) | 1330 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) |
danakj
2014/09/19 01:41:46
The pieces all look good to me, but can you explai
vmpstr
2014/09/19 21:22:52
The priority of the tile here isn't accessed (IsTi
danakj
2014/09/19 22:30:06
Oh ok. It'd be nice if I could tell from the funct
vmpstr
2014/09/22 18:01:59
Yeah, I want to start kind of assuming that we nev
| |
1486 return false; | 1331 return false; |
1487 } | 1332 } |
1488 } | 1333 } |
1489 | 1334 |
1490 return true; | 1335 return true; |
1491 } | 1336 } |
1492 | 1337 |
1493 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1338 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
1494 : layer_(NULL), current_stage_(arraysize(stages_)) { | 1339 : layer_(NULL), current_stage_(arraysize(stages_)) { |
1495 } | 1340 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1758 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1603 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1759 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1604 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1760 return tiling_range.end - 1 - current_tiling_range_offset; | 1605 return tiling_range.end - 1 - current_tiling_range_offset; |
1761 } | 1606 } |
1762 } | 1607 } |
1763 NOTREACHED(); | 1608 NOTREACHED(); |
1764 return 0; | 1609 return 0; |
1765 } | 1610 } |
1766 | 1611 |
1767 } // namespace cc | 1612 } // namespace cc |
OLD | NEW |