| 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 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 SetContentsScaleOnBothLayers(contents_scale, | 2595 SetContentsScaleOnBothLayers(contents_scale, |
| 2596 device_scale, | 2596 device_scale, |
| 2597 page_scale, | 2597 page_scale, |
| 2598 maximum_animation_scale, | 2598 maximum_animation_scale, |
| 2599 animating_transform); | 2599 animating_transform); |
| 2600 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2600 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
| 2601 | 2601 |
| 2602 static_cast<FakePicturePileImpl*>(pending_layer_->pile())->set_has_text(true); | 2602 static_cast<FakePicturePileImpl*>(pending_layer_->pile())->set_has_text(true); |
| 2603 static_cast<FakePicturePileImpl*>(active_layer_->pile())->set_has_text(true); | 2603 static_cast<FakePicturePileImpl*>(active_layer_->pile())->set_has_text(true); |
| 2604 | 2604 |
| 2605 // Since we're GPU-rasterizing but have text, starting an animation should | 2605 // When we're GPU-rasterizing, even if we have text, starting an animation |
| 2606 // cause tiling resolution to get set to the maximum animation scale. | 2606 // should cause tiling resolution to get set to the content scale, since we |
| 2607 // render animating text at content scale using distance fields. |
| 2607 animating_transform = true; | 2608 animating_transform = true; |
| 2608 contents_scale = 2.f; | 2609 contents_scale = 2.f; |
| 2609 maximum_animation_scale = 3.f; | 2610 maximum_animation_scale = 3.f; |
| 2610 | 2611 |
| 2611 SetContentsScaleOnBothLayers(contents_scale, | 2612 SetContentsScaleOnBothLayers(contents_scale, |
| 2612 device_scale, | 2613 device_scale, |
| 2613 page_scale, | 2614 page_scale, |
| 2614 maximum_animation_scale, | 2615 maximum_animation_scale, |
| 2615 animating_transform); | 2616 animating_transform); |
| 2616 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); | 2617 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
| 2617 | 2618 |
| 2618 // Further changes to scale during the animation should not cause a new | 2619 // Further changes to scale during the animation should still cause a new |
| 2619 // high-res tiling to get created. | 2620 // high-res tiling to get created at content scale. |
| 2620 contents_scale = 4.f; | 2621 contents_scale = 4.f; |
| 2621 maximum_animation_scale = 5.f; | 2622 maximum_animation_scale = 5.f; |
| 2622 | 2623 |
| 2623 SetContentsScaleOnBothLayers(contents_scale, | 2624 SetContentsScaleOnBothLayers(contents_scale, |
| 2624 device_scale, | 2625 device_scale, |
| 2625 page_scale, | 2626 page_scale, |
| 2626 maximum_animation_scale, | 2627 maximum_animation_scale, |
| 2627 animating_transform); | 2628 animating_transform); |
| 2628 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); | 2629 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
| 2629 | 2630 |
| 2630 // Once we stop animating, a new high-res tiling should be created. | 2631 // Once we stop animating, a new high-res tiling should be created. |
| 2631 animating_transform = false; | 2632 animating_transform = false; |
| 2632 | 2633 |
| 2633 SetContentsScaleOnBothLayers(contents_scale, | 2634 SetContentsScaleOnBothLayers(contents_scale, |
| 2634 device_scale, | 2635 device_scale, |
| 2635 page_scale, | 2636 page_scale, |
| 2636 maximum_animation_scale, | 2637 maximum_animation_scale, |
| 2637 animating_transform); | 2638 animating_transform); |
| 2638 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2639 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
| (...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4550 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4551 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4551 EXPECT_EQ(result.width(), 448); | 4552 EXPECT_EQ(result.width(), 448); |
| 4552 EXPECT_EQ(result.height(), 448); | 4553 EXPECT_EQ(result.height(), 448); |
| 4553 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4554 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4554 EXPECT_EQ(result.width(), 512); | 4555 EXPECT_EQ(result.width(), 512); |
| 4555 EXPECT_EQ(result.height(), 500 + 2); | 4556 EXPECT_EQ(result.height(), 500 + 2); |
| 4556 } | 4557 } |
| 4557 | 4558 |
| 4558 } // namespace | 4559 } // namespace |
| 4559 } // namespace cc | 4560 } // namespace cc |
| OLD | NEW |