OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 SkBlurImageFilter::Make(arbitrary_sigma, arbitrary_sigma, nullptr))); | 295 SkBlurImageFilter::Make(arbitrary_sigma, arbitrary_sigma, nullptr))); |
296 | 296 |
297 FilterOperations arbitrary_filters2; | 297 FilterOperations arbitrary_filters2; |
298 arbitrary_filters2.Append( | 298 arbitrary_filters2.Append( |
299 FilterOperation::CreateBrightnessFilter(arbitrary_float2)); | 299 FilterOperation::CreateBrightnessFilter(arbitrary_float2)); |
300 | 300 |
301 std::unique_ptr<RenderPass> child_pass_in = RenderPass::Create(); | 301 std::unique_ptr<RenderPass> child_pass_in = RenderPass::Create(); |
302 child_pass_in->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, | 302 child_pass_in->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, |
303 arbitrary_matrix2, arbitrary_filters1, | 303 arbitrary_matrix2, arbitrary_filters1, |
304 arbitrary_filters2, arbitrary_color_space, | 304 arbitrary_filters2, arbitrary_color_space, |
305 arbitrary_bool2); | 305 arbitrary_bool2, arbitrary_bool2, arbitrary_bool2); |
vmpstr
2017/07/13 18:01:01
There's up to 6 arbitrary bools! maybe use 3 and 4
wutao
2017/07/14 00:02:53
Done.
| |
306 | 306 |
307 std::unique_ptr<RenderPass> child_pass_cmp = RenderPass::Create(); | 307 std::unique_ptr<RenderPass> child_pass_cmp = RenderPass::Create(); |
308 child_pass_cmp->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, | 308 child_pass_cmp->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, |
309 arbitrary_matrix2, arbitrary_filters1, | 309 arbitrary_matrix2, arbitrary_filters1, |
310 arbitrary_filters2, arbitrary_color_space, | 310 arbitrary_filters2, arbitrary_color_space, |
311 arbitrary_bool2); | 311 arbitrary_bool2, arbitrary_bool2, arbitrary_bool2); |
312 | 312 |
313 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); | 313 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); |
314 pass_in->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, | 314 pass_in->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, |
315 arbitrary_filters2, arbitrary_filters1, arbitrary_color_space, | 315 arbitrary_filters2, arbitrary_filters1, arbitrary_color_space, |
316 arbitrary_bool1); | 316 arbitrary_bool1, arbitrary_bool2, arbitrary_bool2); |
317 | 317 |
318 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); | 318 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); |
319 shared_state1_in->SetAll(arbitrary_matrix1, arbitrary_rect1, arbitrary_rect1, | 319 shared_state1_in->SetAll(arbitrary_matrix1, arbitrary_rect1, arbitrary_rect1, |
320 arbitrary_rect2, arbitrary_bool1, arbitrary_float1, | 320 arbitrary_rect2, arbitrary_bool1, arbitrary_float1, |
321 arbitrary_blend_mode1, arbitrary_context_id1); | 321 arbitrary_blend_mode1, arbitrary_context_id1); |
322 | 322 |
323 std::unique_ptr<RenderPass> pass_cmp = RenderPass::Create(); | 323 std::unique_ptr<RenderPass> pass_cmp = RenderPass::Create(); |
324 pass_cmp->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, | 324 pass_cmp->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, |
325 arbitrary_filters2, arbitrary_filters1, | 325 arbitrary_filters2, arbitrary_filters1, |
326 arbitrary_color_space, arbitrary_bool1); | 326 arbitrary_color_space, arbitrary_bool1, arbitrary_bool2, |
327 arbitrary_bool2); | |
327 | 328 |
328 SharedQuadState* shared_state1_cmp = | 329 SharedQuadState* shared_state1_cmp = |
329 pass_cmp->CreateAndAppendSharedQuadState(); | 330 pass_cmp->CreateAndAppendSharedQuadState(); |
330 *shared_state1_cmp = *shared_state1_in; | 331 *shared_state1_cmp = *shared_state1_in; |
331 | 332 |
332 DebugBorderDrawQuad* debugborder_in = | 333 DebugBorderDrawQuad* debugborder_in = |
333 pass_in->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 334 pass_in->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
334 debugborder_in->SetAll(shared_state1_in, arbitrary_rect3, | 335 debugborder_in->SetAll(shared_state1_in, arbitrary_rect3, |
335 arbitrary_rect1_inside_rect3, | 336 arbitrary_rect1_inside_rect3, |
336 arbitrary_rect2_inside_rect3, arbitrary_bool1, | 337 arbitrary_rect2_inside_rect3, arbitrary_bool1, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 pass_out->quad_list.ElementAt(i)->shared_quad_state == | 498 pass_out->quad_list.ElementAt(i)->shared_quad_state == |
498 pass_out->quad_list.ElementAt(i - 1)->shared_quad_state; | 499 pass_out->quad_list.ElementAt(i - 1)->shared_quad_state; |
499 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); | 500 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); |
500 } | 501 } |
501 } | 502 } |
502 | 503 |
503 TEST_F(CCParamTraitsTest, UnusedSharedQuadStates) { | 504 TEST_F(CCParamTraitsTest, UnusedSharedQuadStates) { |
504 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); | 505 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); |
505 pass_in->SetAll(1, gfx::Rect(100, 100), gfx::Rect(), gfx::Transform(), | 506 pass_in->SetAll(1, gfx::Rect(100, 100), gfx::Rect(), gfx::Transform(), |
506 FilterOperations(), FilterOperations(), | 507 FilterOperations(), FilterOperations(), |
507 gfx::ColorSpace::CreateSRGB(), false); | 508 gfx::ColorSpace::CreateSRGB(), false, false, false); |
508 | 509 |
509 // The first SharedQuadState is used. | 510 // The first SharedQuadState is used. |
510 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); | 511 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); |
511 shared_state1_in->SetAll(gfx::Transform(), gfx::Rect(1, 1), gfx::Rect(), | 512 shared_state1_in->SetAll(gfx::Transform(), gfx::Rect(1, 1), gfx::Rect(), |
512 gfx::Rect(), false, 1.f, SkBlendMode::kSrcOver, 0); | 513 gfx::Rect(), false, 1.f, SkBlendMode::kSrcOver, 0); |
513 | 514 |
514 SolidColorDrawQuad* quad1 = | 515 SolidColorDrawQuad* quad1 = |
515 pass_in->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 516 pass_in->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
516 quad1->SetAll(shared_state1_in, gfx::Rect(10, 10), gfx::Rect(10, 10), | 517 quad1->SetAll(shared_state1_in, gfx::Rect(10, 10), gfx::Rect(10, 10), |
517 gfx::Rect(10, 10), false, SK_ColorRED, false); | 518 gfx::Rect(10, 10), false, SK_ColorRED, false); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 cc::SurfaceInfo surface_info_out; | 654 cc::SurfaceInfo surface_info_out; |
654 base::PickleIterator iter(msg); | 655 base::PickleIterator iter(msg); |
655 EXPECT_TRUE( | 656 EXPECT_TRUE( |
656 IPC::ParamTraits<cc::SurfaceInfo>::Read(&msg, &iter, &surface_info_out)); | 657 IPC::ParamTraits<cc::SurfaceInfo>::Read(&msg, &iter, &surface_info_out)); |
657 | 658 |
658 ASSERT_EQ(surface_info_in, surface_info_out); | 659 ASSERT_EQ(surface_info_in, surface_info_out); |
659 } | 660 } |
660 | 661 |
661 } // namespace | 662 } // namespace |
662 } // namespace content | 663 } // namespace content |
OLD | NEW |