| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <utility> | 10 #include <utility> |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 scoped_refptr<FakePicturePileImpl> active_pile = | 629 scoped_refptr<FakePicturePileImpl> active_pile = |
| 630 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 630 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 631 scoped_refptr<FakePicturePileImpl> lost_pile = | 631 scoped_refptr<FakePicturePileImpl> lost_pile = |
| 632 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 632 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 633 | 633 |
| 634 SetupPendingTreeWithFixedTileSize(lost_pile, gfx::Size(50, 50), Region()); | 634 SetupPendingTreeWithFixedTileSize(lost_pile, gfx::Size(50, 50), Region()); |
| 635 ActivateTree(); | 635 ActivateTree(); |
| 636 // Add a non-shared tiling on the active tree. | 636 // Add a non-shared tiling on the active tree. |
| 637 PictureLayerTiling* tiling = active_layer_->AddTiling(3.f); | 637 PictureLayerTiling* tiling = active_layer_->AddTiling(3.f); |
| 638 tiling->CreateAllTilesForTesting(); | 638 tiling->CreateAllTilesForTesting(); |
| 639 |
| 640 // Ensure UpdateTiles won't remove any tilings. |
| 641 active_layer_->MarkAllTilingsUsed(); |
| 642 |
| 639 // Then setup a new pending tree and activate it. | 643 // Then setup a new pending tree and activate it. |
| 640 SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50), | 644 SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50), |
| 641 layer_invalidation); | 645 layer_invalidation); |
| 642 | 646 |
| 643 EXPECT_EQ(2u, pending_layer_->num_tilings()); | 647 EXPECT_EQ(2u, pending_layer_->num_tilings()); |
| 644 EXPECT_EQ(3u, active_layer_->num_tilings()); | 648 EXPECT_EQ(3u, active_layer_->num_tilings()); |
| 645 | 649 |
| 646 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); | 650 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); |
| 647 EXPECT_GT(tilings->num_tilings(), 0u); | 651 EXPECT_GT(tilings->num_tilings(), 0u); |
| 648 for (size_t i = 0; i < tilings->num_tilings(); ++i) { | 652 for (size_t i = 0; i < tilings->num_tilings(); ++i) { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 // Set up the high and low res tilings before pinch zoom. | 916 // Set up the high and low res tilings before pinch zoom. |
| 913 SetupTrees(pending_pile, active_pile); | 917 SetupTrees(pending_pile, active_pile); |
| 914 ResetTilingsAndRasterScales(); | 918 ResetTilingsAndRasterScales(); |
| 915 | 919 |
| 916 SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, false); | 920 SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, false); |
| 917 EXPECT_BOTH_EQ(num_tilings(), 2u); | 921 EXPECT_BOTH_EQ(num_tilings(), 2u); |
| 918 EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), 2.f); | 922 EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), 2.f); |
| 919 EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(), | 923 EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(), |
| 920 2.f * low_res_factor); | 924 2.f * low_res_factor); |
| 921 | 925 |
| 926 // Ensure UpdateTiles won't remove any tilings. |
| 927 active_layer_->MarkAllTilingsUsed(); |
| 928 |
| 922 // Start a pinch gesture. | 929 // Start a pinch gesture. |
| 923 host_impl_.PinchGestureBegin(); | 930 host_impl_.PinchGestureBegin(); |
| 924 | 931 |
| 925 // Zoom out by a small amount. We should create a tiling at half | 932 // Zoom out by a small amount. We should create a tiling at half |
| 926 // the scale (2/kMaxScaleRatioDuringPinch). | 933 // the scale (2/kMaxScaleRatioDuringPinch). |
| 927 SetContentsScaleOnBothLayers(1.8f, 1.0f, 1.8f, 1.0f, false); | 934 SetContentsScaleOnBothLayers(1.8f, 1.0f, 1.8f, 1.0f, false); |
| 928 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 935 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 929 EXPECT_FLOAT_EQ(2.0f, | 936 EXPECT_FLOAT_EQ(2.0f, |
| 930 active_layer_->tilings()->tiling_at(0)->contents_scale()); | 937 active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 931 EXPECT_FLOAT_EQ(1.0f, | 938 EXPECT_FLOAT_EQ(1.0f, |
| 932 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 939 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 933 EXPECT_FLOAT_EQ(2.0f * low_res_factor, | 940 EXPECT_FLOAT_EQ(2.0f * low_res_factor, |
| 934 active_layer_->tilings()->tiling_at(2)->contents_scale()); | 941 active_layer_->tilings()->tiling_at(2)->contents_scale()); |
| 935 | 942 |
| 943 // Ensure UpdateTiles won't remove any tilings. |
| 944 active_layer_->MarkAllTilingsUsed(); |
| 945 |
| 936 // Zoom out further, close to our low-res scale factor. We should | 946 // Zoom out further, close to our low-res scale factor. We should |
| 937 // use that tiling as high-res, and not create a new tiling. | 947 // use that tiling as high-res, and not create a new tiling. |
| 938 SetContentsScaleOnBothLayers(low_res_factor * 2.1f, 1.0f, | 948 SetContentsScaleOnBothLayers(low_res_factor * 2.1f, 1.0f, |
| 939 low_res_factor * 2.1f, 1.0f, false); | 949 low_res_factor * 2.1f, 1.0f, false); |
| 940 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 950 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 941 | 951 |
| 942 // Zoom in a lot now. Since we increase by increments of | 952 // Zoom in a lot now. Since we increase by increments of |
| 943 // kMaxScaleRatioDuringPinch, this will create a new tiling at 4.0. | 953 // kMaxScaleRatioDuringPinch, this will create a new tiling at 4.0. |
| 944 SetContentsScaleOnBothLayers(3.8f, 1.0f, 3.8f, 1.f, false); | 954 SetContentsScaleOnBothLayers(3.8f, 1.0f, 3.8f, 1.f, false); |
| 945 EXPECT_EQ(4u, active_layer_->tilings()->num_tilings()); | 955 EXPECT_EQ(4u, active_layer_->tilings()->num_tilings()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 962 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 972 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 963 | 973 |
| 964 // Set up the high and low res tilings before pinch zoom. | 974 // Set up the high and low res tilings before pinch zoom. |
| 965 SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, false); | 975 SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, false); |
| 966 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 976 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 967 EXPECT_FLOAT_EQ(0.24f, | 977 EXPECT_FLOAT_EQ(0.24f, |
| 968 active_layer_->tilings()->tiling_at(0)->contents_scale()); | 978 active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 969 EXPECT_FLOAT_EQ(0.0625f, | 979 EXPECT_FLOAT_EQ(0.0625f, |
| 970 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 980 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 971 | 981 |
| 982 // Ensure UpdateTiles won't remove any tilings. |
| 983 active_layer_->MarkAllTilingsUsed(); |
| 984 |
| 972 // Start a pinch gesture. | 985 // Start a pinch gesture. |
| 973 host_impl_.PinchGestureBegin(); | 986 host_impl_.PinchGestureBegin(); |
| 974 | 987 |
| 975 // Zoom out by a small amount. We should create a tiling at half | 988 // Zoom out by a small amount. We should create a tiling at half |
| 976 // the scale (1/kMaxScaleRatioDuringPinch). | 989 // the scale (1/kMaxScaleRatioDuringPinch). |
| 977 SetContentsScaleOnBothLayers(0.2f, 1.0f, 0.2f, 1.0f, false); | 990 SetContentsScaleOnBothLayers(0.2f, 1.0f, 0.2f, 1.0f, false); |
| 978 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 991 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 979 EXPECT_FLOAT_EQ(0.24f, | 992 EXPECT_FLOAT_EQ(0.24f, |
| 980 active_layer_->tilings()->tiling_at(0)->contents_scale()); | 993 active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 981 EXPECT_FLOAT_EQ(0.12f, | 994 EXPECT_FLOAT_EQ(0.12f, |
| 982 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 995 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 983 EXPECT_FLOAT_EQ(0.0625, | 996 EXPECT_FLOAT_EQ(0.0625, |
| 984 active_layer_->tilings()->tiling_at(2)->contents_scale()); | 997 active_layer_->tilings()->tiling_at(2)->contents_scale()); |
| 985 | 998 |
| 999 // Ensure UpdateTiles won't remove any tilings. |
| 1000 active_layer_->MarkAllTilingsUsed(); |
| 1001 |
| 986 // Zoom out further, close to our low-res scale factor. We should | 1002 // Zoom out further, close to our low-res scale factor. We should |
| 987 // use that tiling as high-res, and not create a new tiling. | 1003 // use that tiling as high-res, and not create a new tiling. |
| 988 SetContentsScaleOnBothLayers(0.1f, 1.0f, 0.1f, 1.0f, false); | 1004 SetContentsScaleOnBothLayers(0.1f, 1.0f, 0.1f, 1.0f, false); |
| 989 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 1005 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 990 | 1006 |
| 991 // Zoom in. 0.25(desired_scale) should be snapped to 0.24 during zoom-in | 1007 // Zoom in. 0.25(desired_scale) should be snapped to 0.24 during zoom-in |
| 992 // because 0.25(desired_scale) is within the ratio(1.2). | 1008 // because 0.25(desired_scale) is within the ratio(1.2). |
| 993 SetContentsScaleOnBothLayers(0.25f, 1.0f, 0.25f, 1.0f, false); | 1009 SetContentsScaleOnBothLayers(0.25f, 1.0f, 0.25f, 1.0f, false); |
| 994 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 1010 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 995 | 1011 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1015 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 1031 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
| 1016 EXPECT_LT(low_res_factor, 1.f); | 1032 EXPECT_LT(low_res_factor, 1.f); |
| 1017 | 1033 |
| 1018 float scale = 1.f; | 1034 float scale = 1.f; |
| 1019 float page_scale = 1.f; | 1035 float page_scale = 1.f; |
| 1020 | 1036 |
| 1021 SetupTrees(pending_pile, active_pile); | 1037 SetupTrees(pending_pile, active_pile); |
| 1022 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 1038 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 1023 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); | 1039 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); |
| 1024 | 1040 |
| 1041 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
| 1042 // |used_tilings| variable, and it's here only to ensure that active_layer_ |
| 1043 // won't remove tilings before the test has a chance to verify behavior. |
| 1044 active_layer_->MarkAllTilingsUsed(); |
| 1045 |
| 1025 // We only have ideal tilings, so they aren't removed. | 1046 // We only have ideal tilings, so they aren't removed. |
| 1026 used_tilings.clear(); | 1047 used_tilings.clear(); |
| 1027 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 1048 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 1028 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 1049 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 1029 | 1050 |
| 1030 host_impl_.PinchGestureBegin(); | 1051 host_impl_.PinchGestureBegin(); |
| 1031 | 1052 |
| 1032 // Changing the ideal but not creating new tilings. | 1053 // Changing the ideal but not creating new tilings. |
| 1033 scale = 1.5f; | 1054 scale = 1.5f; |
| 1034 page_scale = 1.5f; | 1055 page_scale = 1.5f; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1047 page_scale = 1.2f; | 1068 page_scale = 1.2f; |
| 1048 SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, false); | 1069 SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, false); |
| 1049 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); | 1070 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); |
| 1050 EXPECT_FLOAT_EQ( | 1071 EXPECT_FLOAT_EQ( |
| 1051 1.f, | 1072 1.f, |
| 1052 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 1073 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 1053 EXPECT_FLOAT_EQ( | 1074 EXPECT_FLOAT_EQ( |
| 1054 1.f * low_res_factor, | 1075 1.f * low_res_factor, |
| 1055 active_layer_->tilings()->tiling_at(3)->contents_scale()); | 1076 active_layer_->tilings()->tiling_at(3)->contents_scale()); |
| 1056 | 1077 |
| 1078 // Ensure UpdateTiles won't remove any tilings. |
| 1079 active_layer_->MarkAllTilingsUsed(); |
| 1080 |
| 1057 // Mark the non-ideal tilings as used. They won't be removed. | 1081 // Mark the non-ideal tilings as used. They won't be removed. |
| 1058 used_tilings.clear(); | 1082 used_tilings.clear(); |
| 1059 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); | 1083 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
| 1060 used_tilings.push_back(active_layer_->tilings()->tiling_at(3)); | 1084 used_tilings.push_back(active_layer_->tilings()->tiling_at(3)); |
| 1061 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 1085 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 1062 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); | 1086 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); |
| 1063 | 1087 |
| 1064 // Now move the ideal scale to 0.5. Our target stays 1.2. | 1088 // Now move the ideal scale to 0.5. Our target stays 1.2. |
| 1065 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, false); | 1089 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, false); |
| 1066 | 1090 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 animating_transform = false; | 1163 animating_transform = false; |
| 1140 SetContentsScaleOnBothLayers(contents_scale, | 1164 SetContentsScaleOnBothLayers(contents_scale, |
| 1141 device_scale, | 1165 device_scale, |
| 1142 page_scale, | 1166 page_scale, |
| 1143 maximum_animation_scale, | 1167 maximum_animation_scale, |
| 1144 animating_transform); | 1168 animating_transform); |
| 1145 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 1169 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
| 1146 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); | 1170 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
| 1147 EXPECT_BOTH_EQ(num_tilings(), 2u); | 1171 EXPECT_BOTH_EQ(num_tilings(), 2u); |
| 1148 | 1172 |
| 1173 // Ensure UpdateTiles won't remove any tilings. |
| 1174 active_layer_->MarkAllTilingsUsed(); |
| 1175 |
| 1149 // Page scale animation, new high res, but no low res. We still have | 1176 // Page scale animation, new high res, but no low res. We still have |
| 1150 // a tiling at the previous scale, it's just not marked as low res on the | 1177 // a tiling at the previous scale, it's just not marked as low res on the |
| 1151 // active layer. The pending layer drops non-ideal tilings. | 1178 // active layer. The pending layer drops non-ideal tilings. |
| 1152 contents_scale = 2.f; | 1179 contents_scale = 2.f; |
| 1153 page_scale = 2.f; | 1180 page_scale = 2.f; |
| 1154 maximum_animation_scale = 2.f; | 1181 maximum_animation_scale = 2.f; |
| 1155 animating_transform = true; | 1182 animating_transform = true; |
| 1156 SetContentsScaleOnBothLayers(contents_scale, | 1183 SetContentsScaleOnBothLayers(contents_scale, |
| 1157 device_scale, | 1184 device_scale, |
| 1158 page_scale, | 1185 page_scale, |
| (...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3605 | 3632 |
| 3606 float device_scale = 1.7f; | 3633 float device_scale = 1.7f; |
| 3607 float page_scale = 3.2f; | 3634 float page_scale = 3.2f; |
| 3608 float scale = 1.f; | 3635 float scale = 1.f; |
| 3609 | 3636 |
| 3610 ResetTilingsAndRasterScales(); | 3637 ResetTilingsAndRasterScales(); |
| 3611 | 3638 |
| 3612 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); | 3639 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); |
| 3613 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3640 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3614 | 3641 |
| 3642 // Ensure UpdateTiles won't remove any tilings. |
| 3643 active_layer_->MarkAllTilingsUsed(); |
| 3644 |
| 3645 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
| 3646 // |used_tilings| variable, and it's here only to ensure that active_layer_ |
| 3647 // won't remove tilings before the test has a chance to verify behavior. |
| 3648 active_layer_->MarkAllTilingsUsed(); |
| 3649 |
| 3615 // We only have ideal tilings, so they aren't removed. | 3650 // We only have ideal tilings, so they aren't removed. |
| 3616 used_tilings.clear(); | 3651 used_tilings.clear(); |
| 3617 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 3652 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 3618 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3653 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3619 | 3654 |
| 3620 host_impl_.PinchGestureBegin(); | 3655 host_impl_.PinchGestureBegin(); |
| 3621 | 3656 |
| 3622 // Changing the ideal but not creating new tilings. | 3657 // Changing the ideal but not creating new tilings. |
| 3623 scale *= 1.5f; | 3658 scale *= 1.5f; |
| 3624 page_scale *= 1.5f; | 3659 page_scale *= 1.5f; |
| 3625 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); | 3660 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); |
| 3626 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3661 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3627 | 3662 |
| 3628 // The tilings are still our target scale, so they aren't removed. | 3663 // The tilings are still our target scale, so they aren't removed. |
| 3629 used_tilings.clear(); | 3664 used_tilings.clear(); |
| 3630 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 3665 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 3631 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3666 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3632 | 3667 |
| 3633 host_impl_.PinchGestureEnd(); | 3668 host_impl_.PinchGestureEnd(); |
| 3634 | 3669 |
| 3635 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. | 3670 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. |
| 3636 scale /= 4.f; | 3671 scale /= 4.f; |
| 3637 page_scale /= 4.f; | 3672 page_scale /= 4.f; |
| 3638 SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, false); | 3673 SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, false); |
| 3639 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 3674 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 3640 EXPECT_FLOAT_EQ(1.f, | 3675 EXPECT_FLOAT_EQ(1.f, |
| 3641 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 3676 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 3642 | 3677 |
| 3678 // Ensure UpdateTiles won't remove any tilings. |
| 3679 active_layer_->MarkAllTilingsUsed(); |
| 3680 |
| 3643 // Mark the non-ideal tilings as used. They won't be removed. | 3681 // Mark the non-ideal tilings as used. They won't be removed. |
| 3644 used_tilings.clear(); | 3682 used_tilings.clear(); |
| 3645 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); | 3683 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
| 3646 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 3684 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 3647 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 3685 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 3648 | 3686 |
| 3649 // Now move the ideal scale to 0.5. Our target stays 1.2. | 3687 // Now move the ideal scale to 0.5. Our target stays 1.2. |
| 3650 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, false); | 3688 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, false); |
| 3651 | 3689 |
| 3652 // The high resolution tiling is between target and ideal, so is not | 3690 // The high resolution tiling is between target and ideal, so is not |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4882 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4920 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4883 EXPECT_EQ(result.width(), 448); | 4921 EXPECT_EQ(result.width(), 448); |
| 4884 EXPECT_EQ(result.height(), 448); | 4922 EXPECT_EQ(result.height(), 448); |
| 4885 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4923 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4886 EXPECT_EQ(result.width(), 512); | 4924 EXPECT_EQ(result.width(), 512); |
| 4887 EXPECT_EQ(result.height(), 500 + 2); | 4925 EXPECT_EQ(result.height(), 500 + 2); |
| 4888 } | 4926 } |
| 4889 | 4927 |
| 4890 } // namespace | 4928 } // namespace |
| 4891 } // namespace cc | 4929 } // namespace cc |
| OLD | NEW |