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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 918 |
919 std::vector<PictureLayerTiling*> used_tilings; | 919 std::vector<PictureLayerTiling*> used_tilings; |
920 | 920 |
921 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; | 921 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; |
922 EXPECT_LT(low_res_factor, 1.f); | 922 EXPECT_LT(low_res_factor, 1.f); |
923 | 923 |
924 float scale = 1.f; | 924 float scale = 1.f; |
925 float page_scale = 1.f; | 925 float page_scale = 1.f; |
926 | 926 |
927 SetupDefaultTrees(layer_bounds); | 927 SetupDefaultTrees(layer_bounds); |
928 EXPECT_EQ(2u, active_layer()->tilings()->num_tilings()); | 928 active_layer()->SetHasWillChangeTransformHint(true); |
929 EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale()); | 929 EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings()); |
| 930 EXPECT_FLOAT_EQ(1.f, |
| 931 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 932 EXPECT_FLOAT_EQ(1.f * low_res_factor, |
| 933 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
930 | 934 |
931 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to | 935 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
932 // |used_tilings| variable, and it's here only to ensure that active_layer() | 936 // |used_tilings| variable, and it's here only to ensure that active_layer() |
933 // won't remove tilings before the test has a chance to verify behavior. | 937 // won't remove tilings before the test has a chance to verify behavior. |
934 active_layer()->MarkAllTilingsUsed(); | 938 active_layer()->MarkAllTilingsUsed(); |
935 | 939 |
936 // We only have ideal tilings, so they aren't removed. | 940 // We only have ideal tilings, so they aren't removed. |
937 used_tilings.clear(); | 941 used_tilings.clear(); |
938 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 942 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
939 EXPECT_EQ(2u, active_layer()->tilings()->num_tilings()); | 943 EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings()); |
| 944 EXPECT_FLOAT_EQ(1.f, |
| 945 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 946 EXPECT_FLOAT_EQ(1.f * low_res_factor, |
| 947 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
940 | 948 |
941 host_impl()->PinchGestureBegin(); | 949 host_impl()->PinchGestureBegin(); |
942 | 950 |
943 // Changing the ideal but not creating new tilings. | 951 // Changing the ideal but not creating new tilings. |
944 scale = 1.5f; | 952 scale = 1.5f; |
945 page_scale = 1.5f; | 953 page_scale = 1.5f; |
946 SetContentsScaleOnBothLayers(scale, 1.f, page_scale, 1.f, 0.f, false); | 954 SetContentsScaleOnBothLayers(scale, 1.f, page_scale, 1.f, 0.f, false); |
947 EXPECT_EQ(2u, active_layer()->tilings()->num_tilings()); | 955 EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings()); |
| 956 EXPECT_FLOAT_EQ(1.f, |
| 957 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 958 EXPECT_FLOAT_EQ(1.f * low_res_factor, |
| 959 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
948 | 960 |
949 // The tilings are still our target scale, so they aren't removed. | 961 // The tilings are still our target scale, so they aren't removed. |
950 used_tilings.clear(); | 962 used_tilings.clear(); |
951 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 963 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
952 ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); | 964 ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
| 965 EXPECT_FLOAT_EQ(1.f, |
| 966 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 967 EXPECT_FLOAT_EQ(1.f * low_res_factor, |
| 968 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
953 | 969 |
954 host_impl()->PinchGestureEnd(); | 970 host_impl()->PinchGestureEnd(); |
955 | 971 |
956 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. | 972 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. |
957 scale = 1.2f; | 973 scale = 1.2f; |
958 page_scale = 1.2f; | 974 page_scale = 1.2f; |
959 SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, 0.f, false); | 975 SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, 0.f, false); |
960 ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); | 976 ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); |
| 977 EXPECT_FLOAT_EQ(1.2f, |
| 978 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
961 EXPECT_FLOAT_EQ(1.f, | 979 EXPECT_FLOAT_EQ(1.f, |
962 active_layer()->tilings()->tiling_at(1)->contents_scale()); | 980 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
| 981 EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
| 982 active_layer()->tilings()->tiling_at(2)->contents_scale()); |
963 EXPECT_FLOAT_EQ(1.f * low_res_factor, | 983 EXPECT_FLOAT_EQ(1.f * low_res_factor, |
964 active_layer()->tilings()->tiling_at(3)->contents_scale()); | 984 active_layer()->tilings()->tiling_at(3)->contents_scale()); |
965 | 985 |
966 // Ensure UpdateTiles won't remove any tilings. | 986 // Ensure UpdateTiles won't remove any tilings. |
967 active_layer()->MarkAllTilingsUsed(); | 987 active_layer()->MarkAllTilingsUsed(); |
968 | 988 |
969 // Mark the non-ideal tilings as used. They won't be removed. | 989 // Mark the non-ideal tilings as used. They won't be removed. |
970 used_tilings.clear(); | 990 used_tilings.clear(); |
971 used_tilings.push_back(active_layer()->tilings()->tiling_at(1)); | 991 used_tilings.push_back(active_layer()->tilings()->tiling_at(1)); |
972 used_tilings.push_back(active_layer()->tilings()->tiling_at(3)); | 992 used_tilings.push_back(active_layer()->tilings()->tiling_at(3)); |
973 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 993 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
974 ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); | 994 ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); |
| 995 EXPECT_FLOAT_EQ(1.2f, |
| 996 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 997 EXPECT_FLOAT_EQ(1.f, |
| 998 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
| 999 EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
| 1000 active_layer()->tilings()->tiling_at(2)->contents_scale()); |
| 1001 EXPECT_FLOAT_EQ(1.f * low_res_factor, |
| 1002 active_layer()->tilings()->tiling_at(3)->contents_scale()); |
975 | 1003 |
976 // Now move the ideal scale to 0.5. Our target stays 1.2. | 1004 // Now move the ideal scale to 0.5. Our target stays 1.2. |
977 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, 0.f, false); | 1005 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, 0.f, false); |
978 | 1006 |
979 // The high resolution tiling is between target and ideal, so is not | 1007 // The high resolution tiling is between target and ideal, so is not |
980 // removed. The low res tiling for the old ideal=1.0 scale is removed. | 1008 // removed. The low res tiling for the old ideal=1.0 scale is removed. |
981 used_tilings.clear(); | 1009 used_tilings.clear(); |
982 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 1010 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
983 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); | 1011 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
| 1012 EXPECT_FLOAT_EQ(1.2f, |
| 1013 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 1014 EXPECT_FLOAT_EQ(1.f, |
| 1015 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
| 1016 EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
| 1017 active_layer()->tilings()->tiling_at(2)->contents_scale()); |
984 | 1018 |
985 // Now move the ideal scale to 1.0. Our target stays 1.2. | 1019 // Now move the ideal scale to 1.0. Our target stays 1.2. |
986 SetContentsScaleOnBothLayers(1.f, 1.f, page_scale, 1.f, 0.f, false); | 1020 SetContentsScaleOnBothLayers(1.f, 1.f, page_scale, 1.f, 0.f, false); |
987 | 1021 |
988 // All the tilings are between are target and the ideal, so they are not | 1022 // All the tilings are between are target and the ideal, so they are not |
989 // removed. | 1023 // removed. |
990 used_tilings.clear(); | 1024 used_tilings.clear(); |
991 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 1025 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
992 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); | 1026 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
| 1027 EXPECT_FLOAT_EQ(1.2f, |
| 1028 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 1029 EXPECT_FLOAT_EQ(1.f, |
| 1030 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
| 1031 EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
| 1032 active_layer()->tilings()->tiling_at(2)->contents_scale()); |
993 | 1033 |
994 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. | 1034 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. |
995 SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.1f, 1.f, page_scale, 1.f, | 1035 SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.1f, 1.f, page_scale, 1.f, |
996 0.f, false); | 1036 0.f, false); |
997 | 1037 |
998 // Because the pending layer's ideal scale is still 1.0, our tilings fall | 1038 // Because the pending layer's ideal scale is still 1.0, our tilings fall |
999 // in the range [1.0,1.2] and are kept. | 1039 // in the range [1.0,1.2] and are kept. |
1000 used_tilings.clear(); | 1040 used_tilings.clear(); |
1001 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 1041 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
1002 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); | 1042 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
| 1043 EXPECT_FLOAT_EQ(1.2f, |
| 1044 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 1045 EXPECT_FLOAT_EQ(1.f, |
| 1046 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
| 1047 EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
| 1048 active_layer()->tilings()->tiling_at(2)->contents_scale()); |
1003 | 1049 |
1004 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays | 1050 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays |
1005 // 1.2 still. | 1051 // 1.2 still. |
1006 SetupDrawPropertiesAndUpdateTiles(pending_layer(), 1.1f, 1.f, page_scale, 1.f, | 1052 SetupDrawPropertiesAndUpdateTiles(pending_layer(), 1.1f, 1.f, page_scale, 1.f, |
1007 0.f, false); | 1053 0.f, false); |
1008 | 1054 |
1009 // Our 1.0 tiling now falls outside the range between our ideal scale and our | 1055 // Our 1.0 tiling now falls outside the range between our ideal scale and our |
1010 // target raster scale. But it is in our used tilings set, so nothing is | 1056 // target raster scale. But it is in our used tilings set, so nothing is |
1011 // deleted. | 1057 // deleted. |
1012 used_tilings.clear(); | 1058 used_tilings.clear(); |
1013 used_tilings.push_back(active_layer()->tilings()->tiling_at(1)); | 1059 used_tilings.push_back(active_layer()->tilings()->tiling_at(1)); |
1014 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 1060 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
1015 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); | 1061 ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
| 1062 EXPECT_FLOAT_EQ(1.2f, |
| 1063 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 1064 EXPECT_FLOAT_EQ(1.f, |
| 1065 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
| 1066 EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
| 1067 active_layer()->tilings()->tiling_at(2)->contents_scale()); |
1016 | 1068 |
1017 // If we remove it from our used tilings set, it is outside the range to keep | 1069 // If we remove it from our used tilings set, it is outside the range to keep |
1018 // so it is deleted. | 1070 // so it is deleted. |
1019 used_tilings.clear(); | 1071 used_tilings.clear(); |
1020 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); | 1072 active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
1021 ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); | 1073 ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
| 1074 EXPECT_FLOAT_EQ(1.2f, |
| 1075 active_layer()->tilings()->tiling_at(0)->contents_scale()); |
| 1076 EXPECT_FLOAT_EQ(1.2 * low_res_factor, |
| 1077 active_layer()->tilings()->tiling_at(1)->contents_scale()); |
1022 } | 1078 } |
1023 | 1079 |
1024 TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { | 1080 TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
1025 // Make sure this layer covers multiple tiles, since otherwise low | 1081 // Make sure this layer covers multiple tiles, since otherwise low |
1026 // res won't get created because it is too small. | 1082 // res won't get created because it is too small. |
1027 gfx::Size tile_size(host_impl()->settings().default_tile_size); | 1083 gfx::Size tile_size(host_impl()->settings().default_tile_size); |
1028 // Avoid max untiled layer size heuristics via fixed tile size. | 1084 // Avoid max untiled layer size heuristics via fixed tile size. |
1029 gfx::Size layer_bounds(tile_size.width() + 1, tile_size.height() + 1); | 1085 gfx::Size layer_bounds(tile_size.width() + 1, tile_size.height() + 1); |
1030 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); | 1086 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
1031 | 1087 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1878 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1823 | 1879 |
1824 gfx::Size tile_size(100, 100); | 1880 gfx::Size tile_size(100, 100); |
1825 gfx::Size layer_bounds(200, 200); | 1881 gfx::Size layer_bounds(200, 200); |
1826 gfx::Size viewport_size(400, 400); | 1882 gfx::Size viewport_size(400, 400); |
1827 | 1883 |
1828 host_impl()->SetViewportSize(viewport_size); | 1884 host_impl()->SetViewportSize(viewport_size); |
1829 SetInitialDeviceScaleFactor(2.f); | 1885 SetInitialDeviceScaleFactor(2.f); |
1830 | 1886 |
1831 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); | 1887 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
| 1888 active_layer()->SetHasWillChangeTransformHint(true); |
1832 | 1889 |
1833 // One ideal tile exists, this will get used when drawing. | 1890 // One ideal tile exists, this will get used when drawing. |
1834 std::vector<Tile*> ideal_tiles; | 1891 std::vector<Tile*> ideal_tiles; |
1835 EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale()); | 1892 EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale()); |
1836 ideal_tiles.push_back(active_layer()->HighResTiling()->TileAt(0, 0)); | 1893 ideal_tiles.push_back(active_layer()->HighResTiling()->TileAt(0, 0)); |
1837 host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( | 1894 host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
1838 ideal_tiles); | 1895 ideal_tiles); |
1839 | 1896 |
1840 // Due to layer scale throttling, the raster contents scale is changed to 1, | 1897 // Due to layer scale throttling, the raster contents scale is changed to 1, |
1841 // while the ideal is still 2. | 1898 // while the ideal is still 2. |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 float maximum_animation_scale = 1.f; | 3169 float maximum_animation_scale = 1.f; |
3113 float starting_animation_scale = 0.f; | 3170 float starting_animation_scale = 0.f; |
3114 bool animating_transform = false; | 3171 bool animating_transform = false; |
3115 | 3172 |
3116 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, | 3173 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
3117 maximum_animation_scale, | 3174 maximum_animation_scale, |
3118 starting_animation_scale, animating_transform); | 3175 starting_animation_scale, animating_transform); |
3119 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); | 3176 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
3120 | 3177 |
3121 // Changing the source scale without being in an animation will cause | 3178 // Changing the source scale without being in an animation will cause |
3122 // the layer to reset its source scale to 1.f. | 3179 // the layer to change scale. |
3123 contents_scale = 3.f; | 3180 contents_scale = 3.f; |
3124 | 3181 |
3125 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, | 3182 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
3126 maximum_animation_scale, | 3183 maximum_animation_scale, |
3127 starting_animation_scale, animating_transform); | 3184 starting_animation_scale, animating_transform); |
3128 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 3185 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
3129 | 3186 |
3130 // Further changes to the source scale will no longer be reflected in the | |
3131 // contents scale. | |
3132 contents_scale = 0.5f; | 3187 contents_scale = 0.5f; |
3133 | 3188 |
3134 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, | 3189 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
3135 maximum_animation_scale, | 3190 maximum_animation_scale, |
3136 starting_animation_scale, animating_transform); | 3191 starting_animation_scale, animating_transform); |
3137 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 3192 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
| 3193 |
| 3194 // However, if the layer has a will-change property, then the raster scale |
| 3195 // will get fixed at the last value. |
| 3196 active_layer()->SetHasWillChangeTransformHint(true); |
| 3197 pending_layer()->SetHasWillChangeTransformHint(true); |
| 3198 |
| 3199 contents_scale = 3.f; |
| 3200 |
| 3201 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
| 3202 maximum_animation_scale, |
| 3203 starting_animation_scale, animating_transform); |
| 3204 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
| 3205 |
| 3206 // Further changes to the source scale will no longer be reflected in the |
| 3207 // contents scale. |
| 3208 contents_scale = 1.f; |
| 3209 |
| 3210 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
| 3211 maximum_animation_scale, |
| 3212 starting_animation_scale, animating_transform); |
| 3213 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
| 3214 |
| 3215 // Disabling the will-change hint will once again make the raster scale update |
| 3216 // with the ideal scale. |
| 3217 active_layer()->SetHasWillChangeTransformHint(false); |
| 3218 pending_layer()->SetHasWillChangeTransformHint(false); |
| 3219 |
| 3220 contents_scale = 3.f; |
| 3221 |
| 3222 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
| 3223 maximum_animation_scale, |
| 3224 starting_animation_scale, animating_transform); |
| 3225 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
3138 } | 3226 } |
3139 | 3227 |
3140 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { | 3228 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
3141 gfx::Size tile_size(100, 100); | 3229 gfx::Size tile_size(100, 100); |
3142 gfx::Size layer_bounds(1000, 1000); | 3230 gfx::Size layer_bounds(1000, 1000); |
3143 | 3231 |
3144 // Make sure pending tree has tiles. | 3232 // Make sure pending tree has tiles. |
3145 gfx::Rect invalidation(gfx::Point(50, 50), tile_size); | 3233 gfx::Rect invalidation(gfx::Point(50, 50), tile_size); |
3146 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, invalidation); | 3234 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, invalidation); |
3147 | 3235 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3378 std::vector<PictureLayerTiling*> used_tilings; | 3466 std::vector<PictureLayerTiling*> used_tilings; |
3379 SetupDefaultTrees(layer_bounds); | 3467 SetupDefaultTrees(layer_bounds); |
3380 | 3468 |
3381 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; | 3469 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; |
3382 EXPECT_LT(low_res_factor, 1.f); | 3470 EXPECT_LT(low_res_factor, 1.f); |
3383 | 3471 |
3384 float device_scale = 1.7f; | 3472 float device_scale = 1.7f; |
3385 float page_scale = 3.2f; | 3473 float page_scale = 3.2f; |
3386 float scale = 1.f; | 3474 float scale = 1.f; |
3387 | 3475 |
| 3476 active_layer()->SetHasWillChangeTransformHint(true); |
3388 ResetTilingsAndRasterScales(); | 3477 ResetTilingsAndRasterScales(); |
3389 | 3478 |
3390 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, 0.f, | 3479 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, 0.f, |
3391 false); | 3480 false); |
3392 ASSERT_EQ(1u, active_layer()->tilings()->num_tilings()); | 3481 ASSERT_EQ(1u, active_layer()->tilings()->num_tilings()); |
3393 | 3482 |
3394 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to | 3483 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
3395 // |used_tilings| variable, and it's here only to ensure that active_layer() | 3484 // |used_tilings| variable, and it's here only to ensure that active_layer() |
3396 // won't remove tilings before the test has a chance to verify behavior. | 3485 // won't remove tilings before the test has a chance to verify behavior. |
3397 active_layer()->MarkAllTilingsUsed(); | 3486 active_layer()->MarkAllTilingsUsed(); |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4762 // New low res tiling. | 4851 // New low res tiling. |
4763 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 4852 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
4764 | 4853 |
4765 // This tiling will be high res now, it won't contain low res content since it | 4854 // This tiling will be high res now, it won't contain low res content since it |
4766 // was all destroyed. | 4855 // was all destroyed. |
4767 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 4856 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
4768 } | 4857 } |
4769 | 4858 |
4770 } // namespace | 4859 } // namespace |
4771 } // namespace cc | 4860 } // namespace cc |
OLD | NEW |