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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "cc/layers/solid_color_layer.h" | 6 #include "cc/layers/solid_color_layer.h" |
7 #include "cc/layers/texture_layer.h" | 7 #include "cc/layers/texture_layer.h" |
8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
10 #include "cc/test/fake_picture_layer.h" | 10 #include "cc/test/fake_picture_layer.h" |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // Cause the device scale factor to be inherited by contents scales. | 924 // Cause the device scale factor to be inherited by contents scales. |
925 settings->layer_transforms_should_scale_layer_contents = true; | 925 settings->layer_transforms_should_scale_layer_contents = true; |
926 } | 926 } |
927 | 927 |
928 virtual void SetupTree() OVERRIDE { | 928 virtual void SetupTree() OVERRIDE { |
929 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); | 929 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); |
930 LayerTreePixelTest::SetupTree(); | 930 LayerTreePixelTest::SetupTree(); |
931 } | 931 } |
932 | 932 |
933 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 933 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
934 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | |
935 | |
936 FakePictureLayerImpl* background_impl = | |
937 static_cast<FakePictureLayerImpl*>(root_impl->children()[0]); | |
938 EXPECT_EQ(device_scale_factor_, | 934 EXPECT_EQ(device_scale_factor_, |
939 background_impl->HighResTiling()->contents_scale()); | 935 host_impl->active_tree()->device_scale_factor()); |
940 | |
941 FakePictureLayerImpl* green_impl = | |
942 static_cast<FakePictureLayerImpl*>(background_impl->children()[0]); | |
943 EXPECT_EQ(device_scale_factor_, | |
944 green_impl->HighResTiling()->contents_scale()); | |
945 | |
946 FakePictureLayerImpl* blue_impl = | |
947 static_cast<FakePictureLayerImpl*>(green_impl->children()[0]); | |
948 EXPECT_EQ(device_scale_factor_, | |
949 blue_impl->HighResTiling()->contents_scale()); | |
950 } | 936 } |
951 | 937 |
952 float device_scale_factor_; | 938 float device_scale_factor_; |
953 SolidColorContentLayerClient white_client_; | 939 SolidColorContentLayerClient white_client_; |
954 SolidColorContentLayerClient green_client_; | 940 SolidColorContentLayerClient green_client_; |
955 SolidColorContentLayerClient blue_client_; | 941 SolidColorContentLayerClient blue_client_; |
956 }; | 942 }; |
957 | 943 |
958 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, | 944 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, |
959 ReadbackSubrect_Software) { | 945 ReadbackSubrect_Software) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 background, | 1080 background, |
1095 green.get(), | 1081 green.get(), |
1096 base::FilePath(FILE_PATH_LITERAL( | 1082 base::FilePath(FILE_PATH_LITERAL( |
1097 "green_with_blue_corner.png"))); | 1083 "green_with_blue_corner.png"))); |
1098 } | 1084 } |
1099 | 1085 |
1100 } // namespace | 1086 } // namespace |
1101 } // namespace cc | 1087 } // namespace cc |
1102 | 1088 |
1103 #endif // OS_ANDROID | 1089 #endif // OS_ANDROID |
OLD | NEW |