Chromium Code Reviews| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 628 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 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 active_layer_->AddUsedTiling(tiling); | |
| 638 tiling->CreateAllTilesForTesting(); | 639 tiling->CreateAllTilesForTesting(); |
| 639 // Then setup a new pending tree and activate it. | 640 // Then setup a new pending tree and activate it. |
| 640 SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50), | 641 SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50), |
| 641 layer_invalidation); | 642 layer_invalidation); |
| 642 | 643 |
| 643 EXPECT_EQ(2u, pending_layer_->num_tilings()); | 644 EXPECT_EQ(2u, pending_layer_->num_tilings()); |
| 644 EXPECT_EQ(3u, active_layer_->num_tilings()); | 645 EXPECT_EQ(3u, active_layer_->num_tilings()); |
| 645 | 646 |
| 646 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); | 647 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); |
| 647 EXPECT_GT(tilings->num_tilings(), 0u); | 648 EXPECT_GT(tilings->num_tilings(), 0u); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 909 scoped_refptr<FakePicturePileImpl> active_pile = | 910 scoped_refptr<FakePicturePileImpl> active_pile = |
| 910 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 911 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 911 | 912 |
| 912 // Set up the high and low res tilings before pinch zoom. | 913 // Set up the high and low res tilings before pinch zoom. |
| 913 SetupTrees(pending_pile, active_pile); | 914 SetupTrees(pending_pile, active_pile); |
| 914 ResetTilingsAndRasterScales(); | 915 ResetTilingsAndRasterScales(); |
| 915 | 916 |
| 916 SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, false); | 917 SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, false); |
| 917 EXPECT_BOTH_EQ(num_tilings(), 2u); | 918 EXPECT_BOTH_EQ(num_tilings(), 2u); |
| 918 EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), 2.f); | 919 EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), 2.f); |
| 920 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(0)); | |
|
danakj
2015/01/27 21:56:59
Maybe a MarkAllTilingsUsed() and MarkTilingUsed(Ti
vmpstr
2015/01/27 22:53:59
Done.
| |
| 919 EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(), | 921 EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(), |
| 920 2.f * low_res_factor); | 922 2.f * low_res_factor); |
| 923 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1)); | |
| 921 | 924 |
| 922 // Start a pinch gesture. | 925 // Start a pinch gesture. |
| 923 host_impl_.PinchGestureBegin(); | 926 host_impl_.PinchGestureBegin(); |
| 924 | 927 |
| 925 // Zoom out by a small amount. We should create a tiling at half | 928 // Zoom out by a small amount. We should create a tiling at half |
| 926 // the scale (2/kMaxScaleRatioDuringPinch). | 929 // the scale (2/kMaxScaleRatioDuringPinch). |
| 927 SetContentsScaleOnBothLayers(1.8f, 1.0f, 1.8f, 1.0f, false); | 930 SetContentsScaleOnBothLayers(1.8f, 1.0f, 1.8f, 1.0f, false); |
| 928 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 931 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 929 EXPECT_FLOAT_EQ(2.0f, | 932 EXPECT_FLOAT_EQ(2.0f, |
| 930 active_layer_->tilings()->tiling_at(0)->contents_scale()); | 933 active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 931 EXPECT_FLOAT_EQ(1.0f, | 934 EXPECT_FLOAT_EQ(1.0f, |
| 932 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 935 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 936 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1)); | |
| 933 EXPECT_FLOAT_EQ(2.0f * low_res_factor, | 937 EXPECT_FLOAT_EQ(2.0f * low_res_factor, |
| 934 active_layer_->tilings()->tiling_at(2)->contents_scale()); | 938 active_layer_->tilings()->tiling_at(2)->contents_scale()); |
| 935 | 939 |
| 936 // Zoom out further, close to our low-res scale factor. We should | 940 // 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. | 941 // use that tiling as high-res, and not create a new tiling. |
| 938 SetContentsScaleOnBothLayers(low_res_factor * 2.1f, 1.0f, | 942 SetContentsScaleOnBothLayers(low_res_factor * 2.1f, 1.0f, |
| 939 low_res_factor * 2.1f, 1.0f, false); | 943 low_res_factor * 2.1f, 1.0f, false); |
| 940 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 944 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 941 | 945 |
| 942 // Zoom in a lot now. Since we increase by increments of | 946 // Zoom in a lot now. Since we increase by increments of |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 959 SetupTrees(pending_pile, active_pile); | 963 SetupTrees(pending_pile, active_pile); |
| 960 | 964 |
| 961 ResetTilingsAndRasterScales(); | 965 ResetTilingsAndRasterScales(); |
| 962 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 966 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 963 | 967 |
| 964 // Set up the high and low res tilings before pinch zoom. | 968 // Set up the high and low res tilings before pinch zoom. |
| 965 SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, false); | 969 SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, false); |
| 966 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 970 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 967 EXPECT_FLOAT_EQ(0.24f, | 971 EXPECT_FLOAT_EQ(0.24f, |
| 968 active_layer_->tilings()->tiling_at(0)->contents_scale()); | 972 active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 973 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(0)); | |
| 969 EXPECT_FLOAT_EQ(0.0625f, | 974 EXPECT_FLOAT_EQ(0.0625f, |
| 970 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 975 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 976 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1)); | |
| 971 | 977 |
| 972 // Start a pinch gesture. | 978 // Start a pinch gesture. |
| 973 host_impl_.PinchGestureBegin(); | 979 host_impl_.PinchGestureBegin(); |
| 974 | 980 |
| 975 // Zoom out by a small amount. We should create a tiling at half | 981 // Zoom out by a small amount. We should create a tiling at half |
| 976 // the scale (1/kMaxScaleRatioDuringPinch). | 982 // the scale (1/kMaxScaleRatioDuringPinch). |
| 977 SetContentsScaleOnBothLayers(0.2f, 1.0f, 0.2f, 1.0f, false); | 983 SetContentsScaleOnBothLayers(0.2f, 1.0f, 0.2f, 1.0f, false); |
| 978 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 984 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 979 EXPECT_FLOAT_EQ(0.24f, | 985 EXPECT_FLOAT_EQ(0.24f, |
| 980 active_layer_->tilings()->tiling_at(0)->contents_scale()); | 986 active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 981 EXPECT_FLOAT_EQ(0.12f, | 987 EXPECT_FLOAT_EQ(0.12f, |
| 982 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 988 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 989 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1)); | |
| 983 EXPECT_FLOAT_EQ(0.0625, | 990 EXPECT_FLOAT_EQ(0.0625, |
| 984 active_layer_->tilings()->tiling_at(2)->contents_scale()); | 991 active_layer_->tilings()->tiling_at(2)->contents_scale()); |
| 985 | 992 |
| 986 // Zoom out further, close to our low-res scale factor. We should | 993 // 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. | 994 // use that tiling as high-res, and not create a new tiling. |
| 988 SetContentsScaleOnBothLayers(0.1f, 1.0f, 0.1f, 1.0f, false); | 995 SetContentsScaleOnBothLayers(0.1f, 1.0f, 0.1f, 1.0f, false); |
| 989 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); | 996 EXPECT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| 990 | 997 |
| 991 // Zoom in. 0.25(desired_scale) should be snapped to 0.24 during zoom-in | 998 // 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). | 999 // because 0.25(desired_scale) is within the ratio(1.2). |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1014 | 1021 |
| 1015 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 1022 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
| 1016 EXPECT_LT(low_res_factor, 1.f); | 1023 EXPECT_LT(low_res_factor, 1.f); |
| 1017 | 1024 |
| 1018 float scale = 1.f; | 1025 float scale = 1.f; |
| 1019 float page_scale = 1.f; | 1026 float page_scale = 1.f; |
| 1020 | 1027 |
| 1021 SetupTrees(pending_pile, active_pile); | 1028 SetupTrees(pending_pile, active_pile); |
| 1022 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 1029 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 1023 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); | 1030 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); |
| 1031 active_layer_->AddUsedTiling(active_layer_->HighResTiling()); | |
| 1032 active_layer_->AddUsedTiling(active_layer_->LowResTiling()); | |
| 1024 | 1033 |
| 1025 // We only have ideal tilings, so they aren't removed. | 1034 // We only have ideal tilings, so they aren't removed. |
| 1026 used_tilings.clear(); | 1035 used_tilings.clear(); |
| 1027 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 1036 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 1028 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 1037 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 1029 | 1038 |
| 1030 host_impl_.PinchGestureBegin(); | 1039 host_impl_.PinchGestureBegin(); |
| 1031 | 1040 |
| 1032 // Changing the ideal but not creating new tilings. | 1041 // Changing the ideal but not creating new tilings. |
| 1033 scale = 1.5f; | 1042 scale = 1.5f; |
| 1034 page_scale = 1.5f; | 1043 page_scale = 1.5f; |
| 1035 SetContentsScaleOnBothLayers(scale, 1.f, page_scale, 1.f, false); | 1044 SetContentsScaleOnBothLayers(scale, 1.f, page_scale, 1.f, false); |
| 1036 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); | 1045 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 1037 | 1046 |
| 1038 // The tilings are still our target scale, so they aren't removed. | 1047 // The tilings are still our target scale, so they aren't removed. |
| 1039 used_tilings.clear(); | 1048 used_tilings.clear(); |
| 1040 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 1049 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 1041 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 1050 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 1042 | 1051 |
| 1043 host_impl_.PinchGestureEnd(); | 1052 host_impl_.PinchGestureEnd(); |
| 1044 | 1053 |
| 1045 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. | 1054 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. |
| 1046 scale = 1.2f; | 1055 scale = 1.2f; |
| 1047 page_scale = 1.2f; | 1056 page_scale = 1.2f; |
| 1048 SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, false); | 1057 SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, false); |
| 1049 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); | 1058 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); |
| 1050 EXPECT_FLOAT_EQ( | 1059 EXPECT_FLOAT_EQ( |
| 1051 1.f, | 1060 1.f, |
| 1052 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 1061 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 1062 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1)); | |
| 1053 EXPECT_FLOAT_EQ( | 1063 EXPECT_FLOAT_EQ( |
| 1054 1.f * low_res_factor, | 1064 1.f * low_res_factor, |
| 1055 active_layer_->tilings()->tiling_at(3)->contents_scale()); | 1065 active_layer_->tilings()->tiling_at(3)->contents_scale()); |
| 1066 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(3)); | |
| 1056 | 1067 |
| 1057 // Mark the non-ideal tilings as used. They won't be removed. | 1068 // Mark the non-ideal tilings as used. They won't be removed. |
| 1058 used_tilings.clear(); | 1069 used_tilings.clear(); |
| 1059 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); | 1070 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
| 1060 used_tilings.push_back(active_layer_->tilings()->tiling_at(3)); | 1071 used_tilings.push_back(active_layer_->tilings()->tiling_at(3)); |
| 1061 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 1072 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 1062 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); | 1073 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); |
| 1063 | 1074 |
| 1064 // Now move the ideal scale to 0.5. Our target stays 1.2. | 1075 // Now move the ideal scale to 0.5. Our target stays 1.2. |
| 1065 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, false); | 1076 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, false); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1136 EXPECT_BOTH_EQ(num_tilings(), 1u); | 1147 EXPECT_BOTH_EQ(num_tilings(), 1u); |
| 1137 | 1148 |
| 1138 // Stop animating, low res gets created. | 1149 // Stop animating, low res gets created. |
| 1139 animating_transform = false; | 1150 animating_transform = false; |
| 1140 SetContentsScaleOnBothLayers(contents_scale, | 1151 SetContentsScaleOnBothLayers(contents_scale, |
| 1141 device_scale, | 1152 device_scale, |
| 1142 page_scale, | 1153 page_scale, |
| 1143 maximum_animation_scale, | 1154 maximum_animation_scale, |
| 1144 animating_transform); | 1155 animating_transform); |
| 1145 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 1156 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
| 1157 active_layer_->AddUsedTiling(active_layer_->HighResTiling()); | |
| 1146 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); | 1158 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
| 1159 active_layer_->AddUsedTiling(active_layer_->LowResTiling()); | |
| 1147 EXPECT_BOTH_EQ(num_tilings(), 2u); | 1160 EXPECT_BOTH_EQ(num_tilings(), 2u); |
| 1148 | 1161 |
| 1149 // Page scale animation, new high res, but no low res. We still have | 1162 // 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 | 1163 // 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. | 1164 // active layer. The pending layer drops non-ideal tilings. |
| 1152 contents_scale = 2.f; | 1165 contents_scale = 2.f; |
| 1153 page_scale = 2.f; | 1166 page_scale = 2.f; |
| 1154 maximum_animation_scale = 2.f; | 1167 maximum_animation_scale = 2.f; |
| 1155 animating_transform = true; | 1168 animating_transform = true; |
| 1156 SetContentsScaleOnBothLayers(contents_scale, | 1169 SetContentsScaleOnBothLayers(contents_scale, |
| (...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3604 EXPECT_LT(low_res_factor, 1.f); | 3617 EXPECT_LT(low_res_factor, 1.f); |
| 3605 | 3618 |
| 3606 float device_scale = 1.7f; | 3619 float device_scale = 1.7f; |
| 3607 float page_scale = 3.2f; | 3620 float page_scale = 3.2f; |
| 3608 float scale = 1.f; | 3621 float scale = 1.f; |
| 3609 | 3622 |
| 3610 ResetTilingsAndRasterScales(); | 3623 ResetTilingsAndRasterScales(); |
| 3611 | 3624 |
| 3612 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); | 3625 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); |
| 3613 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3626 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3627 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(0)); | |
| 3614 | 3628 |
| 3615 // We only have ideal tilings, so they aren't removed. | 3629 // We only have ideal tilings, so they aren't removed. |
| 3616 used_tilings.clear(); | 3630 used_tilings.clear(); |
| 3617 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 3631 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 3618 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3632 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3619 | 3633 |
| 3620 host_impl_.PinchGestureBegin(); | 3634 host_impl_.PinchGestureBegin(); |
| 3621 | 3635 |
| 3622 // Changing the ideal but not creating new tilings. | 3636 // Changing the ideal but not creating new tilings. |
| 3623 scale *= 1.5f; | 3637 scale *= 1.5f; |
| 3624 page_scale *= 1.5f; | 3638 page_scale *= 1.5f; |
| 3625 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); | 3639 SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); |
| 3626 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3640 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3627 | 3641 |
| 3628 // The tilings are still our target scale, so they aren't removed. | 3642 // The tilings are still our target scale, so they aren't removed. |
| 3629 used_tilings.clear(); | 3643 used_tilings.clear(); |
| 3630 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 3644 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 3631 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 3645 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 3632 | 3646 |
| 3633 host_impl_.PinchGestureEnd(); | 3647 host_impl_.PinchGestureEnd(); |
| 3634 | 3648 |
| 3635 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. | 3649 // Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2. |
| 3636 scale /= 4.f; | 3650 scale /= 4.f; |
| 3637 page_scale /= 4.f; | 3651 page_scale /= 4.f; |
| 3638 SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, false); | 3652 SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, false); |
| 3639 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 3653 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 3640 EXPECT_FLOAT_EQ(1.f, | 3654 EXPECT_FLOAT_EQ(1.f, |
| 3641 active_layer_->tilings()->tiling_at(1)->contents_scale()); | 3655 active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 3656 active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1)); | |
| 3642 | 3657 |
| 3643 // Mark the non-ideal tilings as used. They won't be removed. | 3658 // Mark the non-ideal tilings as used. They won't be removed. |
| 3644 used_tilings.clear(); | 3659 used_tilings.clear(); |
| 3645 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); | 3660 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
| 3646 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 3661 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
| 3647 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 3662 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
| 3648 | 3663 |
| 3649 // Now move the ideal scale to 0.5. Our target stays 1.2. | 3664 // Now move the ideal scale to 0.5. Our target stays 1.2. |
| 3650 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, false); | 3665 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, false); |
| 3651 | 3666 |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4882 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4897 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4883 EXPECT_EQ(result.width(), 448); | 4898 EXPECT_EQ(result.width(), 448); |
| 4884 EXPECT_EQ(result.height(), 448); | 4899 EXPECT_EQ(result.height(), 448); |
| 4885 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4900 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4886 EXPECT_EQ(result.width(), 512); | 4901 EXPECT_EQ(result.width(), 512); |
| 4887 EXPECT_EQ(result.height(), 500 + 2); | 4902 EXPECT_EQ(result.height(), 500 + 2); |
| 4888 } | 4903 } |
| 4889 | 4904 |
| 4890 } // namespace | 4905 } // namespace |
| 4891 } // namespace cc | 4906 } // namespace cc |
| OLD | NEW |