OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 102 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
103 quad->SetNew(shared_state, | 103 quad->SetNew(shared_state, |
104 rect, | 104 rect, |
105 rect, | 105 rect, |
106 pass_id, | 106 pass_id, |
107 false, // is_replica | 107 false, // is_replica |
108 0, // mask_resource_id | 108 0, // mask_resource_id |
109 rect, // contents_changed_since_last_frame | 109 rect, // contents_changed_since_last_frame |
110 gfx::RectF(1.f, 1.f), // mask_uv_rect | 110 gfx::RectF(1.f, 1.f), // mask_uv_rect |
111 FilterOperations(), // foreground filters | 111 FilterOperations(), // foreground filters |
| 112 gfx::Vector2dF(), // filters scale |
112 FilterOperations()); // background filters | 113 FilterOperations()); // background filters |
113 } | 114 } |
114 | 115 |
115 void CreateTestTextureDrawQuad(const gfx::Rect& rect, | 116 void CreateTestTextureDrawQuad(const gfx::Rect& rect, |
116 SkColor texel_color, | 117 SkColor texel_color, |
117 SkColor background_color, | 118 SkColor background_color, |
118 bool premultiplied_alpha, | 119 bool premultiplied_alpha, |
119 const SharedQuadState* shared_state, | 120 const SharedQuadState* shared_state, |
120 ResourceProvider* resource_provider, | 121 ResourceProvider* resource_provider, |
121 RenderPass* render_pass) { | 122 RenderPass* render_pass) { |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 805 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
805 render_pass_quad->SetNew(pass_shared_state, | 806 render_pass_quad->SetNew(pass_shared_state, |
806 pass_rect, | 807 pass_rect, |
807 pass_rect, | 808 pass_rect, |
808 child_pass_id, | 809 child_pass_id, |
809 false, | 810 false, |
810 0, | 811 0, |
811 pass_rect, | 812 pass_rect, |
812 gfx::RectF(), | 813 gfx::RectF(), |
813 filters, | 814 filters, |
| 815 gfx::Vector2dF(), |
814 FilterOperations()); | 816 FilterOperations()); |
815 | 817 |
816 RenderPassList pass_list; | 818 RenderPassList pass_list; |
817 pass_list.push_back(child_pass.Pass()); | 819 pass_list.push_back(child_pass.Pass()); |
818 pass_list.push_back(root_pass.Pass()); | 820 pass_list.push_back(root_pass.Pass()); |
819 | 821 |
820 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 822 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
821 // renderer so use a fuzzy comparator. | 823 // renderer so use a fuzzy comparator. |
822 EXPECT_TRUE(this->RunPixelTest( | 824 EXPECT_TRUE(this->RunPixelTest( |
823 &pass_list, | 825 &pass_list, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 878 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
877 render_pass_quad->SetNew(pass_shared_state, | 879 render_pass_quad->SetNew(pass_shared_state, |
878 pass_rect, | 880 pass_rect, |
879 pass_rect, | 881 pass_rect, |
880 child_pass_id, | 882 child_pass_id, |
881 false, | 883 false, |
882 0, | 884 0, |
883 pass_rect, | 885 pass_rect, |
884 gfx::RectF(), | 886 gfx::RectF(), |
885 filters, | 887 filters, |
| 888 gfx::Vector2dF(), |
886 FilterOperations()); | 889 FilterOperations()); |
887 | 890 |
888 RenderPassList pass_list; | 891 RenderPassList pass_list; |
889 pass_list.push_back(child_pass.Pass()); | 892 pass_list.push_back(child_pass.Pass()); |
890 pass_list.push_back(root_pass.Pass()); | 893 pass_list.push_back(root_pass.Pass()); |
891 | 894 |
892 EXPECT_TRUE(this->RunPixelTest( | 895 EXPECT_TRUE(this->RunPixelTest( |
893 &pass_list, | 896 &pass_list, |
894 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), | 897 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), |
895 ExactPixelComparator(true))); | 898 ExactPixelComparator(true))); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 950 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
948 render_pass_quad->SetNew(pass_shared_state, | 951 render_pass_quad->SetNew(pass_shared_state, |
949 pass_rect, | 952 pass_rect, |
950 pass_rect, | 953 pass_rect, |
951 child_pass_id, | 954 child_pass_id, |
952 false, | 955 false, |
953 0, | 956 0, |
954 pass_rect, | 957 pass_rect, |
955 gfx::RectF(), | 958 gfx::RectF(), |
956 filters, | 959 filters, |
| 960 gfx::Vector2dF(), |
957 FilterOperations()); | 961 FilterOperations()); |
958 | 962 |
959 RenderPassList pass_list; | 963 RenderPassList pass_list; |
960 pass_list.push_back(child_pass.Pass()); | 964 pass_list.push_back(child_pass.Pass()); |
961 pass_list.push_back(root_pass.Pass()); | 965 pass_list.push_back(root_pass.Pass()); |
962 | 966 |
963 EXPECT_TRUE(this->RunPixelTest( | 967 EXPECT_TRUE(this->RunPixelTest( |
964 &pass_list, | 968 &pass_list, |
965 base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")), | 969 base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")), |
966 ExactPixelComparator(true))); | 970 ExactPixelComparator(true))); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 1044 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
1041 render_pass_quad->SetNew(pass_shared_state, | 1045 render_pass_quad->SetNew(pass_shared_state, |
1042 pass_rect, | 1046 pass_rect, |
1043 pass_rect, | 1047 pass_rect, |
1044 child_pass_id, | 1048 child_pass_id, |
1045 false, | 1049 false, |
1046 0, | 1050 0, |
1047 pass_rect, | 1051 pass_rect, |
1048 gfx::RectF(), | 1052 gfx::RectF(), |
1049 filters, | 1053 filters, |
| 1054 gfx::Vector2dF(), |
1050 FilterOperations()); | 1055 FilterOperations()); |
1051 | 1056 |
1052 RenderPassList pass_list; | 1057 RenderPassList pass_list; |
1053 | 1058 |
1054 pass_list.push_back(child_pass.Pass()); | 1059 pass_list.push_back(child_pass.Pass()); |
1055 pass_list.push_back(root_pass.Pass()); | 1060 pass_list.push_back(root_pass.Pass()); |
1056 | 1061 |
1057 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 1062 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
1058 // renderer so use a fuzzy comparator. | 1063 // renderer so use a fuzzy comparator. |
1059 EXPECT_TRUE(this->RunPixelTest( | 1064 EXPECT_TRUE(this->RunPixelTest( |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 1253 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
1249 mask_quad->SetNew(root_pass_shared_state, | 1254 mask_quad->SetNew(root_pass_shared_state, |
1250 sub_rect, | 1255 sub_rect, |
1251 sub_rect, | 1256 sub_rect, |
1252 child_pass_id, | 1257 child_pass_id, |
1253 false, // is_replica | 1258 false, // is_replica |
1254 mask_resource_id, | 1259 mask_resource_id, |
1255 sub_rect, // contents_changed_since_last_frame | 1260 sub_rect, // contents_changed_since_last_frame |
1256 gfx::RectF(1.f, 1.f), // mask_uv_rect | 1261 gfx::RectF(1.f, 1.f), // mask_uv_rect |
1257 FilterOperations(), // foreground filters | 1262 FilterOperations(), // foreground filters |
| 1263 gfx::Vector2dF(), // filters scale |
1258 FilterOperations()); // background filters | 1264 FilterOperations()); // background filters |
1259 | 1265 |
1260 // White background behind the masked render pass. | 1266 // White background behind the masked render pass. |
1261 SolidColorDrawQuad* white = | 1267 SolidColorDrawQuad* white = |
1262 root_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 1268 root_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
1263 white->SetNew(root_pass_shared_state, | 1269 white->SetNew(root_pass_shared_state, |
1264 viewport_rect, | 1270 viewport_rect, |
1265 viewport_rect, | 1271 viewport_rect, |
1266 SK_ColorWHITE, | 1272 SK_ColorWHITE, |
1267 false); | 1273 false); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 filter_pass_quad->SetNew( | 1328 filter_pass_quad->SetNew( |
1323 shared_state, | 1329 shared_state, |
1324 filter_pass_content_rect_, | 1330 filter_pass_content_rect_, |
1325 filter_pass_content_rect_, | 1331 filter_pass_content_rect_, |
1326 filter_pass_id, | 1332 filter_pass_id, |
1327 false, // is_replica | 1333 false, // is_replica |
1328 0, // mask_resource_id | 1334 0, // mask_resource_id |
1329 filter_pass_content_rect_, // contents_changed_since_last_frame | 1335 filter_pass_content_rect_, // contents_changed_since_last_frame |
1330 gfx::RectF(), // mask_uv_rect | 1336 gfx::RectF(), // mask_uv_rect |
1331 FilterOperations(), // filters | 1337 FilterOperations(), // filters |
| 1338 gfx::Vector2dF(), // filters_scale |
1332 this->background_filters_); | 1339 this->background_filters_); |
1333 } | 1340 } |
1334 | 1341 |
1335 const int kColumnWidth = device_viewport_rect.width() / 3; | 1342 const int kColumnWidth = device_viewport_rect.width() / 3; |
1336 | 1343 |
1337 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); | 1344 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); |
1338 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { | 1345 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { |
1339 SharedQuadState* shared_state = CreateTestSharedQuadState( | 1346 SharedQuadState* shared_state = CreateTestSharedQuadState( |
1340 identity_content_to_target_transform, left_rect, root_pass.get()); | 1347 identity_content_to_target_transform, left_rect, root_pass.get()); |
1341 SolidColorDrawQuad* color_quad = | 1348 SolidColorDrawQuad* color_quad = |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 EXPECT_TRUE(this->RunPixelTest( | 2181 EXPECT_TRUE(this->RunPixelTest( |
2175 &pass_list, | 2182 &pass_list, |
2176 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), | 2183 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), |
2177 FuzzyPixelOffByOneComparator(true))); | 2184 FuzzyPixelOffByOneComparator(true))); |
2178 } | 2185 } |
2179 | 2186 |
2180 #endif // !defined(OS_ANDROID) | 2187 #endif // !defined(OS_ANDROID) |
2181 | 2188 |
2182 } // namespace | 2189 } // namespace |
2183 } // namespace cc | 2190 } // namespace cc |
OLD | NEW |