| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 scoped_ptr<DrawQuad> CreateTestRenderPassDrawQuad( | 97 scoped_ptr<DrawQuad> CreateTestRenderPassDrawQuad( |
| 98 SharedQuadState* shared_state, | 98 SharedQuadState* shared_state, |
| 99 const gfx::Rect& rect, | 99 const gfx::Rect& rect, |
| 100 RenderPass::Id pass_id) { | 100 RenderPass::Id pass_id) { |
| 101 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); | 101 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); |
| 102 quad->SetNew(shared_state, | 102 quad->SetNew(shared_state, |
| 103 rect, | 103 rect, |
| 104 rect, | 104 rect, |
| 105 pass_id, | 105 pass_id, |
| 106 false, // is_replica | 106 false, // is_replica |
| 107 0, // mask_resource_id | 107 0, // mask_resource_id |
| 108 rect, // contents_changed_since_last_frame | 108 rect, // contents_changed_since_last_frame |
| 109 gfx::RectF(1.f, 1.f), // mask_uv_rect | 109 gfx::RectF(1.f, 1.f), // mask_uv_rect |
| 110 FilterOperations(), // foreground filters | 110 FilterOperations(), // foreground filters |
| 111 FilterOperations()); // background filters | 111 FilterOperations(), // background filters |
| 112 gfx::Vector2dF(1.f, 1.f)); // scale |
| 112 | 113 |
| 113 return quad.PassAs<DrawQuad>(); | 114 return quad.PassAs<DrawQuad>(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( | 117 scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( |
| 117 const gfx::Rect& rect, | 118 const gfx::Rect& rect, |
| 118 SkColor texel_color, | 119 SkColor texel_color, |
| 119 SkColor background_color, | 120 SkColor background_color, |
| 120 bool premultiplied_alpha, | 121 bool premultiplied_alpha, |
| 121 SharedQuadState* shared_state, | 122 SharedQuadState* shared_state, |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 RenderPassDrawQuad::Create(); | 828 RenderPassDrawQuad::Create(); |
| 828 render_pass_quad->SetNew(pass_shared_state, | 829 render_pass_quad->SetNew(pass_shared_state, |
| 829 pass_rect, | 830 pass_rect, |
| 830 pass_rect, | 831 pass_rect, |
| 831 child_pass_id, | 832 child_pass_id, |
| 832 false, | 833 false, |
| 833 0, | 834 0, |
| 834 pass_rect, | 835 pass_rect, |
| 835 gfx::RectF(), | 836 gfx::RectF(), |
| 836 filters, | 837 filters, |
| 837 FilterOperations()); | 838 FilterOperations(), |
| 839 gfx::Vector2dF(1.f, 1.f)); |
| 838 | 840 |
| 839 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 841 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
| 840 | 842 |
| 841 RenderPassList pass_list; | 843 RenderPassList pass_list; |
| 842 pass_list.push_back(child_pass.Pass()); | 844 pass_list.push_back(child_pass.Pass()); |
| 843 pass_list.push_back(root_pass.Pass()); | 845 pass_list.push_back(root_pass.Pass()); |
| 844 | 846 |
| 845 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 847 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
| 846 // renderer so use a fuzzy comparator. | 848 // renderer so use a fuzzy comparator. |
| 847 EXPECT_TRUE(this->RunPixelTest( | 849 EXPECT_TRUE(this->RunPixelTest( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 RenderPassDrawQuad::Create(); | 904 RenderPassDrawQuad::Create(); |
| 903 render_pass_quad->SetNew(pass_shared_state, | 905 render_pass_quad->SetNew(pass_shared_state, |
| 904 pass_rect, | 906 pass_rect, |
| 905 pass_rect, | 907 pass_rect, |
| 906 child_pass_id, | 908 child_pass_id, |
| 907 false, | 909 false, |
| 908 0, | 910 0, |
| 909 pass_rect, | 911 pass_rect, |
| 910 gfx::RectF(), | 912 gfx::RectF(), |
| 911 filters, | 913 filters, |
| 912 FilterOperations()); | 914 FilterOperations(), |
| 915 gfx::Vector2dF(1.f, 1.f)); |
| 913 | 916 |
| 914 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 917 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
| 915 | 918 |
| 916 RenderPassList pass_list; | 919 RenderPassList pass_list; |
| 917 pass_list.push_back(child_pass.Pass()); | 920 pass_list.push_back(child_pass.Pass()); |
| 918 pass_list.push_back(root_pass.Pass()); | 921 pass_list.push_back(root_pass.Pass()); |
| 919 | 922 |
| 920 EXPECT_TRUE(this->RunPixelTest( | 923 EXPECT_TRUE(this->RunPixelTest( |
| 921 &pass_list, | 924 &pass_list, |
| 922 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), | 925 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 RenderPassDrawQuad::Create(); | 979 RenderPassDrawQuad::Create(); |
| 977 render_pass_quad->SetNew(pass_shared_state, | 980 render_pass_quad->SetNew(pass_shared_state, |
| 978 pass_rect, | 981 pass_rect, |
| 979 pass_rect, | 982 pass_rect, |
| 980 child_pass_id, | 983 child_pass_id, |
| 981 false, | 984 false, |
| 982 0, | 985 0, |
| 983 pass_rect, | 986 pass_rect, |
| 984 gfx::RectF(), | 987 gfx::RectF(), |
| 985 filters, | 988 filters, |
| 986 FilterOperations()); | 989 FilterOperations(), |
| 990 gfx::Vector2dF(1.f, 1.f)); // scale |
| 987 | 991 |
| 988 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 992 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
| 989 | 993 |
| 990 RenderPassList pass_list; | 994 RenderPassList pass_list; |
| 991 pass_list.push_back(child_pass.Pass()); | 995 pass_list.push_back(child_pass.Pass()); |
| 992 pass_list.push_back(root_pass.Pass()); | 996 pass_list.push_back(root_pass.Pass()); |
| 993 | 997 |
| 994 EXPECT_TRUE(this->RunPixelTest( | 998 EXPECT_TRUE(this->RunPixelTest( |
| 995 &pass_list, | 999 &pass_list, |
| 996 base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")), | 1000 base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")), |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 RenderPassDrawQuad::Create(); | 1076 RenderPassDrawQuad::Create(); |
| 1073 render_pass_quad->SetNew(pass_shared_state, | 1077 render_pass_quad->SetNew(pass_shared_state, |
| 1074 pass_rect, | 1078 pass_rect, |
| 1075 pass_rect, | 1079 pass_rect, |
| 1076 child_pass_id, | 1080 child_pass_id, |
| 1077 false, | 1081 false, |
| 1078 0, | 1082 0, |
| 1079 pass_rect, | 1083 pass_rect, |
| 1080 gfx::RectF(), | 1084 gfx::RectF(), |
| 1081 filters, | 1085 filters, |
| 1082 FilterOperations()); | 1086 FilterOperations(), |
| 1087 gfx::Vector2dF(1.f, 1.f)); // scale |
| 1083 | 1088 |
| 1084 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 1089 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
| 1085 RenderPassList pass_list; | 1090 RenderPassList pass_list; |
| 1086 | 1091 |
| 1087 pass_list.push_back(child_pass.Pass()); | 1092 pass_list.push_back(child_pass.Pass()); |
| 1088 pass_list.push_back(root_pass.Pass()); | 1093 pass_list.push_back(root_pass.Pass()); |
| 1089 | 1094 |
| 1090 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 1095 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
| 1091 // renderer so use a fuzzy comparator. | 1096 // renderer so use a fuzzy comparator. |
| 1092 EXPECT_TRUE(this->RunPixelTest( | 1097 EXPECT_TRUE(this->RunPixelTest( |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 scoped_ptr<RenderPassDrawQuad> mask_quad = RenderPassDrawQuad::Create(); | 1287 scoped_ptr<RenderPassDrawQuad> mask_quad = RenderPassDrawQuad::Create(); |
| 1283 mask_quad->SetNew(root_pass_shared_state, | 1288 mask_quad->SetNew(root_pass_shared_state, |
| 1284 sub_rect, | 1289 sub_rect, |
| 1285 sub_rect, | 1290 sub_rect, |
| 1286 child_pass_id, | 1291 child_pass_id, |
| 1287 false, // is_replica | 1292 false, // is_replica |
| 1288 mask_resource_id, | 1293 mask_resource_id, |
| 1289 sub_rect, // contents_changed_since_last_frame | 1294 sub_rect, // contents_changed_since_last_frame |
| 1290 gfx::RectF(1.f, 1.f), // mask_uv_rect | 1295 gfx::RectF(1.f, 1.f), // mask_uv_rect |
| 1291 FilterOperations(), // foreground filters | 1296 FilterOperations(), // foreground filters |
| 1292 FilterOperations()); // background filters | 1297 FilterOperations(), // background filters |
| 1298 gfx::Vector2dF(1.f, 1.f)); // scale |
| 1299 |
| 1293 root_pass->quad_list.push_back(mask_quad.PassAs<DrawQuad>()); | 1300 root_pass->quad_list.push_back(mask_quad.PassAs<DrawQuad>()); |
| 1294 | 1301 |
| 1295 // White background behind the masked render pass. | 1302 // White background behind the masked render pass. |
| 1296 scoped_ptr<SolidColorDrawQuad> white = SolidColorDrawQuad::Create(); | 1303 scoped_ptr<SolidColorDrawQuad> white = SolidColorDrawQuad::Create(); |
| 1297 white->SetNew(root_pass_shared_state, | 1304 white->SetNew(root_pass_shared_state, |
| 1298 viewport_rect, | 1305 viewport_rect, |
| 1299 viewport_rect, | 1306 viewport_rect, |
| 1300 SK_ColorWHITE, | 1307 SK_ColorWHITE, |
| 1301 false); | 1308 false); |
| 1302 root_pass->quad_list.push_back(white.PassAs<DrawQuad>()); | 1309 root_pass->quad_list.push_back(white.PassAs<DrawQuad>()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 filter_pass_quad->SetNew( | 1364 filter_pass_quad->SetNew( |
| 1358 shared_state, | 1365 shared_state, |
| 1359 filter_pass_content_rect_, | 1366 filter_pass_content_rect_, |
| 1360 filter_pass_content_rect_, | 1367 filter_pass_content_rect_, |
| 1361 filter_pass_id, | 1368 filter_pass_id, |
| 1362 false, // is_replica | 1369 false, // is_replica |
| 1363 0, // mask_resource_id | 1370 0, // mask_resource_id |
| 1364 filter_pass_content_rect_, // contents_changed_since_last_frame | 1371 filter_pass_content_rect_, // contents_changed_since_last_frame |
| 1365 gfx::RectF(), // mask_uv_rect | 1372 gfx::RectF(), // mask_uv_rect |
| 1366 FilterOperations(), // filters | 1373 FilterOperations(), // filters |
| 1367 this->background_filters_); | 1374 this->background_filters_, |
| 1375 gfx::Vector2dF(1.f, 1.f)); // scale |
| 1376 |
| 1368 root_pass->quad_list.push_back(filter_pass_quad.PassAs<DrawQuad>()); | 1377 root_pass->quad_list.push_back(filter_pass_quad.PassAs<DrawQuad>()); |
| 1369 } | 1378 } |
| 1370 | 1379 |
| 1371 const int kColumnWidth = device_viewport_rect.width() / 3; | 1380 const int kColumnWidth = device_viewport_rect.width() / 3; |
| 1372 | 1381 |
| 1373 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); | 1382 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); |
| 1374 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { | 1383 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { |
| 1375 SharedQuadState* shared_state = CreateTestSharedQuadState( | 1384 SharedQuadState* shared_state = CreateTestSharedQuadState( |
| 1376 root_pass.get(), identity_content_to_target_transform, left_rect); | 1385 root_pass.get(), identity_content_to_target_transform, left_rect); |
| 1377 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); | 1386 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 EXPECT_TRUE(this->RunPixelTest( | 2234 EXPECT_TRUE(this->RunPixelTest( |
| 2226 &pass_list, | 2235 &pass_list, |
| 2227 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), | 2236 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), |
| 2228 FuzzyPixelOffByOneComparator(true))); | 2237 FuzzyPixelOffByOneComparator(true))); |
| 2229 } | 2238 } |
| 2230 | 2239 |
| 2231 #endif // !defined(OS_ANDROID) | 2240 #endif // !defined(OS_ANDROID) |
| 2232 | 2241 |
| 2233 } // namespace | 2242 } // namespace |
| 2234 } // namespace cc | 2243 } // namespace cc |
| OLD | NEW |