Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_readback.cc

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()); 957 background->SetTransformOrigin(gfx::Point3F());
958 background->SetBounds(gfx::Size(100, 100)); 958 background->SetBounds(gfx::Size(100, 100));
959 background->SetIsDrawable(true); 959 background->SetIsDrawable(true);
960 960
961 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); 961 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_);
962 green->SetAnchorPoint(gfx::PointF()); 962 green->SetTransformOrigin(gfx::Point3F());
963 green->SetBounds(gfx::Size(100, 100)); 963 green->SetBounds(gfx::Size(100, 100));
964 green->SetIsDrawable(true); 964 green->SetIsDrawable(true);
965 background->AddChild(green); 965 background->AddChild(green);
966 966
967 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); 967 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_);
968 blue->SetAnchorPoint(gfx::PointF()); 968 blue->SetTransformOrigin(gfx::Point3F());
969 blue->SetPosition(gfx::Point(50, 50)); 969 blue->SetPosition(gfx::Point(50, 50));
970 blue->SetBounds(gfx::Size(25, 25)); 970 blue->SetBounds(gfx::Size(25, 25));
971 blue->SetIsDrawable(true); 971 blue->SetIsDrawable(true);
972 green->AddChild(blue); 972 green->AddChild(blue);
973 973
974 // Grab the middle of the root layer. 974 // Grab the middle of the root layer.
975 copy_subrect_ = gfx::Rect(25, 25, 50, 50); 975 copy_subrect_ = gfx::Rect(25, 25, 50, 50);
976 device_scale_factor_ = 2.f; 976 device_scale_factor_ = 2.f;
977 977
978 this->impl_side_painting_ = false; 978 this->impl_side_painting_ = false;
979 RunPixelTest(SOFTWARE_WITH_DEFAULT, 979 RunPixelTest(SOFTWARE_WITH_DEFAULT,
980 background, 980 background,
981 base::FilePath(FILE_PATH_LITERAL( 981 base::FilePath(FILE_PATH_LITERAL(
982 "green_small_with_blue_corner.png"))); 982 "green_small_with_blue_corner.png")));
983 } 983 }
984 984
985 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, 985 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
986 ReadbackSubrect_GL) { 986 ReadbackSubrect_GL) {
987 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); 987 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_);
988 background->SetAnchorPoint(gfx::PointF()); 988 background->SetTransformOrigin(gfx::Point3F());
989 background->SetBounds(gfx::Size(100, 100)); 989 background->SetBounds(gfx::Size(100, 100));
990 background->SetIsDrawable(true); 990 background->SetIsDrawable(true);
991 991
992 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); 992 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_);
993 green->SetAnchorPoint(gfx::PointF()); 993 green->SetTransformOrigin(gfx::Point3F());
994 green->SetBounds(gfx::Size(100, 100)); 994 green->SetBounds(gfx::Size(100, 100));
995 green->SetIsDrawable(true); 995 green->SetIsDrawable(true);
996 background->AddChild(green); 996 background->AddChild(green);
997 997
998 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); 998 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_);
999 blue->SetAnchorPoint(gfx::PointF()); 999 blue->SetTransformOrigin(gfx::Point3F());
1000 blue->SetPosition(gfx::Point(50, 50)); 1000 blue->SetPosition(gfx::Point(50, 50));
1001 blue->SetBounds(gfx::Size(25, 25)); 1001 blue->SetBounds(gfx::Size(25, 25));
1002 blue->SetIsDrawable(true); 1002 blue->SetIsDrawable(true);
1003 green->AddChild(blue); 1003 green->AddChild(blue);
1004 1004
1005 // Grab the middle of the root layer. 1005 // Grab the middle of the root layer.
1006 copy_subrect_ = gfx::Rect(25, 25, 50, 50); 1006 copy_subrect_ = gfx::Rect(25, 25, 50, 50);
1007 device_scale_factor_ = 2.f; 1007 device_scale_factor_ = 2.f;
1008 1008
1009 this->impl_side_painting_ = false; 1009 this->impl_side_painting_ = false;
1010 RunPixelTest(GL_WITH_DEFAULT, 1010 RunPixelTest(GL_WITH_DEFAULT,
1011 background, 1011 background,
1012 base::FilePath(FILE_PATH_LITERAL( 1012 base::FilePath(FILE_PATH_LITERAL(
1013 "green_small_with_blue_corner.png"))); 1013 "green_small_with_blue_corner.png")));
1014 } 1014 }
1015 1015
1016 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, 1016 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
1017 ReadbackNonRootLayerSubrect_Software) { 1017 ReadbackNonRootLayerSubrect_Software) {
1018 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); 1018 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_);
1019 background->SetAnchorPoint(gfx::PointF()); 1019 background->SetTransformOrigin(gfx::Point3F());
1020 background->SetBounds(gfx::Size(100, 100)); 1020 background->SetBounds(gfx::Size(100, 100));
1021 background->SetIsDrawable(true); 1021 background->SetIsDrawable(true);
1022 1022
1023 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); 1023 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_);
1024 green->SetAnchorPoint(gfx::PointF()); 1024 green->SetTransformOrigin(gfx::Point3F());
1025 green->SetPosition(gfx::Point(10, 20)); 1025 green->SetPosition(gfx::Point(10, 20));
1026 green->SetBounds(gfx::Size(90, 80)); 1026 green->SetBounds(gfx::Size(90, 80));
1027 green->SetIsDrawable(true); 1027 green->SetIsDrawable(true);
1028 background->AddChild(green); 1028 background->AddChild(green);
1029 1029
1030 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); 1030 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_);
1031 blue->SetAnchorPoint(gfx::PointF()); 1031 blue->SetTransformOrigin(gfx::Point3F());
1032 blue->SetPosition(gfx::Point(50, 50)); 1032 blue->SetPosition(gfx::Point(50, 50));
1033 blue->SetBounds(gfx::Size(25, 25)); 1033 blue->SetBounds(gfx::Size(25, 25));
1034 blue->SetIsDrawable(true); 1034 blue->SetIsDrawable(true);
1035 green->AddChild(blue); 1035 green->AddChild(blue);
1036 1036
1037 // Grab the green layer's content with blue in the bottom right. 1037 // Grab the green layer's content with blue in the bottom right.
1038 copy_subrect_ = gfx::Rect(25, 25, 50, 50); 1038 copy_subrect_ = gfx::Rect(25, 25, 50, 50);
1039 device_scale_factor_ = 2.f; 1039 device_scale_factor_ = 2.f;
1040 1040
1041 this->impl_side_painting_ = false; 1041 this->impl_side_painting_ = false;
1042 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, 1042 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT,
1043 background, 1043 background,
1044 green.get(), 1044 green.get(),
1045 base::FilePath(FILE_PATH_LITERAL( 1045 base::FilePath(FILE_PATH_LITERAL(
1046 "green_small_with_blue_corner.png"))); 1046 "green_small_with_blue_corner.png")));
1047 } 1047 }
1048 1048
1049 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, 1049 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
1050 ReadbackNonRootLayerSubrect_GL) { 1050 ReadbackNonRootLayerSubrect_GL) {
1051 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); 1051 scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_);
1052 background->SetAnchorPoint(gfx::PointF()); 1052 background->SetTransformOrigin(gfx::Point3F());
1053 background->SetBounds(gfx::Size(100, 100)); 1053 background->SetBounds(gfx::Size(100, 100));
1054 background->SetIsDrawable(true); 1054 background->SetIsDrawable(true);
1055 1055
1056 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); 1056 scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_);
1057 green->SetAnchorPoint(gfx::PointF()); 1057 green->SetTransformOrigin(gfx::Point3F());
1058 green->SetPosition(gfx::Point(10, 20)); 1058 green->SetPosition(gfx::Point(10, 20));
1059 green->SetBounds(gfx::Size(90, 80)); 1059 green->SetBounds(gfx::Size(90, 80));
1060 green->SetIsDrawable(true); 1060 green->SetIsDrawable(true);
1061 background->AddChild(green); 1061 background->AddChild(green);
1062 1062
1063 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); 1063 scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_);
1064 blue->SetAnchorPoint(gfx::PointF()); 1064 blue->SetTransformOrigin(gfx::Point3F());
1065 blue->SetPosition(gfx::Point(50, 50)); 1065 blue->SetPosition(gfx::Point(50, 50));
1066 blue->SetBounds(gfx::Size(25, 25)); 1066 blue->SetBounds(gfx::Size(25, 25));
1067 blue->SetIsDrawable(true); 1067 blue->SetIsDrawable(true);
1068 green->AddChild(blue); 1068 green->AddChild(blue);
1069 1069
1070 // Grab the green layer's content with blue in the bottom right. 1070 // Grab the green layer's content with blue in the bottom right.
1071 copy_subrect_ = gfx::Rect(25, 25, 50, 50); 1071 copy_subrect_ = gfx::Rect(25, 25, 50, 50);
1072 device_scale_factor_ = 2.f; 1072 device_scale_factor_ = 2.f;
1073 1073
1074 this->impl_side_painting_ = false; 1074 this->impl_side_painting_ = false;
(...skipping 23 matching lines...) Expand all
1098 background, 1098 background,
1099 green.get(), 1099 green.get(),
1100 base::FilePath(FILE_PATH_LITERAL( 1100 base::FilePath(FILE_PATH_LITERAL(
1101 "green_with_blue_corner.png"))); 1101 "green_with_blue_corner.png")));
1102 } 1102 }
1103 1103
1104 } // namespace 1104 } // namespace
1105 } // namespace cc 1105 } // namespace cc
1106 1106
1107 #endif // OS_ANDROID 1107 #endif // OS_ANDROID
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698