| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 SkBlurImageFilter::Make(arbitrary_sigma, arbitrary_sigma, nullptr))); | 294 SkBlurImageFilter::Make(arbitrary_sigma, arbitrary_sigma, nullptr))); |
| 295 | 295 |
| 296 FilterOperations arbitrary_filters2; | 296 FilterOperations arbitrary_filters2; |
| 297 arbitrary_filters2.Append( | 297 arbitrary_filters2.Append( |
| 298 FilterOperation::CreateBrightnessFilter(arbitrary_float2)); | 298 FilterOperation::CreateBrightnessFilter(arbitrary_float2)); |
| 299 | 299 |
| 300 std::unique_ptr<RenderPass> child_pass_in = RenderPass::Create(); | 300 std::unique_ptr<RenderPass> child_pass_in = RenderPass::Create(); |
| 301 child_pass_in->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, | 301 child_pass_in->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, |
| 302 arbitrary_matrix2, arbitrary_filters1, | 302 arbitrary_matrix2, arbitrary_filters1, |
| 303 arbitrary_filters2, arbitrary_color_space, | 303 arbitrary_filters2, arbitrary_color_space, |
| 304 arbitrary_bool2); | 304 arbitrary_bool2, arbitrary_bool2, arbitrary_bool2); |
| 305 | 305 |
| 306 std::unique_ptr<RenderPass> child_pass_cmp = RenderPass::Create(); | 306 std::unique_ptr<RenderPass> child_pass_cmp = RenderPass::Create(); |
| 307 child_pass_cmp->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, | 307 child_pass_cmp->SetAll(child_id, arbitrary_rect2, arbitrary_rect3, |
| 308 arbitrary_matrix2, arbitrary_filters1, | 308 arbitrary_matrix2, arbitrary_filters1, |
| 309 arbitrary_filters2, arbitrary_color_space, | 309 arbitrary_filters2, arbitrary_color_space, |
| 310 arbitrary_bool2); | 310 arbitrary_bool2, arbitrary_bool2, arbitrary_bool2); |
| 311 | 311 |
| 312 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); | 312 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); |
| 313 pass_in->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, | 313 pass_in->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, |
| 314 arbitrary_filters2, arbitrary_filters1, arbitrary_color_space, | 314 arbitrary_filters2, arbitrary_filters1, arbitrary_color_space, |
| 315 arbitrary_bool1); | 315 arbitrary_bool1, arbitrary_bool2, arbitrary_bool2); |
| 316 | 316 |
| 317 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); | 317 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); |
| 318 shared_state1_in->SetAll(arbitrary_matrix1, arbitrary_rect1, arbitrary_rect1, | 318 shared_state1_in->SetAll(arbitrary_matrix1, arbitrary_rect1, arbitrary_rect1, |
| 319 arbitrary_rect2, arbitrary_bool1, arbitrary_float1, | 319 arbitrary_rect2, arbitrary_bool1, arbitrary_float1, |
| 320 arbitrary_blend_mode1, arbitrary_context_id1); | 320 arbitrary_blend_mode1, arbitrary_context_id1); |
| 321 | 321 |
| 322 std::unique_ptr<RenderPass> pass_cmp = RenderPass::Create(); | 322 std::unique_ptr<RenderPass> pass_cmp = RenderPass::Create(); |
| 323 pass_cmp->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, | 323 pass_cmp->SetAll(root_id, arbitrary_rect1, arbitrary_rect2, arbitrary_matrix1, |
| 324 arbitrary_filters2, arbitrary_filters1, | 324 arbitrary_filters2, arbitrary_filters1, |
| 325 arbitrary_color_space, arbitrary_bool1); | 325 arbitrary_color_space, arbitrary_bool1, arbitrary_bool2, |
| 326 arbitrary_bool2); |
| 326 | 327 |
| 327 SharedQuadState* shared_state1_cmp = | 328 SharedQuadState* shared_state1_cmp = |
| 328 pass_cmp->CreateAndAppendSharedQuadState(); | 329 pass_cmp->CreateAndAppendSharedQuadState(); |
| 329 *shared_state1_cmp = *shared_state1_in; | 330 *shared_state1_cmp = *shared_state1_in; |
| 330 | 331 |
| 331 DebugBorderDrawQuad* debugborder_in = | 332 DebugBorderDrawQuad* debugborder_in = |
| 332 pass_in->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 333 pass_in->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
| 333 debugborder_in->SetAll(shared_state1_in, arbitrary_rect3, | 334 debugborder_in->SetAll(shared_state1_in, arbitrary_rect3, |
| 334 arbitrary_rect1_inside_rect3, | 335 arbitrary_rect1_inside_rect3, |
| 335 arbitrary_rect2_inside_rect3, arbitrary_bool1, | 336 arbitrary_rect2_inside_rect3, arbitrary_bool1, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 pass_out->quad_list.ElementAt(i)->shared_quad_state == | 497 pass_out->quad_list.ElementAt(i)->shared_quad_state == |
| 497 pass_out->quad_list.ElementAt(i - 1)->shared_quad_state; | 498 pass_out->quad_list.ElementAt(i - 1)->shared_quad_state; |
| 498 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); | 499 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); |
| 499 } | 500 } |
| 500 } | 501 } |
| 501 | 502 |
| 502 TEST_F(CCParamTraitsTest, UnusedSharedQuadStates) { | 503 TEST_F(CCParamTraitsTest, UnusedSharedQuadStates) { |
| 503 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); | 504 std::unique_ptr<RenderPass> pass_in = RenderPass::Create(); |
| 504 pass_in->SetAll(1, gfx::Rect(100, 100), gfx::Rect(), gfx::Transform(), | 505 pass_in->SetAll(1, gfx::Rect(100, 100), gfx::Rect(), gfx::Transform(), |
| 505 FilterOperations(), FilterOperations(), | 506 FilterOperations(), FilterOperations(), |
| 506 gfx::ColorSpace::CreateSRGB(), false); | 507 gfx::ColorSpace::CreateSRGB(), false, false, false); |
| 507 | 508 |
| 508 // The first SharedQuadState is used. | 509 // The first SharedQuadState is used. |
| 509 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); | 510 SharedQuadState* shared_state1_in = pass_in->CreateAndAppendSharedQuadState(); |
| 510 shared_state1_in->SetAll(gfx::Transform(), gfx::Rect(1, 1), gfx::Rect(), | 511 shared_state1_in->SetAll(gfx::Transform(), gfx::Rect(1, 1), gfx::Rect(), |
| 511 gfx::Rect(), false, 1.f, SkBlendMode::kSrcOver, 0); | 512 gfx::Rect(), false, 1.f, SkBlendMode::kSrcOver, 0); |
| 512 | 513 |
| 513 SolidColorDrawQuad* quad1 = | 514 SolidColorDrawQuad* quad1 = |
| 514 pass_in->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 515 pass_in->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 515 quad1->SetAll(shared_state1_in, gfx::Rect(10, 10), gfx::Rect(10, 10), | 516 quad1->SetAll(shared_state1_in, gfx::Rect(10, 10), gfx::Rect(10, 10), |
| 516 gfx::Rect(10, 10), false, SK_ColorRED, false); | 517 gfx::Rect(10, 10), false, SK_ColorRED, false); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 cc::SurfaceInfo surface_info_out; | 653 cc::SurfaceInfo surface_info_out; |
| 653 base::PickleIterator iter(msg); | 654 base::PickleIterator iter(msg); |
| 654 EXPECT_TRUE( | 655 EXPECT_TRUE( |
| 655 IPC::ParamTraits<cc::SurfaceInfo>::Read(&msg, &iter, &surface_info_out)); | 656 IPC::ParamTraits<cc::SurfaceInfo>::Read(&msg, &iter, &surface_info_out)); |
| 656 | 657 |
| 657 ASSERT_EQ(surface_info_in, surface_info_out); | 658 ASSERT_EQ(surface_info_in, surface_info_out); |
| 658 } | 659 } |
| 659 | 660 |
| 660 } // namespace | 661 } // namespace |
| 661 } // namespace content | 662 } // namespace content |
| OLD | NEW |