OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/input/selection.h" | 6 #include "cc/input/selection.h" |
7 #include "cc/ipc/traits_test_service.mojom.h" | 7 #include "cc/ipc/traits_test_service.mojom.h" |
8 #include "cc/quads/debug_border_draw_quad.h" | 8 #include "cc/quads/debug_border_draw_quad.h" |
9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const EchoFilterOperationCallback& callback) override { | 56 const EchoFilterOperationCallback& callback) override { |
57 callback.Run(f); | 57 callback.Run(f); |
58 } | 58 } |
59 | 59 |
60 void EchoFilterOperations( | 60 void EchoFilterOperations( |
61 const FilterOperations& f, | 61 const FilterOperations& f, |
62 const EchoFilterOperationsCallback& callback) override { | 62 const EchoFilterOperationsCallback& callback) override { |
63 callback.Run(f); | 63 callback.Run(f); |
64 } | 64 } |
65 | 65 |
66 void EchoQuadList(const QuadList& q, | 66 void EchoRenderPass(std::unique_ptr<RenderPass> r, |
67 const EchoQuadListCallback& callback) override { | |
68 callback.Run(q); | |
69 } | |
70 | |
71 void EchoRenderPass(const std::unique_ptr<RenderPass>& r, | |
72 const EchoRenderPassCallback& callback) override { | 67 const EchoRenderPassCallback& callback) override { |
73 callback.Run(r); | 68 callback.Run(std::move(r)); |
74 } | 69 } |
75 | 70 |
76 void EchoRenderPassId(const RenderPassId& r, | 71 void EchoRenderPassId(const RenderPassId& r, |
77 const EchoRenderPassIdCallback& callback) override { | 72 const EchoRenderPassIdCallback& callback) override { |
78 callback.Run(r); | 73 callback.Run(r); |
79 } | 74 } |
80 | 75 |
81 void EchoReturnedResource( | 76 void EchoReturnedResource( |
82 const ReturnedResource& r, | 77 const ReturnedResource& r, |
83 const EchoReturnedResourceCallback& callback) override { | 78 const EchoReturnedResourceCallback& callback) override { |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 402 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
408 FilterOperations output; | 403 FilterOperations output; |
409 proxy->EchoFilterOperations(input, &output); | 404 proxy->EchoFilterOperations(input, &output); |
410 EXPECT_EQ(input.size(), output.size()); | 405 EXPECT_EQ(input.size(), output.size()); |
411 for (size_t i = 0; i < input.size(); ++i) { | 406 for (size_t i = 0; i < input.size(); ++i) { |
412 EXPECT_EQ(input.at(i), output.at(i)); | 407 EXPECT_EQ(input.at(i), output.at(i)); |
413 } | 408 } |
414 } | 409 } |
415 | 410 |
416 TEST_F(StructTraitsTest, QuadListBasic) { | 411 TEST_F(StructTraitsTest, QuadListBasic) { |
417 SharedQuadState sqs; | 412 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
418 QuadList input; | 413 render_pass->SetNew(RenderPassId(1, 1), gfx::Rect(), gfx::Rect(), |
| 414 gfx::Transform()); |
| 415 |
| 416 SharedQuadState* sqs = render_pass->CreateAndAppendSharedQuadState(); |
419 | 417 |
420 const gfx::Rect rect1(1234, 4321, 1357, 7531); | 418 const gfx::Rect rect1(1234, 4321, 1357, 7531); |
421 const SkColor color1 = SK_ColorRED; | 419 const SkColor color1 = SK_ColorRED; |
422 const int32_t width1 = 1337; | 420 const int32_t width1 = 1337; |
423 DebugBorderDrawQuad* debug_quad = | 421 DebugBorderDrawQuad* debug_quad = |
424 input.AllocateAndConstruct<DebugBorderDrawQuad>(); | 422 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
425 debug_quad->SetNew(&sqs, rect1, rect1, color1, width1); | 423 debug_quad->SetNew(sqs, rect1, rect1, color1, width1); |
426 | 424 |
427 const gfx::Rect rect2(2468, 8642, 4321, 1234); | 425 const gfx::Rect rect2(2468, 8642, 4321, 1234); |
428 const uint32_t color2 = 0xffffffff; | 426 const uint32_t color2 = 0xffffffff; |
429 const bool force_anti_aliasing_off = true; | 427 const bool force_anti_aliasing_off = true; |
430 SolidColorDrawQuad* solid_quad = | 428 SolidColorDrawQuad* solid_quad = |
431 input.AllocateAndConstruct<SolidColorDrawQuad>(); | 429 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
432 solid_quad->SetNew(&sqs, rect2, rect2, color2, force_anti_aliasing_off); | 430 solid_quad->SetNew(sqs, rect2, rect2, color2, force_anti_aliasing_off); |
433 | 431 |
434 const gfx::Rect rect3(1029, 3847, 5610, 2938); | 432 const gfx::Rect rect3(1029, 3847, 5610, 2938); |
435 const SurfaceId surface_id(1234, 5678, 2468); | 433 const SurfaceId surface_id(1234, 5678, 2468); |
436 SurfaceDrawQuad* surface_quad = input.AllocateAndConstruct<SurfaceDrawQuad>(); | 434 SurfaceDrawQuad* surface_quad = |
437 surface_quad->SetNew(&sqs, rect3, rect3, surface_id); | 435 render_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
| 436 surface_quad->SetNew(sqs, rect3, rect3, surface_id); |
438 | 437 |
439 const gfx::Rect rect4(1234, 5678, 9101112, 13141516); | 438 const gfx::Rect rect4(1234, 5678, 9101112, 13141516); |
440 const ResourceId resource_id4(1337); | 439 const ResourceId resource_id4(1337); |
441 const RenderPassId render_pass_id(1234, 5678); | 440 const RenderPassId render_pass_id(1234, 5678); |
442 const gfx::Vector2dF mask_uv_scale(1337.1f, 1234.2f); | 441 const gfx::Vector2dF mask_uv_scale(1337.1f, 1234.2f); |
443 const gfx::Size mask_texture_size(1234, 5678); | 442 const gfx::Size mask_texture_size(1234, 5678); |
444 FilterOperations filters; | 443 FilterOperations filters; |
445 filters.Append(FilterOperation::CreateBlurFilter(0.f)); | 444 filters.Append(FilterOperation::CreateBlurFilter(0.f)); |
446 filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1)); | 445 filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1)); |
447 gfx::Vector2dF filters_scale(1234.1f, 4321.2f); | 446 gfx::Vector2dF filters_scale(1234.1f, 4321.2f); |
448 FilterOperations background_filters; | 447 FilterOperations background_filters; |
449 background_filters.Append(FilterOperation::CreateSaturateFilter(4.f)); | 448 background_filters.Append(FilterOperation::CreateSaturateFilter(4.f)); |
450 background_filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1)); | 449 background_filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1)); |
451 background_filters.Append(FilterOperation::CreateSaturateFilter(2.f)); | 450 background_filters.Append(FilterOperation::CreateSaturateFilter(2.f)); |
452 | 451 |
453 RenderPassDrawQuad* render_pass_quad = | 452 RenderPassDrawQuad* render_pass_quad = |
454 input.AllocateAndConstruct<RenderPassDrawQuad>(); | 453 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
455 render_pass_quad->SetNew(&sqs, rect4, rect4, render_pass_id, resource_id4, | 454 render_pass_quad->SetNew(sqs, rect4, rect4, render_pass_id, resource_id4, |
456 mask_uv_scale, mask_texture_size, filters, | 455 mask_uv_scale, mask_texture_size, filters, |
457 filters_scale, background_filters); | 456 filters_scale, background_filters); |
458 | 457 |
459 const gfx::Rect rect5(123, 567, 91011, 131415); | 458 const gfx::Rect rect5(123, 567, 91011, 131415); |
460 const ResourceId resource_id5(1337); | 459 const ResourceId resource_id5(1337); |
461 const float vertex_opacity[4] = {1.f, 2.f, 3.f, 4.f}; | 460 const float vertex_opacity[4] = {1.f, 2.f, 3.f, 4.f}; |
462 const bool premultiplied_alpha = true; | 461 const bool premultiplied_alpha = true; |
463 const gfx::PointF uv_top_left(12.1f, 34.2f); | 462 const gfx::PointF uv_top_left(12.1f, 34.2f); |
464 const gfx::PointF uv_bottom_right(56.3f, 78.4f); | 463 const gfx::PointF uv_bottom_right(56.3f, 78.4f); |
465 const SkColor background_color = SK_ColorGREEN; | 464 const SkColor background_color = SK_ColorGREEN; |
466 const bool y_flipped = true; | 465 const bool y_flipped = true; |
467 const bool nearest_neighbor = true; | 466 const bool nearest_neighbor = true; |
468 const bool secure_output_only = true; | 467 const bool secure_output_only = true; |
469 TextureDrawQuad* texture_draw_quad = | 468 TextureDrawQuad* texture_draw_quad = |
470 input.AllocateAndConstruct<TextureDrawQuad>(); | 469 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
471 texture_draw_quad->SetNew(&sqs, rect5, rect5, rect5, resource_id5, | 470 texture_draw_quad->SetNew(sqs, rect5, rect5, rect5, resource_id5, |
472 premultiplied_alpha, uv_top_left, uv_bottom_right, | 471 premultiplied_alpha, uv_top_left, uv_bottom_right, |
473 background_color, vertex_opacity, y_flipped, | 472 background_color, vertex_opacity, y_flipped, |
474 nearest_neighbor, secure_output_only); | 473 nearest_neighbor, secure_output_only); |
475 | 474 |
476 const gfx::Rect rect6(321, 765, 11109, 151413); | 475 const gfx::Rect rect6(321, 765, 11109, 151413); |
477 const ResourceId resource_id6(1234); | 476 const ResourceId resource_id6(1234); |
478 const gfx::Size resource_size_in_pixels(1234, 5678); | 477 const gfx::Size resource_size_in_pixels(1234, 5678); |
479 const gfx::Transform matrix(16.1f, 15.3f, 14.3f, 13.7f, 12.2f, 11.4f, 10.4f, | 478 const gfx::Transform matrix(16.1f, 15.3f, 14.3f, 13.7f, 12.2f, 11.4f, 10.4f, |
480 9.8f, 8.1f, 7.3f, 6.3f, 5.7f, 4.8f, 3.4f, 2.4f, | 479 9.8f, 8.1f, 7.3f, 6.3f, 5.7f, 4.8f, 3.4f, 2.4f, |
481 1.2f); | 480 1.2f); |
482 StreamVideoDrawQuad* stream_video_draw_quad = | 481 StreamVideoDrawQuad* stream_video_draw_quad = |
483 input.AllocateAndConstruct<StreamVideoDrawQuad>(); | 482 render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); |
484 stream_video_draw_quad->SetNew(&sqs, rect6, rect6, rect6, resource_id6, | 483 stream_video_draw_quad->SetNew(sqs, rect6, rect6, rect6, resource_id6, |
485 resource_size_in_pixels, matrix); | 484 resource_size_in_pixels, matrix); |
486 | 485 |
487 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 486 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
488 QuadList output; | 487 std::unique_ptr<RenderPass> output; |
489 proxy->EchoQuadList(input, &output); | 488 proxy->EchoRenderPass(render_pass->DeepCopy(), &output); |
490 | 489 |
491 ASSERT_EQ(input.size(), output.size()); | 490 ASSERT_EQ(render_pass->quad_list.size(), output->quad_list.size()); |
492 | 491 |
493 const DebugBorderDrawQuad* out_debug_border_draw_quad = | 492 const DebugBorderDrawQuad* out_debug_border_draw_quad = |
494 DebugBorderDrawQuad::MaterialCast(output.ElementAt(0)); | 493 DebugBorderDrawQuad::MaterialCast(output->quad_list.ElementAt(0)); |
495 EXPECT_EQ(rect1, out_debug_border_draw_quad->rect); | 494 EXPECT_EQ(rect1, out_debug_border_draw_quad->rect); |
496 EXPECT_EQ(rect1, out_debug_border_draw_quad->visible_rect); | 495 EXPECT_EQ(rect1, out_debug_border_draw_quad->visible_rect); |
497 EXPECT_EQ(color1, out_debug_border_draw_quad->color); | 496 EXPECT_EQ(color1, out_debug_border_draw_quad->color); |
498 EXPECT_EQ(width1, out_debug_border_draw_quad->width); | 497 EXPECT_EQ(width1, out_debug_border_draw_quad->width); |
499 | 498 |
500 const SolidColorDrawQuad* out_solid_color_draw_quad = | 499 const SolidColorDrawQuad* out_solid_color_draw_quad = |
501 SolidColorDrawQuad::MaterialCast(output.ElementAt(1)); | 500 SolidColorDrawQuad::MaterialCast(output->quad_list.ElementAt(1)); |
502 EXPECT_EQ(rect2, out_solid_color_draw_quad->rect); | 501 EXPECT_EQ(rect2, out_solid_color_draw_quad->rect); |
503 EXPECT_EQ(rect2, out_solid_color_draw_quad->visible_rect); | 502 EXPECT_EQ(rect2, out_solid_color_draw_quad->visible_rect); |
504 EXPECT_EQ(color2, out_solid_color_draw_quad->color); | 503 EXPECT_EQ(color2, out_solid_color_draw_quad->color); |
505 EXPECT_EQ(force_anti_aliasing_off, | 504 EXPECT_EQ(force_anti_aliasing_off, |
506 out_solid_color_draw_quad->force_anti_aliasing_off); | 505 out_solid_color_draw_quad->force_anti_aliasing_off); |
507 | 506 |
508 const SurfaceDrawQuad* out_surface_draw_quad = | 507 const SurfaceDrawQuad* out_surface_draw_quad = |
509 SurfaceDrawQuad::MaterialCast(output.ElementAt(2)); | 508 SurfaceDrawQuad::MaterialCast(output->quad_list.ElementAt(2)); |
510 EXPECT_EQ(rect3, out_surface_draw_quad->rect); | 509 EXPECT_EQ(rect3, out_surface_draw_quad->rect); |
511 EXPECT_EQ(rect3, out_surface_draw_quad->visible_rect); | 510 EXPECT_EQ(rect3, out_surface_draw_quad->visible_rect); |
512 EXPECT_EQ(surface_id, out_surface_draw_quad->surface_id); | 511 EXPECT_EQ(surface_id, out_surface_draw_quad->surface_id); |
513 | 512 |
514 const RenderPassDrawQuad* out_render_pass_draw_quad = | 513 const RenderPassDrawQuad* out_render_pass_draw_quad = |
515 RenderPassDrawQuad::MaterialCast(output.ElementAt(3)); | 514 RenderPassDrawQuad::MaterialCast(output->quad_list.ElementAt(3)); |
516 EXPECT_EQ(rect4, out_render_pass_draw_quad->rect); | 515 EXPECT_EQ(rect4, out_render_pass_draw_quad->rect); |
517 EXPECT_EQ(rect4, out_render_pass_draw_quad->visible_rect); | 516 EXPECT_EQ(rect4, out_render_pass_draw_quad->visible_rect); |
518 EXPECT_EQ(render_pass_id, out_render_pass_draw_quad->render_pass_id); | 517 EXPECT_EQ(render_pass_id, out_render_pass_draw_quad->render_pass_id); |
519 EXPECT_EQ(resource_id4, out_render_pass_draw_quad->mask_resource_id()); | 518 EXPECT_EQ(resource_id4, out_render_pass_draw_quad->mask_resource_id()); |
520 EXPECT_EQ(mask_texture_size, out_render_pass_draw_quad->mask_texture_size); | 519 EXPECT_EQ(mask_texture_size, out_render_pass_draw_quad->mask_texture_size); |
521 EXPECT_EQ(filters.size(), out_render_pass_draw_quad->filters.size()); | 520 EXPECT_EQ(filters.size(), out_render_pass_draw_quad->filters.size()); |
522 for (size_t i = 0; i < filters.size(); ++i) | 521 for (size_t i = 0; i < filters.size(); ++i) |
523 EXPECT_EQ(filters.at(i), out_render_pass_draw_quad->filters.at(i)); | 522 EXPECT_EQ(filters.at(i), out_render_pass_draw_quad->filters.at(i)); |
524 EXPECT_EQ(filters_scale, out_render_pass_draw_quad->filters_scale); | 523 EXPECT_EQ(filters_scale, out_render_pass_draw_quad->filters_scale); |
525 EXPECT_EQ(background_filters.size(), | 524 EXPECT_EQ(background_filters.size(), |
526 out_render_pass_draw_quad->background_filters.size()); | 525 out_render_pass_draw_quad->background_filters.size()); |
527 for (size_t i = 0; i < background_filters.size(); ++i) | 526 for (size_t i = 0; i < background_filters.size(); ++i) |
528 EXPECT_EQ(background_filters.at(i), | 527 EXPECT_EQ(background_filters.at(i), |
529 out_render_pass_draw_quad->background_filters.at(i)); | 528 out_render_pass_draw_quad->background_filters.at(i)); |
530 | 529 |
531 const TextureDrawQuad* out_texture_draw_quad = | 530 const TextureDrawQuad* out_texture_draw_quad = |
532 TextureDrawQuad::MaterialCast(output.ElementAt(4)); | 531 TextureDrawQuad::MaterialCast(output->quad_list.ElementAt(4)); |
533 EXPECT_EQ(rect5, out_texture_draw_quad->rect); | 532 EXPECT_EQ(rect5, out_texture_draw_quad->rect); |
534 EXPECT_EQ(rect5, out_texture_draw_quad->opaque_rect); | 533 EXPECT_EQ(rect5, out_texture_draw_quad->opaque_rect); |
535 EXPECT_EQ(rect5, out_texture_draw_quad->visible_rect); | 534 EXPECT_EQ(rect5, out_texture_draw_quad->visible_rect); |
536 EXPECT_EQ(resource_id5, out_texture_draw_quad->resource_id()); | 535 EXPECT_EQ(resource_id5, out_texture_draw_quad->resource_id()); |
537 EXPECT_EQ(premultiplied_alpha, out_texture_draw_quad->premultiplied_alpha); | 536 EXPECT_EQ(premultiplied_alpha, out_texture_draw_quad->premultiplied_alpha); |
538 EXPECT_EQ(uv_top_left, out_texture_draw_quad->uv_top_left); | 537 EXPECT_EQ(uv_top_left, out_texture_draw_quad->uv_top_left); |
539 EXPECT_EQ(uv_bottom_right, out_texture_draw_quad->uv_bottom_right); | 538 EXPECT_EQ(uv_bottom_right, out_texture_draw_quad->uv_bottom_right); |
540 EXPECT_EQ(background_color, out_texture_draw_quad->background_color); | 539 EXPECT_EQ(background_color, out_texture_draw_quad->background_color); |
541 EXPECT_EQ(vertex_opacity[0], out_texture_draw_quad->vertex_opacity[0]); | 540 EXPECT_EQ(vertex_opacity[0], out_texture_draw_quad->vertex_opacity[0]); |
542 EXPECT_EQ(vertex_opacity[1], out_texture_draw_quad->vertex_opacity[1]); | 541 EXPECT_EQ(vertex_opacity[1], out_texture_draw_quad->vertex_opacity[1]); |
543 EXPECT_EQ(vertex_opacity[2], out_texture_draw_quad->vertex_opacity[2]); | 542 EXPECT_EQ(vertex_opacity[2], out_texture_draw_quad->vertex_opacity[2]); |
544 EXPECT_EQ(vertex_opacity[3], out_texture_draw_quad->vertex_opacity[3]); | 543 EXPECT_EQ(vertex_opacity[3], out_texture_draw_quad->vertex_opacity[3]); |
545 EXPECT_EQ(y_flipped, out_texture_draw_quad->y_flipped); | 544 EXPECT_EQ(y_flipped, out_texture_draw_quad->y_flipped); |
546 EXPECT_EQ(nearest_neighbor, out_texture_draw_quad->nearest_neighbor); | 545 EXPECT_EQ(nearest_neighbor, out_texture_draw_quad->nearest_neighbor); |
547 EXPECT_EQ(secure_output_only, out_texture_draw_quad->secure_output_only); | 546 EXPECT_EQ(secure_output_only, out_texture_draw_quad->secure_output_only); |
548 | 547 |
549 const StreamVideoDrawQuad* out_stream_video_draw_quad = | 548 const StreamVideoDrawQuad* out_stream_video_draw_quad = |
550 StreamVideoDrawQuad::MaterialCast(output.ElementAt(5)); | 549 StreamVideoDrawQuad::MaterialCast(output->quad_list.ElementAt(5)); |
551 EXPECT_EQ(rect6, out_stream_video_draw_quad->rect); | 550 EXPECT_EQ(rect6, out_stream_video_draw_quad->rect); |
552 EXPECT_EQ(rect6, out_stream_video_draw_quad->opaque_rect); | 551 EXPECT_EQ(rect6, out_stream_video_draw_quad->opaque_rect); |
553 EXPECT_EQ(rect6, out_stream_video_draw_quad->visible_rect); | 552 EXPECT_EQ(rect6, out_stream_video_draw_quad->visible_rect); |
554 EXPECT_EQ(resource_id6, out_stream_video_draw_quad->resource_id()); | 553 EXPECT_EQ(resource_id6, out_stream_video_draw_quad->resource_id()); |
555 EXPECT_EQ(resource_size_in_pixels, | 554 EXPECT_EQ(resource_size_in_pixels, |
556 out_stream_video_draw_quad->resource_size_in_pixels()); | 555 out_stream_video_draw_quad->resource_size_in_pixels()); |
557 EXPECT_EQ(matrix, out_stream_video_draw_quad->matrix); | 556 EXPECT_EQ(matrix, out_stream_video_draw_quad->matrix); |
558 } | 557 } |
559 | 558 |
560 TEST_F(StructTraitsTest, RenderPass) { | 559 TEST_F(StructTraitsTest, RenderPass) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 SK_ColorRED, true); | 598 SK_ColorRED, true); |
600 | 599 |
601 SurfaceDrawQuad* surface_quad = | 600 SurfaceDrawQuad* surface_quad = |
602 input->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); | 601 input->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
603 const gfx::Rect surface_quad_rect(1337, 2448, 1234, 5678); | 602 const gfx::Rect surface_quad_rect(1337, 2448, 1234, 5678); |
604 surface_quad->SetNew(shared_state_2, surface_quad_rect, surface_quad_rect, | 603 surface_quad->SetNew(shared_state_2, surface_quad_rect, surface_quad_rect, |
605 SurfaceId(1337, 1234, 2468)); | 604 SurfaceId(1337, 1234, 2468)); |
606 | 605 |
607 std::unique_ptr<RenderPass> output; | 606 std::unique_ptr<RenderPass> output; |
608 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 607 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
609 proxy->EchoRenderPass(input, &output); | 608 proxy->EchoRenderPass(input->DeepCopy(), &output); |
610 | 609 |
611 EXPECT_EQ(input->quad_list.size(), output->quad_list.size()); | 610 EXPECT_EQ(input->quad_list.size(), output->quad_list.size()); |
612 EXPECT_EQ(input->shared_quad_state_list.size(), | 611 EXPECT_EQ(input->shared_quad_state_list.size(), |
613 output->shared_quad_state_list.size()); | 612 output->shared_quad_state_list.size()); |
614 EXPECT_EQ(id, output->id); | 613 EXPECT_EQ(id, output->id); |
615 EXPECT_EQ(output_rect, output->output_rect); | 614 EXPECT_EQ(output_rect, output->output_rect); |
616 EXPECT_EQ(damage_rect, output->damage_rect); | 615 EXPECT_EQ(damage_rect, output->damage_rect); |
617 EXPECT_EQ(transform_to_root, output->transform_to_root_target); | 616 EXPECT_EQ(transform_to_root, output->transform_to_root_target); |
618 EXPECT_EQ(has_transparent_background, output->has_transparent_background); | 617 EXPECT_EQ(has_transparent_background, output->has_transparent_background); |
619 | 618 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 const gfx::Rect damage_rect(56, 123, 19, 43); | 673 const gfx::Rect damage_rect(56, 123, 19, 43); |
675 const bool has_transparent_background = true; | 674 const bool has_transparent_background = true; |
676 std::unique_ptr<RenderPass> input = RenderPass::Create(); | 675 std::unique_ptr<RenderPass> input = RenderPass::Create(); |
677 input->SetAll(id, output_rect, damage_rect, transform_to_root, | 676 input->SetAll(id, output_rect, damage_rect, transform_to_root, |
678 has_transparent_background); | 677 has_transparent_background); |
679 | 678 |
680 // Unlike the previous test, don't add any quads to the list; we need to | 679 // Unlike the previous test, don't add any quads to the list; we need to |
681 // verify that the serialization code can deal with that. | 680 // verify that the serialization code can deal with that. |
682 std::unique_ptr<RenderPass> output; | 681 std::unique_ptr<RenderPass> output; |
683 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 682 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
684 proxy->EchoRenderPass(input, &output); | 683 proxy->EchoRenderPass(input->DeepCopy(), &output); |
685 | 684 |
686 EXPECT_EQ(input->quad_list.size(), output->quad_list.size()); | 685 EXPECT_EQ(input->quad_list.size(), output->quad_list.size()); |
687 EXPECT_EQ(input->shared_quad_state_list.size(), | 686 EXPECT_EQ(input->shared_quad_state_list.size(), |
688 output->shared_quad_state_list.size()); | 687 output->shared_quad_state_list.size()); |
689 EXPECT_EQ(id, output->id); | 688 EXPECT_EQ(id, output->id); |
690 EXPECT_EQ(output_rect, output->output_rect); | 689 EXPECT_EQ(output_rect, output->output_rect); |
691 EXPECT_EQ(damage_rect, output->damage_rect); | 690 EXPECT_EQ(damage_rect, output->damage_rect); |
692 EXPECT_EQ(transform_to_root, output->transform_to_root_target); | 691 EXPECT_EQ(transform_to_root, output->transform_to_root_target); |
693 EXPECT_EQ(has_transparent_background, output->has_transparent_background); | 692 EXPECT_EQ(has_transparent_background, output->has_transparent_background); |
694 } | 693 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 EXPECT_EQ(mailbox_holder.mailbox, output.mailbox_holder.mailbox); | 850 EXPECT_EQ(mailbox_holder.mailbox, output.mailbox_holder.mailbox); |
852 EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token); | 851 EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token); |
853 EXPECT_EQ(mailbox_holder.texture_target, | 852 EXPECT_EQ(mailbox_holder.texture_target, |
854 output.mailbox_holder.texture_target); | 853 output.mailbox_holder.texture_target); |
855 EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled); | 854 EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled); |
856 EXPECT_EQ(is_software, output.is_software); | 855 EXPECT_EQ(is_software, output.is_software); |
857 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate); | 856 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate); |
858 } | 857 } |
859 | 858 |
860 TEST_F(StructTraitsTest, YUVDrawQuad) { | 859 TEST_F(StructTraitsTest, YUVDrawQuad) { |
| 860 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 861 render_pass->SetNew(RenderPassId(1, 1), gfx::Rect(), gfx::Rect(), |
| 862 gfx::Transform()); |
| 863 |
861 const DrawQuad::Material material = DrawQuad::YUV_VIDEO_CONTENT; | 864 const DrawQuad::Material material = DrawQuad::YUV_VIDEO_CONTENT; |
862 const gfx::Rect rect(1234, 4321, 1357, 7531); | 865 const gfx::Rect rect(1234, 4321, 1357, 7531); |
863 const gfx::Rect opaque_rect(1357, 8642, 432, 123); | 866 const gfx::Rect opaque_rect(1357, 8642, 432, 123); |
864 const gfx::Rect visible_rect(1337, 7331, 561, 293); | 867 const gfx::Rect visible_rect(1337, 7331, 561, 293); |
865 const bool needs_blending = true; | 868 const bool needs_blending = true; |
866 const gfx::RectF ya_tex_coord_rect(1234.1f, 5678.2f, 9101112.3f, 13141516.4f); | 869 const gfx::RectF ya_tex_coord_rect(1234.1f, 5678.2f, 9101112.3f, 13141516.4f); |
867 const gfx::RectF uv_tex_coord_rect(1234.1f, 4321.2f, 1357.3f, 7531.4f); | 870 const gfx::RectF uv_tex_coord_rect(1234.1f, 4321.2f, 1357.3f, 7531.4f); |
868 const gfx::Size ya_tex_size(1234, 5678); | 871 const gfx::Size ya_tex_size(1234, 5678); |
869 const gfx::Size uv_tex_size(4321, 8765); | 872 const gfx::Size uv_tex_size(4321, 8765); |
870 const uint32_t y_plane_resource_id = 1337; | 873 const uint32_t y_plane_resource_id = 1337; |
871 const uint32_t u_plane_resource_id = 1234; | 874 const uint32_t u_plane_resource_id = 1234; |
872 const uint32_t v_plane_resource_id = 2468; | 875 const uint32_t v_plane_resource_id = 2468; |
873 const uint32_t a_plane_resource_id = 7890; | 876 const uint32_t a_plane_resource_id = 7890; |
874 const YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::JPEG; | 877 const YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::JPEG; |
875 const float resource_offset = 1337.5f; | 878 const float resource_offset = 1337.5f; |
876 const float resource_multiplier = 1234.6f; | 879 const float resource_multiplier = 1234.6f; |
877 | 880 |
878 SharedQuadState sqs; | 881 SharedQuadState* sqs = render_pass->CreateAndAppendSharedQuadState(); |
879 QuadList input; | 882 YUVVideoDrawQuad* quad = |
880 YUVVideoDrawQuad* quad = input.AllocateAndConstruct<YUVVideoDrawQuad>(); | 883 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
881 quad->SetAll(&sqs, rect, opaque_rect, visible_rect, needs_blending, | 884 quad->SetAll(sqs, rect, opaque_rect, visible_rect, needs_blending, |
882 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, uv_tex_size, | 885 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, uv_tex_size, |
883 y_plane_resource_id, u_plane_resource_id, v_plane_resource_id, | 886 y_plane_resource_id, u_plane_resource_id, v_plane_resource_id, |
884 a_plane_resource_id, color_space, resource_offset, | 887 a_plane_resource_id, color_space, resource_offset, |
885 resource_multiplier); | 888 resource_multiplier); |
886 | 889 |
887 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 890 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
888 QuadList output; | 891 std::unique_ptr<RenderPass> output; |
889 proxy->EchoQuadList(input, &output); | 892 proxy->EchoRenderPass(render_pass->DeepCopy(), &output); |
890 | 893 |
891 ASSERT_EQ(input.size(), output.size()); | 894 ASSERT_EQ(render_pass->quad_list.size(), output->quad_list.size()); |
892 | 895 |
893 ASSERT_EQ(material, output.ElementAt(0)->material); | 896 ASSERT_EQ(material, output->quad_list.ElementAt(0)->material); |
894 const YUVVideoDrawQuad* out_quad = | 897 const YUVVideoDrawQuad* out_quad = |
895 YUVVideoDrawQuad::MaterialCast(output.ElementAt(0)); | 898 YUVVideoDrawQuad::MaterialCast(output->quad_list.ElementAt(0)); |
896 EXPECT_EQ(rect, out_quad->rect); | 899 EXPECT_EQ(rect, out_quad->rect); |
897 EXPECT_EQ(opaque_rect, out_quad->opaque_rect); | 900 EXPECT_EQ(opaque_rect, out_quad->opaque_rect); |
898 EXPECT_EQ(visible_rect, out_quad->visible_rect); | 901 EXPECT_EQ(visible_rect, out_quad->visible_rect); |
899 EXPECT_EQ(needs_blending, out_quad->needs_blending); | 902 EXPECT_EQ(needs_blending, out_quad->needs_blending); |
900 EXPECT_EQ(ya_tex_coord_rect, out_quad->ya_tex_coord_rect); | 903 EXPECT_EQ(ya_tex_coord_rect, out_quad->ya_tex_coord_rect); |
901 EXPECT_EQ(uv_tex_coord_rect, out_quad->uv_tex_coord_rect); | 904 EXPECT_EQ(uv_tex_coord_rect, out_quad->uv_tex_coord_rect); |
902 EXPECT_EQ(ya_tex_size, out_quad->ya_tex_size); | 905 EXPECT_EQ(ya_tex_size, out_quad->ya_tex_size); |
903 EXPECT_EQ(uv_tex_size, out_quad->uv_tex_size); | 906 EXPECT_EQ(uv_tex_size, out_quad->uv_tex_size); |
904 EXPECT_EQ(y_plane_resource_id, out_quad->y_plane_resource_id()); | 907 EXPECT_EQ(y_plane_resource_id, out_quad->y_plane_resource_id()); |
905 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); | 908 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); |
906 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); | 909 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); |
907 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); | 910 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); |
908 EXPECT_EQ(color_space, out_quad->color_space); | 911 EXPECT_EQ(color_space, out_quad->color_space); |
909 EXPECT_EQ(resource_offset, out_quad->resource_offset); | 912 EXPECT_EQ(resource_offset, out_quad->resource_offset); |
910 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); | 913 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); |
911 } | 914 } |
912 | 915 |
913 } // namespace cc | 916 } // namespace cc |
OLD | NEW |