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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 ideal_page_scale_(0.f), | 54 ideal_page_scale_(0.f), |
55 ideal_device_scale_(0.f), | 55 ideal_device_scale_(0.f), |
56 ideal_source_scale_(0.f), | 56 ideal_source_scale_(0.f), |
57 ideal_contents_scale_(0.f), | 57 ideal_contents_scale_(0.f), |
58 raster_page_scale_(0.f), | 58 raster_page_scale_(0.f), |
59 raster_device_scale_(0.f), | 59 raster_device_scale_(0.f), |
60 raster_source_scale_(0.f), | 60 raster_source_scale_(0.f), |
61 raster_contents_scale_(0.f), | 61 raster_contents_scale_(0.f), |
62 low_res_raster_contents_scale_(0.f), | 62 low_res_raster_contents_scale_(0.f), |
63 raster_source_scale_is_fixed_(false), | 63 raster_source_scale_is_fixed_(false), |
64 was_animating_transform_to_screen_(false), | 64 was_screen_space_transform_animating_(false), |
65 needs_post_commit_initialization_(true), | 65 needs_post_commit_initialization_(true), |
66 should_update_tile_priorities_(false) { | 66 should_update_tile_priorities_(false) { |
67 layer_tree_impl()->RegisterPictureLayerImpl(this); | 67 layer_tree_impl()->RegisterPictureLayerImpl(this); |
68 } | 68 } |
69 | 69 |
70 PictureLayerImpl::~PictureLayerImpl() { | 70 PictureLayerImpl::~PictureLayerImpl() { |
71 layer_tree_impl()->UnregisterPictureLayerImpl(this); | 71 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
72 } | 72 } |
73 | 73 |
74 const char* PictureLayerImpl::LayerTypeAsString() const { | 74 const char* PictureLayerImpl::LayerTypeAsString() const { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 on_demand_missing_tile_count); | 379 on_demand_missing_tile_count); |
380 } | 380 } |
381 | 381 |
382 // Aggressively remove any tilings that are not seen to save memory. Note | 382 // Aggressively remove any tilings that are not seen to save memory. Note |
383 // that this is at the expense of doing cause more frequent re-painting. A | 383 // that this is at the expense of doing cause more frequent re-painting. A |
384 // better scheme would be to maintain a tighter visible_content_rect for the | 384 // better scheme would be to maintain a tighter visible_content_rect for the |
385 // finer tilings. | 385 // finer tilings. |
386 CleanUpTilingsOnActiveLayer(seen_tilings); | 386 CleanUpTilingsOnActiveLayer(seen_tilings); |
387 } | 387 } |
388 | 388 |
389 void PictureLayerImpl::UpdateTilePriorities() { | 389 void PictureLayerImpl::UpdateTiles() { |
390 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 390 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles"); |
391 | 391 |
392 DoPostCommitInitializationIfNeeded(); | 392 DoPostCommitInitializationIfNeeded(); |
393 | 393 |
394 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { | 394 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { |
395 visible_rect_for_tile_priority_ = visible_content_rect(); | 395 visible_rect_for_tile_priority_ = visible_content_rect(); |
396 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); | 396 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); |
397 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 397 screen_space_transform_for_tile_priority_ = screen_space_transform(); |
398 } | 398 } |
399 | 399 |
400 if (!CanHaveTilings()) { | 400 if (!CanHaveTilings()) { |
401 ideal_page_scale_ = 0.f; | 401 ideal_page_scale_ = 0.f; |
402 ideal_device_scale_ = 0.f; | 402 ideal_device_scale_ = 0.f; |
403 ideal_contents_scale_ = 0.f; | 403 ideal_contents_scale_ = 0.f; |
404 ideal_source_scale_ = 0.f; | 404 ideal_source_scale_ = 0.f; |
405 SanityCheckTilingState(); | 405 SanityCheckTilingState(); |
406 return; | 406 return; |
407 } | 407 } |
408 | 408 |
409 UpdateIdealScales(); | |
410 | |
411 DCHECK(tilings_->num_tilings() > 0 || raster_contents_scale_ == 0.f) | |
412 << "A layer with no tilings shouldn't have valid raster scales"; | |
413 if (!raster_contents_scale_ || ShouldAdjustRasterScale()) { | |
414 RecalculateRasterScales(); | |
415 AddTilingsForRasterScale(); | |
416 } | |
417 | |
418 DCHECK(raster_page_scale_); | |
419 DCHECK(raster_device_scale_); | |
420 DCHECK(raster_source_scale_); | |
421 DCHECK(raster_contents_scale_); | |
422 DCHECK(low_res_raster_contents_scale_); | |
423 | |
424 was_screen_space_transform_animating_ = | |
425 draw_properties().screen_space_transform_is_animating; | |
426 | |
409 // TODO(sohanjg): Avoid needlessly update priorities when syncing to a | 427 // TODO(sohanjg): Avoid needlessly update priorities when syncing to a |
410 // non-updated tree which will then be updated immediately afterwards. | 428 // non-updated tree which will then be updated immediately afterwards. |
411 should_update_tile_priorities_ = true; | 429 should_update_tile_priorities_ = true; |
412 | 430 |
413 UpdateIdealScales(); | 431 UpdateTilePriorities(); |
414 ManageTilings(draw_properties().screen_space_transform_is_animating, | |
415 draw_properties().maximum_animation_contents_scale); | |
416 | 432 |
417 if (!tilings_->num_tilings()) | 433 if (layer_tree_impl()->IsPendingTree()) |
418 return; | 434 MarkVisibleResourcesAsRequired(); |
435 } | |
436 | |
437 void PictureLayerImpl::UpdateTilePriorities() { | |
438 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | |
419 | 439 |
420 double current_frame_time_in_seconds = | 440 double current_frame_time_in_seconds = |
421 (layer_tree_impl()->CurrentFrameTimeTicks() - | 441 (layer_tree_impl()->CurrentFrameTimeTicks() - |
422 base::TimeTicks()).InSecondsF(); | 442 base::TimeTicks()).InSecondsF(); |
423 | 443 |
424 bool tiling_needs_update = false; | 444 bool tiling_needs_update = false; |
425 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 445 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
426 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( | 446 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( |
427 current_frame_time_in_seconds)) { | 447 current_frame_time_in_seconds)) { |
428 tiling_needs_update = true; | 448 tiling_needs_update = true; |
(...skipping 14 matching lines...) Expand all Loading... | |
443 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 463 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
444 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); | 464 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); |
445 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); | 465 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); |
446 } | 466 } |
447 } | 467 } |
448 | 468 |
449 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 469 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
450 visible_rect_in_content_space, 1.f / contents_scale_x()); | 470 visible_rect_in_content_space, 1.f / contents_scale_x()); |
451 WhichTree tree = | 471 WhichTree tree = |
452 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 472 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
453 // TODO(sohanjg): Passing MaximumContentsScale as layer contents scale | 473 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
454 // in UpdateTilePriorities is wrong and should be ideal contents scale. | 474 // TODO(sohanjg): Passing MaximumContentsScale as layer contents scale |
455 tilings_->UpdateTilePriorities(tree, | 475 // in UpdateTilePriorities is wrong and should be ideal contents scale. |
456 visible_layer_rect, | 476 tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
457 MaximumTilingContentsScale(), | 477 visible_layer_rect, |
458 current_frame_time_in_seconds); | 478 MaximumTilingContentsScale(), |
459 | 479 current_frame_time_in_seconds); |
460 if (layer_tree_impl()->IsPendingTree()) | 480 } |
461 MarkVisibleResourcesAsRequired(); | |
462 | 481 |
463 // Tile priorities were modified. | 482 // Tile priorities were modified. |
464 layer_tree_impl()->DidModifyTilePriorities(); | 483 layer_tree_impl()->DidModifyTilePriorities(); |
465 } | 484 } |
466 | 485 |
467 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 486 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
468 if (layer_tree_impl()->IsActiveTree()) { | 487 if (layer_tree_impl()->IsActiveTree()) { |
469 gfx::RectF layer_damage_rect = | 488 gfx::RectF layer_damage_rect = |
470 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); | 489 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); |
471 AddDamageRect(layer_damage_rect); | 490 AddDamageRect(layer_damage_rect); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 iter->GetTileVersionForDrawing(); | 753 iter->GetTileVersionForDrawing(); |
735 if (!tile_version.IsReadyToDraw() || | 754 if (!tile_version.IsReadyToDraw() || |
736 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) | 755 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) |
737 return 0; | 756 return 0; |
738 | 757 |
739 return tile_version.get_resource_id(); | 758 return tile_version.get_resource_id(); |
740 } | 759 } |
741 | 760 |
742 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { | 761 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { |
743 DCHECK(layer_tree_impl()->IsPendingTree()); | 762 DCHECK(layer_tree_impl()->IsPendingTree()); |
744 DCHECK(!layer_tree_impl()->needs_update_draw_properties()); | |
enne (OOO)
2014/06/19 17:38:49
Why does this go away?
danakj
2014/06/19 17:43:37
This is guaranteed by the callstack now, we only c
| |
745 DCHECK(ideal_contents_scale_); | 763 DCHECK(ideal_contents_scale_); |
746 DCHECK_GT(tilings_->num_tilings(), 0u); | 764 DCHECK_GT(tilings_->num_tilings(), 0u); |
747 | 765 |
748 // The goal of this function is to find the minimum set of tiles that need to | 766 // The goal of this function is to find the minimum set of tiles that need to |
749 // be ready to draw in order to activate without flashing content from a | 767 // be ready to draw in order to activate without flashing content from a |
750 // higher res on the active tree to a lower res on the pending tree. | 768 // higher res on the active tree to a lower res on the pending tree. |
751 | 769 |
752 // First, early out for layers with no visible content. | 770 // First, early out for layers with no visible content. |
753 if (visible_content_rect().IsEmpty()) | 771 if (visible_content_rect().IsEmpty()) |
754 return; | 772 return; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 namespace { | 966 namespace { |
949 | 967 |
950 inline float PositiveRatio(float float1, float float2) { | 968 inline float PositiveRatio(float float1, float float2) { |
951 DCHECK_GT(float1, 0); | 969 DCHECK_GT(float1, 0); |
952 DCHECK_GT(float2, 0); | 970 DCHECK_GT(float2, 0); |
953 return float1 > float2 ? float1 / float2 : float2 / float1; | 971 return float1 > float2 ? float1 / float2 : float2 / float1; |
954 } | 972 } |
955 | 973 |
956 } // namespace | 974 } // namespace |
957 | 975 |
958 void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen, | 976 void PictureLayerImpl::AddTilingsForRasterScale() { |
959 float maximum_animation_contents_scale) { | |
960 DCHECK(ideal_contents_scale_); | |
961 DCHECK(ideal_page_scale_); | |
962 DCHECK(ideal_device_scale_); | |
963 DCHECK(ideal_source_scale_); | |
964 DCHECK(CanHaveTilings()); | |
965 DCHECK(!needs_post_commit_initialization_); | |
966 | |
967 bool change_target_tiling = | |
968 raster_page_scale_ == 0.f || | |
969 raster_device_scale_ == 0.f || | |
970 raster_source_scale_ == 0.f || | |
971 raster_contents_scale_ == 0.f || | |
972 low_res_raster_contents_scale_ == 0.f || | |
973 ShouldAdjustRasterScale(animating_transform_to_screen); | |
974 | |
975 if (tilings_->num_tilings() == 0) { | |
976 DCHECK(change_target_tiling) | |
977 << "A layer with no tilings shouldn't have valid raster scales"; | |
978 } | |
979 | |
980 if (change_target_tiling) { | |
981 RecalculateRasterScales(animating_transform_to_screen, | |
982 maximum_animation_contents_scale); | |
983 } | |
984 | |
985 was_animating_transform_to_screen_ = animating_transform_to_screen; | |
986 | |
987 if (!change_target_tiling) | |
988 return; | |
989 | |
990 PictureLayerTiling* high_res = NULL; | 977 PictureLayerTiling* high_res = NULL; |
991 PictureLayerTiling* low_res = NULL; | 978 PictureLayerTiling* low_res = NULL; |
992 | 979 |
993 PictureLayerTiling* previous_low_res = NULL; | 980 PictureLayerTiling* previous_low_res = NULL; |
994 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 981 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
995 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 982 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
996 if (tiling->contents_scale() == raster_contents_scale_) | 983 if (tiling->contents_scale() == raster_contents_scale_) |
997 high_res = tiling; | 984 high_res = tiling; |
998 if (tiling->contents_scale() == low_res_raster_contents_scale_) | 985 if (tiling->contents_scale() == low_res_raster_contents_scale_) |
999 low_res = tiling; | 986 low_res = tiling; |
1000 if (tiling->resolution() == LOW_RESOLUTION) | 987 if (tiling->resolution() == LOW_RESOLUTION) |
1001 previous_low_res = tiling; | 988 previous_low_res = tiling; |
1002 | 989 |
1003 // Reset all tilings to non-ideal until the end of this function. | 990 // Reset all tilings to non-ideal until the end of this function. |
1004 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 991 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
1005 } | 992 } |
1006 | 993 |
1007 if (!high_res) { | 994 if (!high_res) { |
1008 high_res = AddTiling(raster_contents_scale_); | 995 high_res = AddTiling(raster_contents_scale_); |
1009 if (raster_contents_scale_ == low_res_raster_contents_scale_) | 996 if (raster_contents_scale_ == low_res_raster_contents_scale_) |
1010 low_res = high_res; | 997 low_res = high_res; |
1011 } | 998 } |
1012 | 999 |
1013 // Only create new low res tilings when the transform is static. This | 1000 // Only create new low res tilings when the transform is static. This |
1014 // prevents wastefully creating a paired low res tiling for every new high res | 1001 // prevents wastefully creating a paired low res tiling for every new high res |
1015 // tiling during a pinch or a CSS animation. | 1002 // tiling during a pinch or a CSS animation. |
1016 bool is_pinching = layer_tree_impl()->PinchGestureActive(); | 1003 bool is_pinching = layer_tree_impl()->PinchGestureActive(); |
1017 if (layer_tree_impl()->create_low_res_tiling() && !is_pinching && | 1004 if (layer_tree_impl()->create_low_res_tiling() && !is_pinching && |
1018 !animating_transform_to_screen && !low_res && low_res != high_res) | 1005 !draw_properties().screen_space_transform_is_animating && !low_res && |
1006 low_res != high_res) | |
1019 low_res = AddTiling(low_res_raster_contents_scale_); | 1007 low_res = AddTiling(low_res_raster_contents_scale_); |
1020 | 1008 |
1021 // Set low-res if we have one. | 1009 // Set low-res if we have one. |
1022 if (!low_res) | 1010 if (!low_res) |
1023 low_res = previous_low_res; | 1011 low_res = previous_low_res; |
1024 if (low_res && low_res != high_res) | 1012 if (low_res && low_res != high_res) |
1025 low_res->set_resolution(LOW_RESOLUTION); | 1013 low_res->set_resolution(LOW_RESOLUTION); |
1026 | 1014 |
1027 // Make sure we always have one high-res (even if high == low). | 1015 // Make sure we always have one high-res (even if high == low). |
1028 high_res->set_resolution(HIGH_RESOLUTION); | 1016 high_res->set_resolution(HIGH_RESOLUTION); |
1029 | 1017 |
1030 SanityCheckTilingState(); | 1018 SanityCheckTilingState(); |
1031 } | 1019 } |
1032 | 1020 |
1033 bool PictureLayerImpl::ShouldAdjustRasterScale( | 1021 bool PictureLayerImpl::ShouldAdjustRasterScale() const { |
1034 bool animating_transform_to_screen) const { | 1022 if (was_screen_space_transform_animating_ != |
1035 if (was_animating_transform_to_screen_ != animating_transform_to_screen) | 1023 draw_properties().screen_space_transform_is_animating) |
1036 return true; | 1024 return true; |
1037 | 1025 |
1038 bool is_pinching = layer_tree_impl()->PinchGestureActive(); | 1026 bool is_pinching = layer_tree_impl()->PinchGestureActive(); |
1039 if (is_pinching && raster_page_scale_) { | 1027 if (is_pinching && raster_page_scale_) { |
1040 // We change our raster scale when it is: | 1028 // We change our raster scale when it is: |
1041 // - Higher than ideal (need a lower-res tiling available) | 1029 // - Higher than ideal (need a lower-res tiling available) |
1042 // - Too far from ideal (need a higher-res tiling available) | 1030 // - Too far from ideal (need a higher-res tiling available) |
1043 float ratio = ideal_page_scale_ / raster_page_scale_; | 1031 float ratio = ideal_page_scale_ / raster_page_scale_; |
1044 if (raster_page_scale_ > ideal_page_scale_ || | 1032 if (raster_page_scale_ > ideal_page_scale_ || |
1045 ratio > kMaxScaleRatioDuringPinch) | 1033 ratio > kMaxScaleRatioDuringPinch) |
1046 return true; | 1034 return true; |
1047 } | 1035 } |
1048 | 1036 |
1049 if (!is_pinching) { | 1037 if (!is_pinching) { |
1050 // When not pinching, match the ideal page scale factor. | 1038 // When not pinching, match the ideal page scale factor. |
1051 if (raster_page_scale_ != ideal_page_scale_) | 1039 if (raster_page_scale_ != ideal_page_scale_) |
1052 return true; | 1040 return true; |
1053 } | 1041 } |
1054 | 1042 |
1055 // Always match the ideal device scale factor. | 1043 // Always match the ideal device scale factor. |
1056 if (raster_device_scale_ != ideal_device_scale_) | 1044 if (raster_device_scale_ != ideal_device_scale_) |
1057 return true; | 1045 return true; |
1058 | 1046 |
1059 // When the source scale changes we want to match it, but not when animating | 1047 // When the source scale changes we want to match it, but not when animating |
1060 // or when we've fixed the scale in place. | 1048 // or when we've fixed the scale in place. |
1061 if (!animating_transform_to_screen && !raster_source_scale_is_fixed_ && | 1049 if (!draw_properties().screen_space_transform_is_animating && |
1050 !raster_source_scale_is_fixed_ && | |
1062 raster_source_scale_ != ideal_source_scale_) | 1051 raster_source_scale_ != ideal_source_scale_) |
1063 return true; | 1052 return true; |
1064 | 1053 |
1065 return false; | 1054 return false; |
1066 } | 1055 } |
1067 | 1056 |
1068 float PictureLayerImpl::SnappedContentsScale(float scale) { | 1057 float PictureLayerImpl::SnappedContentsScale(float scale) { |
1069 // If a tiling exists within the max snapping ratio, snap to its scale. | 1058 // If a tiling exists within the max snapping ratio, snap to its scale. |
1070 float snapped_contents_scale = scale; | 1059 float snapped_contents_scale = scale; |
1071 float snapped_ratio = kSnapToExistingTilingRatio; | 1060 float snapped_ratio = kSnapToExistingTilingRatio; |
1072 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1061 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
1073 float tiling_contents_scale = tilings_->tiling_at(i)->contents_scale(); | 1062 float tiling_contents_scale = tilings_->tiling_at(i)->contents_scale(); |
1074 float ratio = PositiveRatio(tiling_contents_scale, scale); | 1063 float ratio = PositiveRatio(tiling_contents_scale, scale); |
1075 if (ratio < snapped_ratio) { | 1064 if (ratio < snapped_ratio) { |
1076 snapped_contents_scale = tiling_contents_scale; | 1065 snapped_contents_scale = tiling_contents_scale; |
1077 snapped_ratio = ratio; | 1066 snapped_ratio = ratio; |
1078 } | 1067 } |
1079 } | 1068 } |
1080 return snapped_contents_scale; | 1069 return snapped_contents_scale; |
1081 } | 1070 } |
1082 | 1071 |
1083 void PictureLayerImpl::RecalculateRasterScales( | 1072 void PictureLayerImpl::RecalculateRasterScales() { |
1084 bool animating_transform_to_screen, | |
1085 float maximum_animation_contents_scale) { | |
1086 float old_raster_contents_scale = raster_contents_scale_; | 1073 float old_raster_contents_scale = raster_contents_scale_; |
1087 float old_raster_page_scale = raster_page_scale_; | 1074 float old_raster_page_scale = raster_page_scale_; |
1088 float old_raster_source_scale = raster_source_scale_; | 1075 float old_raster_source_scale = raster_source_scale_; |
1089 | 1076 |
1090 raster_device_scale_ = ideal_device_scale_; | 1077 raster_device_scale_ = ideal_device_scale_; |
1091 raster_page_scale_ = ideal_page_scale_; | 1078 raster_page_scale_ = ideal_page_scale_; |
1092 raster_source_scale_ = ideal_source_scale_; | 1079 raster_source_scale_ = ideal_source_scale_; |
1093 raster_contents_scale_ = ideal_contents_scale_; | 1080 raster_contents_scale_ = ideal_contents_scale_; |
1094 | 1081 |
1095 // If we're not animating, or leaving an animation, and the | 1082 // If we're not animating, or leaving an animation, and the |
1096 // ideal_source_scale_ changes, then things are unpredictable, and we fix | 1083 // ideal_source_scale_ changes, then things are unpredictable, and we fix |
1097 // the raster_source_scale_ in place. | 1084 // the raster_source_scale_ in place. |
1098 if (old_raster_source_scale && !animating_transform_to_screen && | 1085 if (old_raster_source_scale && |
1099 !was_animating_transform_to_screen_ && | 1086 !draw_properties().screen_space_transform_is_animating && |
1087 !was_screen_space_transform_animating_ && | |
1100 old_raster_source_scale != ideal_source_scale_) | 1088 old_raster_source_scale != ideal_source_scale_) |
1101 raster_source_scale_is_fixed_ = true; | 1089 raster_source_scale_is_fixed_ = true; |
1102 | 1090 |
1103 // TODO(danakj): Adjust raster source scale closer to ideal source scale at | 1091 // TODO(danakj): Adjust raster source scale closer to ideal source scale at |
1104 // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending | 1092 // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending |
1105 // tree. This will allow CSS scale changes to get re-rastered at an | 1093 // tree. This will allow CSS scale changes to get re-rastered at an |
1106 // appropriate rate. | 1094 // appropriate rate. |
1107 if (raster_source_scale_is_fixed_) { | 1095 if (raster_source_scale_is_fixed_) { |
1108 raster_contents_scale_ /= raster_source_scale_; | 1096 raster_contents_scale_ /= raster_source_scale_; |
1109 raster_source_scale_ = 1.f; | 1097 raster_source_scale_ = 1.f; |
(...skipping 15 matching lines...) Expand all Loading... | |
1125 raster_page_scale_ = | 1113 raster_page_scale_ = |
1126 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; | 1114 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; |
1127 } | 1115 } |
1128 | 1116 |
1129 raster_contents_scale_ = | 1117 raster_contents_scale_ = |
1130 std::max(raster_contents_scale_, MinimumContentsScale()); | 1118 std::max(raster_contents_scale_, MinimumContentsScale()); |
1131 | 1119 |
1132 // Since we're not re-rasterizing during animation, rasterize at the maximum | 1120 // Since we're not re-rasterizing during animation, rasterize at the maximum |
1133 // scale that will occur during the animation, if the maximum scale is | 1121 // scale that will occur during the animation, if the maximum scale is |
1134 // known. | 1122 // known. |
1135 if (animating_transform_to_screen) { | 1123 if (draw_properties().screen_space_transform_is_animating) { |
1136 if (maximum_animation_contents_scale > 0.f) { | 1124 if (draw_properties().maximum_animation_contents_scale > 0.f) { |
1137 raster_contents_scale_ = | 1125 raster_contents_scale_ = |
1138 std::max(raster_contents_scale_, maximum_animation_contents_scale); | 1126 std::max(raster_contents_scale_, |
1127 draw_properties().maximum_animation_contents_scale); | |
1139 } else { | 1128 } else { |
1140 raster_contents_scale_ = | 1129 raster_contents_scale_ = |
1141 std::max(raster_contents_scale_, | 1130 std::max(raster_contents_scale_, |
1142 1.f * ideal_page_scale_ * ideal_device_scale_); | 1131 1.f * ideal_page_scale_ * ideal_device_scale_); |
1143 } | 1132 } |
1144 } | 1133 } |
1145 | 1134 |
1146 // If this layer would only create one tile at this content scale, | 1135 // If this layer would only create one tile at this content scale, |
1147 // don't create a low res tiling. | 1136 // don't create a low res tiling. |
1148 gfx::Size content_bounds = | 1137 gfx::Size content_bounds = |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1637 return iterator_index_ < iterators_.size(); | 1626 return iterator_index_ < iterators_.size(); |
1638 } | 1627 } |
1639 | 1628 |
1640 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1629 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1641 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1630 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1642 return it->get_type() == iteration_stage_ && | 1631 return it->get_type() == iteration_stage_ && |
1643 (**it)->required_for_activation() == required_for_activation_; | 1632 (**it)->required_for_activation() == required_for_activation_; |
1644 } | 1633 } |
1645 | 1634 |
1646 } // namespace cc | 1635 } // namespace cc |
OLD | NEW |