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/content_layer.h" | 6 #include "cc/layers/content_layer.h" |
7 #include "cc/layers/solid_color_layer.h" | 7 #include "cc/layers/solid_color_layer.h" |
8 #include "cc/layers/texture_layer.h" | 8 #include "cc/layers/texture_layer.h" |
9 #include "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 | 947 |
948 float device_scale_factor_; | 948 float device_scale_factor_; |
949 SolidColorContentLayerClient white_client_; | 949 SolidColorContentLayerClient white_client_; |
950 SolidColorContentLayerClient green_client_; | 950 SolidColorContentLayerClient green_client_; |
951 SolidColorContentLayerClient blue_client_; | 951 SolidColorContentLayerClient blue_client_; |
952 }; | 952 }; |
953 | 953 |
954 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, | 954 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, |
955 ReadbackSubrect_Software) { | 955 ReadbackSubrect_Software) { |
956 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); | 956 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); |
957 background->SetAnchorPoint(gfx::PointF()); | |
958 background->SetBounds(gfx::Size(100, 100)); | 957 background->SetBounds(gfx::Size(100, 100)); |
959 background->SetIsDrawable(true); | 958 background->SetIsDrawable(true); |
960 | 959 |
961 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); | 960 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); |
962 green->SetAnchorPoint(gfx::PointF()); | |
963 green->SetBounds(gfx::Size(100, 100)); | 961 green->SetBounds(gfx::Size(100, 100)); |
964 green->SetIsDrawable(true); | 962 green->SetIsDrawable(true); |
965 background->AddChild(green); | 963 background->AddChild(green); |
966 | 964 |
967 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); | 965 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); |
968 blue->SetAnchorPoint(gfx::PointF()); | |
969 blue->SetPosition(gfx::Point(50, 50)); | 966 blue->SetPosition(gfx::Point(50, 50)); |
970 blue->SetBounds(gfx::Size(25, 25)); | 967 blue->SetBounds(gfx::Size(25, 25)); |
971 blue->SetIsDrawable(true); | 968 blue->SetIsDrawable(true); |
972 green->AddChild(blue); | 969 green->AddChild(blue); |
973 | 970 |
974 // Grab the middle of the root layer. | 971 // Grab the middle of the root layer. |
975 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 972 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
976 device_scale_factor_ = 2.f; | 973 device_scale_factor_ = 2.f; |
977 | 974 |
978 this->impl_side_painting_ = false; | 975 this->impl_side_painting_ = false; |
979 RunPixelTest(SOFTWARE_WITH_DEFAULT, | 976 RunPixelTest(SOFTWARE_WITH_DEFAULT, |
980 background, | 977 background, |
981 base::FilePath(FILE_PATH_LITERAL( | 978 base::FilePath(FILE_PATH_LITERAL( |
982 "green_small_with_blue_corner.png"))); | 979 "green_small_with_blue_corner.png"))); |
983 } | 980 } |
984 | 981 |
985 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, | 982 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, |
986 ReadbackSubrect_GL) { | 983 ReadbackSubrect_GL) { |
987 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); | 984 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); |
988 background->SetAnchorPoint(gfx::PointF()); | |
989 background->SetBounds(gfx::Size(100, 100)); | 985 background->SetBounds(gfx::Size(100, 100)); |
990 background->SetIsDrawable(true); | 986 background->SetIsDrawable(true); |
991 | 987 |
992 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); | 988 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); |
993 green->SetAnchorPoint(gfx::PointF()); | |
994 green->SetBounds(gfx::Size(100, 100)); | 989 green->SetBounds(gfx::Size(100, 100)); |
995 green->SetIsDrawable(true); | 990 green->SetIsDrawable(true); |
996 background->AddChild(green); | 991 background->AddChild(green); |
997 | 992 |
998 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); | 993 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); |
999 blue->SetAnchorPoint(gfx::PointF()); | |
1000 blue->SetPosition(gfx::Point(50, 50)); | 994 blue->SetPosition(gfx::Point(50, 50)); |
1001 blue->SetBounds(gfx::Size(25, 25)); | 995 blue->SetBounds(gfx::Size(25, 25)); |
1002 blue->SetIsDrawable(true); | 996 blue->SetIsDrawable(true); |
1003 green->AddChild(blue); | 997 green->AddChild(blue); |
1004 | 998 |
1005 // Grab the middle of the root layer. | 999 // Grab the middle of the root layer. |
1006 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 1000 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
1007 device_scale_factor_ = 2.f; | 1001 device_scale_factor_ = 2.f; |
1008 | 1002 |
1009 this->impl_side_painting_ = false; | 1003 this->impl_side_painting_ = false; |
1010 RunPixelTest(GL_WITH_DEFAULT, | 1004 RunPixelTest(GL_WITH_DEFAULT, |
1011 background, | 1005 background, |
1012 base::FilePath(FILE_PATH_LITERAL( | 1006 base::FilePath(FILE_PATH_LITERAL( |
1013 "green_small_with_blue_corner.png"))); | 1007 "green_small_with_blue_corner.png"))); |
1014 } | 1008 } |
1015 | 1009 |
1016 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, | 1010 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, |
1017 ReadbackNonRootLayerSubrect_Software) { | 1011 ReadbackNonRootLayerSubrect_Software) { |
1018 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); | 1012 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); |
1019 background->SetAnchorPoint(gfx::PointF()); | |
1020 background->SetBounds(gfx::Size(100, 100)); | 1013 background->SetBounds(gfx::Size(100, 100)); |
1021 background->SetIsDrawable(true); | 1014 background->SetIsDrawable(true); |
1022 | 1015 |
1023 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); | 1016 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); |
1024 green->SetAnchorPoint(gfx::PointF()); | |
1025 green->SetPosition(gfx::Point(10, 20)); | 1017 green->SetPosition(gfx::Point(10, 20)); |
1026 green->SetBounds(gfx::Size(90, 80)); | 1018 green->SetBounds(gfx::Size(90, 80)); |
1027 green->SetIsDrawable(true); | 1019 green->SetIsDrawable(true); |
1028 background->AddChild(green); | 1020 background->AddChild(green); |
1029 | 1021 |
1030 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); | 1022 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); |
1031 blue->SetAnchorPoint(gfx::PointF()); | |
1032 blue->SetPosition(gfx::Point(50, 50)); | 1023 blue->SetPosition(gfx::Point(50, 50)); |
1033 blue->SetBounds(gfx::Size(25, 25)); | 1024 blue->SetBounds(gfx::Size(25, 25)); |
1034 blue->SetIsDrawable(true); | 1025 blue->SetIsDrawable(true); |
1035 green->AddChild(blue); | 1026 green->AddChild(blue); |
1036 | 1027 |
1037 // Grab the green layer's content with blue in the bottom right. | 1028 // Grab the green layer's content with blue in the bottom right. |
1038 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 1029 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
1039 device_scale_factor_ = 2.f; | 1030 device_scale_factor_ = 2.f; |
1040 | 1031 |
1041 this->impl_side_painting_ = false; | 1032 this->impl_side_painting_ = false; |
1042 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, | 1033 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, |
1043 background, | 1034 background, |
1044 green.get(), | 1035 green.get(), |
1045 base::FilePath(FILE_PATH_LITERAL( | 1036 base::FilePath(FILE_PATH_LITERAL( |
1046 "green_small_with_blue_corner.png"))); | 1037 "green_small_with_blue_corner.png"))); |
1047 } | 1038 } |
1048 | 1039 |
1049 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, | 1040 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, |
1050 ReadbackNonRootLayerSubrect_GL) { | 1041 ReadbackNonRootLayerSubrect_GL) { |
1051 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); | 1042 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); |
1052 background->SetAnchorPoint(gfx::PointF()); | |
1053 background->SetBounds(gfx::Size(100, 100)); | 1043 background->SetBounds(gfx::Size(100, 100)); |
1054 background->SetIsDrawable(true); | 1044 background->SetIsDrawable(true); |
1055 | 1045 |
1056 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); | 1046 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); |
1057 green->SetAnchorPoint(gfx::PointF()); | |
1058 green->SetPosition(gfx::Point(10, 20)); | 1047 green->SetPosition(gfx::Point(10, 20)); |
1059 green->SetBounds(gfx::Size(90, 80)); | 1048 green->SetBounds(gfx::Size(90, 80)); |
1060 green->SetIsDrawable(true); | 1049 green->SetIsDrawable(true); |
1061 background->AddChild(green); | 1050 background->AddChild(green); |
1062 | 1051 |
1063 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); | 1052 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); |
1064 blue->SetAnchorPoint(gfx::PointF()); | |
1065 blue->SetPosition(gfx::Point(50, 50)); | 1053 blue->SetPosition(gfx::Point(50, 50)); |
1066 blue->SetBounds(gfx::Size(25, 25)); | 1054 blue->SetBounds(gfx::Size(25, 25)); |
1067 blue->SetIsDrawable(true); | 1055 blue->SetIsDrawable(true); |
1068 green->AddChild(blue); | 1056 green->AddChild(blue); |
1069 | 1057 |
1070 // Grab the green layer's content with blue in the bottom right. | 1058 // Grab the green layer's content with blue in the bottom right. |
1071 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 1059 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
1072 device_scale_factor_ = 2.f; | 1060 device_scale_factor_ = 2.f; |
1073 | 1061 |
1074 this->impl_side_painting_ = false; | 1062 this->impl_side_painting_ = false; |
(...skipping 23 matching lines...) Expand all Loading... |
1098 background, | 1086 background, |
1099 green.get(), | 1087 green.get(), |
1100 base::FilePath(FILE_PATH_LITERAL( | 1088 base::FilePath(FILE_PATH_LITERAL( |
1101 "green_with_blue_corner.png"))); | 1089 "green_with_blue_corner.png"))); |
1102 } | 1090 } |
1103 | 1091 |
1104 } // namespace | 1092 } // namespace |
1105 } // namespace cc | 1093 } // namespace cc |
1106 | 1094 |
1107 #endif // OS_ANDROID | 1095 #endif // OS_ANDROID |
OLD | NEW |