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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 | 670 |
| 671 // Stop animating, low res gets created. | 671 // Stop animating, low res gets created. |
| 672 animating_transform = false; | 672 animating_transform = false; |
| 673 SetContentsScaleOnBothLayers( | 673 SetContentsScaleOnBothLayers( |
| 674 contents_scale, device_scale, page_scale, animating_transform); | 674 contents_scale, device_scale, page_scale, animating_transform); |
| 675 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 675 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
| 676 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); | 676 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
| 677 EXPECT_BOTH_EQ(num_tilings(), 2u); | 677 EXPECT_BOTH_EQ(num_tilings(), 2u); |
| 678 | 678 |
| 679 // Page scale animation, new high res, but not new low res because animating. | 679 // Page scale animation, new high res, but not new low res because animating. |
| 680 contents_scale = 4.f; | 680 contents_scale = 2.f; |
|
vmpstr
2013/08/05 18:41:27
This change is here since with the new low res con
| |
| 681 page_scale = 4.f; | 681 page_scale = 2.f; |
| 682 animating_transform = true; | 682 animating_transform = true; |
| 683 SetContentsScaleOnBothLayers( | 683 SetContentsScaleOnBothLayers( |
| 684 contents_scale, device_scale, page_scale, animating_transform); | 684 contents_scale, device_scale, page_scale, animating_transform); |
| 685 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 685 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
| 686 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); | 686 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
| 687 EXPECT_BOTH_EQ(num_tilings(), 3u); | 687 EXPECT_BOTH_EQ(num_tilings(), 3u); |
| 688 | 688 |
| 689 // Stop animating, new low res gets created for final page scale. | 689 // Stop animating, new low res gets created for final page scale. |
| 690 animating_transform = false; | 690 animating_transform = false; |
| 691 SetContentsScaleOnBothLayers( | 691 SetContentsScaleOnBothLayers( |
| 692 contents_scale, device_scale, page_scale, animating_transform); | 692 contents_scale, device_scale, page_scale, animating_transform); |
| 693 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 693 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
| 694 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 4.f * low_res_factor); | 694 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 2.f * low_res_factor); |
| 695 EXPECT_BOTH_EQ(num_tilings(), 4u); | 695 EXPECT_BOTH_EQ(num_tilings(), 4u); |
| 696 } | 696 } |
| 697 | 697 |
| 698 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { | 698 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { |
| 699 gfx::Size tile_size(host_impl_.settings().default_tile_size); | 699 gfx::Size tile_size(host_impl_.settings().default_tile_size); |
| 700 SetupDefaultTrees(tile_size); | 700 SetupDefaultTrees(tile_size); |
| 701 | 701 |
| 702 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 702 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
| 703 float device_scale = 1.f; | 703 float device_scale = 1.f; |
| 704 float page_scale = 1.f; | 704 float page_scale = 1.f; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1036 active_layer_ = static_cast<FakePictureLayerImpl*>( | 1036 active_layer_ = static_cast<FakePictureLayerImpl*>( |
| 1037 host_impl_.active_tree()->LayerById(id_)); | 1037 host_impl_.active_tree()->LayerById(id_)); |
| 1038 | 1038 |
| 1039 EXPECT_EQ(0u, active_layer_->num_tilings()); | 1039 EXPECT_EQ(0u, active_layer_->num_tilings()); |
| 1040 EXPECT_EQ(!default_lcd_text_setting, active_layer_->is_using_lcd_text()); | 1040 EXPECT_EQ(!default_lcd_text_setting, active_layer_->is_using_lcd_text()); |
| 1041 EXPECT_FALSE(active_layer_->needs_post_commit_initialization()); | 1041 EXPECT_FALSE(active_layer_->needs_post_commit_initialization()); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 } // namespace | 1044 } // namespace |
| 1045 } // namespace cc | 1045 } // namespace cc |
| OLD | NEW |