| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 pass_list.push_back(pass.Pass()); | 391 pass_list.push_back(pass.Pass()); |
| 392 | 392 |
| 393 EXPECT_TRUE(this->RunPixelTest( | 393 EXPECT_TRUE(this->RunPixelTest( |
| 394 &pass_list, | 394 &pass_list, |
| 395 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), | 395 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), |
| 396 FuzzyPixelOffByOneComparator(true))); | 396 FuzzyPixelOffByOneComparator(true))); |
| 397 } | 397 } |
| 398 | 398 |
| 399 class VideoGLRendererPixelTest : public GLRendererPixelTest { | 399 class VideoGLRendererPixelTest : public GLRendererPixelTest { |
| 400 protected: | 400 protected: |
| 401 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad( | 401 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad_Striped( |
| 402 SharedQuadState* shared_state, | 402 SharedQuadState* shared_state, |
| 403 media::VideoFrame::Format format, | 403 media::VideoFrame::Format format, |
| 404 bool is_transparent, | 404 bool is_transparent, |
| 405 const gfx::RectF& tex_coord_rect) { | 405 const gfx::RectF& tex_coord_rect) { |
| 406 const bool with_alpha = (format == media::VideoFrame::YV12A); | |
| 407 const gfx::Rect rect(this->device_viewport_size_); | 406 const gfx::Rect rect(this->device_viewport_size_); |
| 408 const gfx::Rect opaque_rect(0, 0, 0, 0); | |
| 409 | 407 |
| 410 scoped_refptr<media::VideoFrame> video_frame = | 408 scoped_refptr<media::VideoFrame> video_frame = |
| 411 media::VideoFrame::CreateFrame( | 409 media::VideoFrame::CreateFrame( |
| 412 format, rect.size(), rect, rect.size(), base::TimeDelta()); | 410 format, rect.size(), rect, rect.size(), base::TimeDelta()); |
| 413 | 411 |
| 414 // YUV values representing a striped pattern, for validating texture | 412 // YUV values representing a striped pattern, for validating texture |
| 415 // coordinates for sampling. | 413 // coordinates for sampling. |
| 416 uint8_t y_value = 0; | 414 uint8_t y_value = 0; |
| 417 uint8_t u_value = 0; | 415 uint8_t u_value = 0; |
| 418 uint8_t v_value = 0; | 416 uint8_t v_value = 0; |
| 419 for (int i = 0; i < video_frame->rows(media::VideoFrame::kYPlane); ++i) { | 417 for (int i = 0; i < video_frame->rows(media::VideoFrame::kYPlane); ++i) { |
| 420 uint8_t* y_row = video_frame->data(media::VideoFrame::kYPlane) + | 418 uint8_t* y_row = video_frame->data(media::VideoFrame::kYPlane) + |
| 421 video_frame->stride(media::VideoFrame::kYPlane) * i; | 419 video_frame->stride(media::VideoFrame::kYPlane) * i; |
| 422 for (int j = 0; j < video_frame->row_bytes(media::VideoFrame::kYPlane); | 420 for (int j = 0; j < video_frame->row_bytes(media::VideoFrame::kYPlane); |
| 423 ++j) { | 421 ++j) { |
| 424 y_row[j] = (y_value += 1); | 422 y_row[j] = (y_value += 1); |
| 425 } | 423 } |
| 426 } | 424 } |
| 427 for (int i = 0; i < video_frame->rows(media::VideoFrame::kUPlane); ++i) { | 425 for (int i = 0; i < video_frame->rows(media::VideoFrame::kUPlane); ++i) { |
| 428 uint8_t* u_row = video_frame->data(media::VideoFrame::kUPlane) + | 426 uint8_t* u_row = video_frame->data(media::VideoFrame::kUPlane) + |
| 429 video_frame->stride(media::VideoFrame::kUPlane) * i; | 427 video_frame->stride(media::VideoFrame::kUPlane) * i; |
| 430 uint8_t* v_row = video_frame->data(media::VideoFrame::kVPlane) + | 428 uint8_t* v_row = video_frame->data(media::VideoFrame::kVPlane) + |
| 431 video_frame->stride(media::VideoFrame::kVPlane) * i; | 429 video_frame->stride(media::VideoFrame::kVPlane) * i; |
| 432 for (int j = 0; j < video_frame->row_bytes(media::VideoFrame::kUPlane); | 430 for (int j = 0; j < video_frame->row_bytes(media::VideoFrame::kUPlane); |
| 433 ++j) { | 431 ++j) { |
| 434 u_row[j] = (u_value += 3); | 432 u_row[j] = (u_value += 3); |
| 435 v_row[j] = (v_value += 5); | 433 v_row[j] = (v_value += 5); |
| 436 } | 434 } |
| 437 } | 435 } |
| 436 return CreateTestYUVVideoDrawQuad_FromVideoFrame( |
| 437 shared_state, video_frame, is_transparent, tex_coord_rect); |
| 438 } |
| 439 |
| 440 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad_Solid( |
| 441 SharedQuadState* shared_state, |
| 442 media::VideoFrame::Format format, |
| 443 bool is_transparent, |
| 444 const gfx::RectF& tex_coord_rect, |
| 445 uint8 y, |
| 446 uint8 u, |
| 447 uint8 v) { |
| 448 const gfx::Rect rect(this->device_viewport_size_); |
| 449 |
| 450 scoped_refptr<media::VideoFrame> video_frame = |
| 451 media::VideoFrame::CreateFrame( |
| 452 format, rect.size(), rect, rect.size(), base::TimeDelta()); |
| 453 |
| 454 // YUV values of a solid, constant, color. Useful for testing that color |
| 455 // space/color range are being handled properly. |
| 456 memset(video_frame->data(media::VideoFrame::kYPlane), |
| 457 y, |
| 458 video_frame->stride(media::VideoFrame::kYPlane) * |
| 459 video_frame->rows(media::VideoFrame::kYPlane)); |
| 460 memset(video_frame->data(media::VideoFrame::kUPlane), |
| 461 u, |
| 462 video_frame->stride(media::VideoFrame::kUPlane) * |
| 463 video_frame->rows(media::VideoFrame::kUPlane)); |
| 464 memset(video_frame->data(media::VideoFrame::kVPlane), |
| 465 v, |
| 466 video_frame->stride(media::VideoFrame::kVPlane) * |
| 467 video_frame->rows(media::VideoFrame::kVPlane)); |
| 468 |
| 469 return CreateTestYUVVideoDrawQuad_FromVideoFrame( |
| 470 shared_state, video_frame, is_transparent, tex_coord_rect); |
| 471 } |
| 472 |
| 473 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad_FromVideoFrame( |
| 474 SharedQuadState* shared_state, |
| 475 scoped_refptr<media::VideoFrame> video_frame, |
| 476 bool is_transparent, |
| 477 const gfx::RectF& tex_coord_rect) { |
| 478 const bool with_alpha = (video_frame->format() == media::VideoFrame::YV12A); |
| 479 const bool jpeg_range = (video_frame->format() == media::VideoFrame::YV12J); |
| 480 const gfx::Rect rect(this->device_viewport_size_); |
| 481 const gfx::Rect opaque_rect(0, 0, 0, 0); |
| 482 |
| 438 if (with_alpha) | 483 if (with_alpha) |
| 439 memset(video_frame->data(media::VideoFrame::kAPlane), | 484 memset(video_frame->data(media::VideoFrame::kAPlane), |
| 440 is_transparent ? 0 : 128, | 485 is_transparent ? 0 : 128, |
| 441 video_frame->stride(media::VideoFrame::kAPlane) * | 486 video_frame->stride(media::VideoFrame::kAPlane) * |
| 442 video_frame->rows(media::VideoFrame::kAPlane)); | 487 video_frame->rows(media::VideoFrame::kAPlane)); |
| 443 | 488 |
| 444 VideoFrameExternalResources resources = | 489 VideoFrameExternalResources resources = |
| 445 video_resource_updater_->CreateExternalResourcesFromVideoFrame( | 490 video_resource_updater_->CreateExternalResourcesFromVideoFrame( |
| 446 video_frame); | 491 video_frame); |
| 447 | 492 |
| 448 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); | 493 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); |
| 449 EXPECT_EQ(media::VideoFrame::NumPlanes(format), resources.mailboxes.size()); | 494 EXPECT_EQ(media::VideoFrame::NumPlanes(video_frame->format()), |
| 450 EXPECT_EQ(media::VideoFrame::NumPlanes(format), | 495 resources.mailboxes.size()); |
| 496 EXPECT_EQ(media::VideoFrame::NumPlanes(video_frame->format()), |
| 451 resources.release_callbacks.size()); | 497 resources.release_callbacks.size()); |
| 452 | 498 |
| 453 ResourceProvider::ResourceId y_resource = | 499 ResourceProvider::ResourceId y_resource = |
| 454 resource_provider_->CreateResourceFromTextureMailbox( | 500 resource_provider_->CreateResourceFromTextureMailbox( |
| 455 resources.mailboxes[media::VideoFrame::kYPlane], | 501 resources.mailboxes[media::VideoFrame::kYPlane], |
| 456 SingleReleaseCallback::Create( | 502 SingleReleaseCallback::Create( |
| 457 resources.release_callbacks[media::VideoFrame::kYPlane])); | 503 resources.release_callbacks[media::VideoFrame::kYPlane])); |
| 458 ResourceProvider::ResourceId u_resource = | 504 ResourceProvider::ResourceId u_resource = |
| 459 resource_provider_->CreateResourceFromTextureMailbox( | 505 resource_provider_->CreateResourceFromTextureMailbox( |
| 460 resources.mailboxes[media::VideoFrame::kUPlane], | 506 resources.mailboxes[media::VideoFrame::kUPlane], |
| (...skipping 14 matching lines...) Expand all Loading... |
| 475 | 521 |
| 476 scoped_ptr<YUVVideoDrawQuad> yuv_quad = YUVVideoDrawQuad::Create(); | 522 scoped_ptr<YUVVideoDrawQuad> yuv_quad = YUVVideoDrawQuad::Create(); |
| 477 yuv_quad->SetNew(shared_state, | 523 yuv_quad->SetNew(shared_state, |
| 478 rect, | 524 rect, |
| 479 opaque_rect, | 525 opaque_rect, |
| 480 rect, | 526 rect, |
| 481 tex_coord_rect, | 527 tex_coord_rect, |
| 482 y_resource, | 528 y_resource, |
| 483 u_resource, | 529 u_resource, |
| 484 v_resource, | 530 v_resource, |
| 485 a_resource); | 531 a_resource, |
| 532 jpeg_range); |
| 486 return yuv_quad.Pass(); | 533 return yuv_quad.Pass(); |
| 487 } | 534 } |
| 488 | 535 |
| 489 virtual void SetUp() OVERRIDE { | 536 virtual void SetUp() OVERRIDE { |
| 490 GLRendererPixelTest::SetUp(); | 537 GLRendererPixelTest::SetUp(); |
| 491 video_resource_updater_.reset(new VideoResourceUpdater( | 538 video_resource_updater_.reset(new VideoResourceUpdater( |
| 492 output_surface_->context_provider().get(), resource_provider_.get())); | 539 output_surface_->context_provider().get(), resource_provider_.get())); |
| 493 } | 540 } |
| 494 | 541 |
| 495 private: | 542 private: |
| 496 scoped_ptr<VideoResourceUpdater> video_resource_updater_; | 543 scoped_ptr<VideoResourceUpdater> video_resource_updater_; |
| 497 }; | 544 }; |
| 498 | 545 |
| 499 TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) { | 546 TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) { |
| 500 gfx::Rect rect(this->device_viewport_size_); | 547 gfx::Rect rect(this->device_viewport_size_); |
| 501 | 548 |
| 502 RenderPass::Id id(1, 1); | 549 RenderPass::Id id(1, 1); |
| 503 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); | 550 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 504 | 551 |
| 505 scoped_ptr<SharedQuadState> shared_state = | 552 scoped_ptr<SharedQuadState> shared_state = |
| 506 CreateTestSharedQuadState(gfx::Transform(), rect); | 553 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 507 | 554 |
| 508 scoped_ptr<YUVVideoDrawQuad> yuv_quad = | 555 scoped_ptr<YUVVideoDrawQuad> yuv_quad = |
| 509 CreateTestYUVVideoDrawQuad(shared_state.get(), | 556 CreateTestYUVVideoDrawQuad_Striped(shared_state.get(), |
| 510 media::VideoFrame::YV12, | 557 media::VideoFrame::YV12, |
| 511 false, | 558 false, |
| 512 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f)); | 559 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f)); |
| 513 | 560 |
| 514 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); | 561 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 515 | 562 |
| 516 RenderPassList pass_list; | 563 RenderPassList pass_list; |
| 517 pass_list.push_back(pass.Pass()); | 564 pass_list.push_back(pass.Pass()); |
| 518 | 565 |
| 519 EXPECT_TRUE( | 566 EXPECT_TRUE( |
| 520 this->RunPixelTest(&pass_list, | 567 this->RunPixelTest(&pass_list, |
| 521 base::FilePath(FILE_PATH_LITERAL("yuv_stripes.png")), | 568 base::FilePath(FILE_PATH_LITERAL("yuv_stripes.png")), |
| 522 FuzzyPixelOffByOneComparator(true))); | 569 FuzzyPixelOffByOneComparator(true))); |
| 523 } | 570 } |
| 524 | 571 |
| 525 TEST_F(VideoGLRendererPixelTest, OffsetYUVRect) { | 572 TEST_F(VideoGLRendererPixelTest, OffsetYUVRect) { |
| 526 gfx::Rect rect(this->device_viewport_size_); | 573 gfx::Rect rect(this->device_viewport_size_); |
| 527 | 574 |
| 528 RenderPass::Id id(1, 1); | 575 RenderPass::Id id(1, 1); |
| 529 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); | 576 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 530 | 577 |
| 531 scoped_ptr<SharedQuadState> shared_state = | 578 scoped_ptr<SharedQuadState> shared_state = |
| 532 CreateTestSharedQuadState(gfx::Transform(), rect); | 579 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 533 | 580 |
| 534 // Intentionally sets frame format to I420 for testing coverage. | 581 // Intentionally sets frame format to I420 for testing coverage. |
| 535 scoped_ptr<YUVVideoDrawQuad> yuv_quad = | 582 scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad_Striped( |
| 536 CreateTestYUVVideoDrawQuad(shared_state.get(), | 583 shared_state.get(), |
| 537 media::VideoFrame::I420, | 584 media::VideoFrame::I420, |
| 538 false, | 585 false, |
| 539 gfx::RectF(0.125f, 0.25f, 0.75f, 0.5f)); | 586 gfx::RectF(0.125f, 0.25f, 0.75f, 0.5f)); |
| 540 | 587 |
| 541 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); | 588 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 542 | 589 |
| 543 RenderPassList pass_list; | 590 RenderPassList pass_list; |
| 544 pass_list.push_back(pass.Pass()); | 591 pass_list.push_back(pass.Pass()); |
| 545 | 592 |
| 546 EXPECT_TRUE(this->RunPixelTest( | 593 EXPECT_TRUE(this->RunPixelTest( |
| 547 &pass_list, | 594 &pass_list, |
| 548 base::FilePath(FILE_PATH_LITERAL("yuv_stripes_offset.png")), | 595 base::FilePath(FILE_PATH_LITERAL("yuv_stripes_offset.png")), |
| 549 FuzzyPixelOffByOneComparator(true))); | 596 FuzzyPixelOffByOneComparator(true))); |
| 550 } | 597 } |
| 551 | 598 |
| 599 TEST_F(VideoGLRendererPixelTest, SimpleYUVRectBlack) { |
| 600 gfx::Rect rect(this->device_viewport_size_); |
| 601 |
| 602 RenderPass::Id id(1, 1); |
| 603 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 604 |
| 605 scoped_ptr<SharedQuadState> shared_state = |
| 606 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 607 |
| 608 // In MPEG color range YUV values of (15,128,128) should produce black. |
| 609 scoped_ptr<YUVVideoDrawQuad> yuv_quad = |
| 610 CreateTestYUVVideoDrawQuad_Solid(shared_state.get(), |
| 611 media::VideoFrame::YV12, |
| 612 false, |
| 613 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), |
| 614 15, |
| 615 128, |
| 616 128); |
| 617 |
| 618 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 619 |
| 620 RenderPassList pass_list; |
| 621 pass_list.push_back(pass.Pass()); |
| 622 |
| 623 // If we didn't get black out of the YUV values above, then we probably have a |
| 624 // color range issue. |
| 625 EXPECT_TRUE(this->RunPixelTest(&pass_list, |
| 626 base::FilePath(FILE_PATH_LITERAL("black.png")), |
| 627 FuzzyPixelOffByOneComparator(true))); |
| 628 } |
| 629 |
| 630 TEST_F(VideoGLRendererPixelTest, SimpleYUVJRect) { |
| 631 gfx::Rect rect(this->device_viewport_size_); |
| 632 |
| 633 RenderPass::Id id(1, 1); |
| 634 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 635 |
| 636 scoped_ptr<SharedQuadState> shared_state = |
| 637 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 638 |
| 639 // YUV of (149,43,21) should be green (0,255,0) in RGB. |
| 640 scoped_ptr<YUVVideoDrawQuad> yuv_quad = |
| 641 CreateTestYUVVideoDrawQuad_Solid(shared_state.get(), |
| 642 media::VideoFrame::YV12J, |
| 643 false, |
| 644 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), |
| 645 149, |
| 646 43, |
| 647 21); |
| 648 |
| 649 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 650 |
| 651 RenderPassList pass_list; |
| 652 pass_list.push_back(pass.Pass()); |
| 653 |
| 654 EXPECT_TRUE(this->RunPixelTest(&pass_list, |
| 655 base::FilePath(FILE_PATH_LITERAL("green.png")), |
| 656 FuzzyPixelOffByOneComparator(true))); |
| 657 } |
| 658 |
| 659 TEST_F(VideoGLRendererPixelTest, SimpleYUVJRectGrey) { |
| 660 gfx::Rect rect(this->device_viewport_size_); |
| 661 |
| 662 RenderPass::Id id(1, 1); |
| 663 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 664 |
| 665 scoped_ptr<SharedQuadState> shared_state = |
| 666 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 667 |
| 668 // Dark grey in JPEG color range (in MPEG, this is black). |
| 669 scoped_ptr<YUVVideoDrawQuad> yuv_quad = |
| 670 CreateTestYUVVideoDrawQuad_Solid(shared_state.get(), |
| 671 media::VideoFrame::YV12J, |
| 672 false, |
| 673 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), |
| 674 15, |
| 675 128, |
| 676 128); |
| 677 |
| 678 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 679 |
| 680 RenderPassList pass_list; |
| 681 pass_list.push_back(pass.Pass()); |
| 682 |
| 683 EXPECT_TRUE( |
| 684 this->RunPixelTest(&pass_list, |
| 685 base::FilePath(FILE_PATH_LITERAL("dark_grey.png")), |
| 686 FuzzyPixelOffByOneComparator(true))); |
| 687 } |
| 688 |
| 552 TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) { | 689 TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) { |
| 553 gfx::Rect rect(this->device_viewport_size_); | 690 gfx::Rect rect(this->device_viewport_size_); |
| 554 | 691 |
| 555 RenderPass::Id id(1, 1); | 692 RenderPass::Id id(1, 1); |
| 556 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); | 693 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 557 | 694 |
| 558 scoped_ptr<SharedQuadState> shared_state = | 695 scoped_ptr<SharedQuadState> shared_state = |
| 559 CreateTestSharedQuadState(gfx::Transform(), rect); | 696 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 560 | 697 |
| 561 scoped_ptr<YUVVideoDrawQuad> yuv_quad = | 698 scoped_ptr<YUVVideoDrawQuad> yuv_quad = |
| 562 CreateTestYUVVideoDrawQuad(shared_state.get(), | 699 CreateTestYUVVideoDrawQuad_Striped(shared_state.get(), |
| 563 media::VideoFrame::YV12A, | 700 media::VideoFrame::YV12A, |
| 564 false, | 701 false, |
| 565 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f)); | 702 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f)); |
| 566 | 703 |
| 567 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); | 704 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 568 | 705 |
| 569 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); | 706 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); |
| 570 color_quad->SetNew(shared_state.get(), rect, rect, SK_ColorWHITE, false); | 707 color_quad->SetNew(shared_state.get(), rect, rect, SK_ColorWHITE, false); |
| 571 | 708 |
| 572 pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); | 709 pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); |
| 573 | 710 |
| 574 RenderPassList pass_list; | 711 RenderPassList pass_list; |
| 575 pass_list.push_back(pass.Pass()); | 712 pass_list.push_back(pass.Pass()); |
| 576 | 713 |
| 577 EXPECT_TRUE(this->RunPixelTest( | 714 EXPECT_TRUE(this->RunPixelTest( |
| 578 &pass_list, | 715 &pass_list, |
| 579 base::FilePath(FILE_PATH_LITERAL("yuv_stripes_alpha.png")), | 716 base::FilePath(FILE_PATH_LITERAL("yuv_stripes_alpha.png")), |
| 580 FuzzyPixelOffByOneComparator(true))); | 717 FuzzyPixelOffByOneComparator(true))); |
| 581 } | 718 } |
| 582 | 719 |
| 583 TEST_F(VideoGLRendererPixelTest, FullyTransparentYUVARect) { | 720 TEST_F(VideoGLRendererPixelTest, FullyTransparentYUVARect) { |
| 584 gfx::Rect rect(this->device_viewport_size_); | 721 gfx::Rect rect(this->device_viewport_size_); |
| 585 | 722 |
| 586 RenderPass::Id id(1, 1); | 723 RenderPass::Id id(1, 1); |
| 587 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); | 724 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 588 | 725 |
| 589 scoped_ptr<SharedQuadState> shared_state = | 726 scoped_ptr<SharedQuadState> shared_state = |
| 590 CreateTestSharedQuadState(gfx::Transform(), rect); | 727 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 591 | 728 |
| 592 scoped_ptr<YUVVideoDrawQuad> yuv_quad = | 729 scoped_ptr<YUVVideoDrawQuad> yuv_quad = |
| 593 CreateTestYUVVideoDrawQuad(shared_state.get(), | 730 CreateTestYUVVideoDrawQuad_Striped(shared_state.get(), |
| 594 media::VideoFrame::YV12A, | 731 media::VideoFrame::YV12A, |
| 595 true, | 732 true, |
| 596 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f)); | 733 gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f)); |
| 597 | 734 |
| 598 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); | 735 pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); |
| 599 | 736 |
| 600 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); | 737 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); |
| 601 color_quad->SetNew(shared_state.get(), rect, rect, SK_ColorBLACK, false); | 738 color_quad->SetNew(shared_state.get(), rect, rect, SK_ColorBLACK, false); |
| 602 | 739 |
| 603 pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); | 740 pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); |
| 604 | 741 |
| 605 RenderPassList pass_list; | 742 RenderPassList pass_list; |
| 606 pass_list.push_back(pass.Pass()); | 743 pass_list.push_back(pass.Pass()); |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 EXPECT_TRUE(this->RunPixelTest( | 2236 EXPECT_TRUE(this->RunPixelTest( |
| 2100 &pass_list, | 2237 &pass_list, |
| 2101 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), | 2238 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), |
| 2102 FuzzyPixelOffByOneComparator(true))); | 2239 FuzzyPixelOffByOneComparator(true))); |
| 2103 } | 2240 } |
| 2104 | 2241 |
| 2105 #endif // !defined(OS_ANDROID) | 2242 #endif // !defined(OS_ANDROID) |
| 2106 | 2243 |
| 2107 } // namespace | 2244 } // namespace |
| 2108 } // namespace cc | 2245 } // namespace cc |
| OLD | NEW |