| 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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 page_scale, | 1088 page_scale, |
| 1089 maximum_animation_scale, | 1089 maximum_animation_scale, |
| 1090 animating_transform); | 1090 animating_transform); |
| 1091 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 1091 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
| 1092 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); | 1092 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
| 1093 EXPECT_BOTH_EQ(num_tilings(), 2u); | 1093 EXPECT_BOTH_EQ(num_tilings(), 2u); |
| 1094 | 1094 |
| 1095 // Page scale animation, new high res, but not new low res because animating. | 1095 // Page scale animation, new high res, but not new low res because animating. |
| 1096 contents_scale = 2.f; | 1096 contents_scale = 2.f; |
| 1097 page_scale = 2.f; | 1097 page_scale = 2.f; |
| 1098 maximum_animation_scale = 2.f; |
| 1098 animating_transform = true; | 1099 animating_transform = true; |
| 1099 SetContentsScaleOnBothLayers(contents_scale, | 1100 SetContentsScaleOnBothLayers(contents_scale, |
| 1100 device_scale, | 1101 device_scale, |
| 1101 page_scale, | 1102 page_scale, |
| 1102 maximum_animation_scale, | 1103 maximum_animation_scale, |
| 1103 animating_transform); | 1104 animating_transform); |
| 1104 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); | 1105 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
| 1105 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); | 1106 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
| 1106 EXPECT_BOTH_EQ(num_tilings(), 3u); | 1107 EXPECT_BOTH_EQ(num_tilings(), 3u); |
| 1107 | 1108 |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2308 animating_transform = false; | 2309 animating_transform = false; |
| 2309 | 2310 |
| 2310 SetContentsScaleOnBothLayers(contents_scale, | 2311 SetContentsScaleOnBothLayers(contents_scale, |
| 2311 device_scale, | 2312 device_scale, |
| 2312 page_scale, | 2313 page_scale, |
| 2313 maximum_animation_scale, | 2314 maximum_animation_scale, |
| 2314 animating_transform); | 2315 animating_transform); |
| 2315 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2316 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
| 2316 | 2317 |
| 2317 // When animating with an unknown maximum animation scale factor, a new | 2318 // When animating with an unknown maximum animation scale factor, a new |
| 2318 // high-res tiling should be created at the animation's initial scale. | 2319 // high-res tiling should not be created at a source scale of 1. |
| 2319 animating_transform = true; | 2320 animating_transform = true; |
| 2320 contents_scale = 2.f; | 2321 contents_scale = 2.f; |
| 2321 maximum_animation_scale = 0.f; | 2322 maximum_animation_scale = 0.f; |
| 2322 | 2323 |
| 2323 SetContentsScaleOnBothLayers(contents_scale, | 2324 SetContentsScaleOnBothLayers(contents_scale, |
| 2324 device_scale, | 2325 device_scale, |
| 2325 page_scale, | 2326 page_scale, |
| 2326 maximum_animation_scale, | 2327 maximum_animation_scale, |
| 2327 animating_transform); | 2328 animating_transform); |
| 2328 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); | 2329 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
| 2329 | 2330 |
| 2330 // Further changes to scale during the animation should not cause a new | 2331 // Further changes to scale during the animation should not cause a new |
| 2331 // high-res tiling to get created. | 2332 // high-res tiling to get created. |
| 2332 contents_scale = 3.f; | 2333 contents_scale = 3.f; |
| 2333 | 2334 |
| 2334 SetContentsScaleOnBothLayers(contents_scale, | 2335 SetContentsScaleOnBothLayers(contents_scale, |
| 2335 device_scale, | 2336 device_scale, |
| 2336 page_scale, | 2337 page_scale, |
| 2337 maximum_animation_scale, | 2338 maximum_animation_scale, |
| 2338 animating_transform); | 2339 animating_transform); |
| 2339 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); | 2340 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
| 2340 | 2341 |
| 2341 // Once we stop animating, a new high-res tiling should be created. | 2342 // Once we stop animating, a new high-res tiling should be created. |
| 2342 animating_transform = false; | 2343 animating_transform = false; |
| 2343 contents_scale = 4.f; | 2344 contents_scale = 4.f; |
| 2344 | 2345 |
| 2345 SetContentsScaleOnBothLayers(contents_scale, | 2346 SetContentsScaleOnBothLayers(contents_scale, |
| 2346 device_scale, | 2347 device_scale, |
| 2347 page_scale, | 2348 page_scale, |
| 2348 maximum_animation_scale, | 2349 maximum_animation_scale, |
| 2349 animating_transform); | 2350 animating_transform); |
| 2350 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2351 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
| 2351 | 2352 |
| 2352 // When animating with a maxmium animation scale factor that is so large | 2353 // When animating with a maxmium animation scale factor that is so large |
| 2353 // that the layer grows larger than the viewport at this scale, a new | 2354 // that the layer grows larger than the viewport at this scale, a new |
| 2354 // high-res tiling should get created at the animation's initial scale, not | 2355 // high-res tiling should get created at a source scale of 1, not at its |
| 2355 // at its maximum scale. | 2356 // maximum scale. |
| 2356 animating_transform = true; | 2357 animating_transform = true; |
| 2357 contents_scale = 2.f; | 2358 contents_scale = 2.f; |
| 2358 maximum_animation_scale = 11.f; | 2359 maximum_animation_scale = 11.f; |
| 2359 | 2360 |
| 2360 SetContentsScaleOnBothLayers(contents_scale, | 2361 SetContentsScaleOnBothLayers(contents_scale, |
| 2361 device_scale, | 2362 device_scale, |
| 2362 page_scale, | 2363 page_scale, |
| 2363 maximum_animation_scale, | 2364 maximum_animation_scale, |
| 2364 animating_transform); | 2365 animating_transform); |
| 2365 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); | 2366 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
| 2366 | 2367 |
| 2367 // Once we stop animating, a new high-res tiling should be created. | 2368 // Once we stop animating, a new high-res tiling should be created. |
| 2368 animating_transform = false; | 2369 animating_transform = false; |
| 2369 contents_scale = 11.f; | 2370 contents_scale = 11.f; |
| 2370 | 2371 |
| 2371 SetContentsScaleOnBothLayers(contents_scale, | 2372 SetContentsScaleOnBothLayers(contents_scale, |
| 2372 device_scale, | 2373 device_scale, |
| 2373 page_scale, | 2374 page_scale, |
| 2374 maximum_animation_scale, | 2375 maximum_animation_scale, |
| 2375 animating_transform); | 2376 animating_transform); |
| (...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4370 SetupPendingTree(pending_pile2); | 4371 SetupPendingTree(pending_pile2); |
| 4371 ActivateTree(); | 4372 ActivateTree(); |
| 4372 | 4373 |
| 4373 // We've switched to a solid color, so we should end up with no tilings. | 4374 // We've switched to a solid color, so we should end up with no tilings. |
| 4374 ASSERT_TRUE(active_layer_->tilings()); | 4375 ASSERT_TRUE(active_layer_->tilings()); |
| 4375 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4376 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 4376 } | 4377 } |
| 4377 | 4378 |
| 4378 } // namespace | 4379 } // namespace |
| 4379 } // namespace cc | 4380 } // namespace cc |
| OLD | NEW |