| 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 "cc/quads/draw_quad.h" | 5 #include "cc/quads/draw_quad.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 CREATE_QUAD_2_ALL(DebugBorderDrawQuad, color, width); | 330 CREATE_QUAD_2_ALL(DebugBorderDrawQuad, color, width); |
| 331 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material); | 331 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material); |
| 332 EXPECT_EQ(color, copy_quad->color); | 332 EXPECT_EQ(color, copy_quad->color); |
| 333 EXPECT_EQ(width, copy_quad->width); | 333 EXPECT_EQ(width, copy_quad->width); |
| 334 } | 334 } |
| 335 | 335 |
| 336 TEST(DrawQuadTest, CopyIOSurfaceDrawQuad) { | 336 TEST(DrawQuadTest, CopyIOSurfaceDrawQuad) { |
| 337 gfx::Rect opaque_rect(3, 7, 10, 12); | 337 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 338 gfx::Size size(58, 95); | 338 gfx::Size size(58, 95); |
| 339 unsigned texture_id = 72; | 339 ResourceProvider::ResourceId resource_id = 72; |
| 340 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED; | 340 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED; |
| 341 CREATE_SHARED_STATE(); | 341 CREATE_SHARED_STATE(); |
| 342 | 342 |
| 343 CREATE_QUAD_4_NEW( | 343 CREATE_QUAD_4_NEW( |
| 344 IOSurfaceDrawQuad, opaque_rect, size, texture_id, orientation); | 344 IOSurfaceDrawQuad, opaque_rect, size, resource_id, orientation); |
| 345 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material); | 345 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material); |
| 346 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 346 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 347 EXPECT_EQ(size, copy_quad->io_surface_size); | 347 EXPECT_EQ(size, copy_quad->io_surface_size); |
| 348 EXPECT_EQ(texture_id, copy_quad->io_surface_texture_id); | 348 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id); |
| 349 EXPECT_EQ(orientation, copy_quad->orientation); | 349 EXPECT_EQ(orientation, copy_quad->orientation); |
| 350 | 350 |
| 351 CREATE_QUAD_3_ALL(IOSurfaceDrawQuad, size, texture_id, orientation); | 351 CREATE_QUAD_3_ALL(IOSurfaceDrawQuad, size, resource_id, orientation); |
| 352 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material); | 352 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material); |
| 353 EXPECT_EQ(size, copy_quad->io_surface_size); | 353 EXPECT_EQ(size, copy_quad->io_surface_size); |
| 354 EXPECT_EQ(texture_id, copy_quad->io_surface_texture_id); | 354 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id); |
| 355 EXPECT_EQ(orientation, copy_quad->orientation); | 355 EXPECT_EQ(orientation, copy_quad->orientation); |
| 356 } | 356 } |
| 357 | 357 |
| 358 TEST(DrawQuadTest, CopyRenderPassDrawQuad) { | 358 TEST(DrawQuadTest, CopyRenderPassDrawQuad) { |
| 359 RenderPass::Id render_pass_id(22, 64); | 359 RenderPass::Id render_pass_id(22, 64); |
| 360 bool is_replica = true; | 360 bool is_replica = true; |
| 361 ResourceProvider::ResourceId mask_resource_id = 78; | 361 ResourceProvider::ResourceId mask_resource_id = 78; |
| 362 gfx::Rect contents_changed_since_last_frame(42, 11, 74, 24); | 362 gfx::Rect contents_changed_since_last_frame(42, 11, 74, 24); |
| 363 gfx::RectF mask_u_v_rect(-45.f, -21.f, 33.f, 19.f); | 363 gfx::RectF mask_u_v_rect(-45.f, -21.f, 33.f, 19.f); |
| 364 WebKit::WebFilterOperations filters; | 364 WebKit::WebFilterOperations filters; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); | 423 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); |
| 424 EXPECT_EQ(color, copy_quad->color); | 424 EXPECT_EQ(color, copy_quad->color); |
| 425 | 425 |
| 426 CREATE_QUAD_1_ALL(SolidColorDrawQuad, color); | 426 CREATE_QUAD_1_ALL(SolidColorDrawQuad, color); |
| 427 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); | 427 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); |
| 428 EXPECT_EQ(color, copy_quad->color); | 428 EXPECT_EQ(color, copy_quad->color); |
| 429 } | 429 } |
| 430 | 430 |
| 431 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) { | 431 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) { |
| 432 gfx::Rect opaque_rect(3, 7, 10, 12); | 432 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 433 unsigned texture_id = 64; | 433 ResourceProvider::ResourceId resource_id = 64; |
| 434 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); | 434 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
| 435 CREATE_SHARED_STATE(); | 435 CREATE_SHARED_STATE(); |
| 436 | 436 |
| 437 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaque_rect, texture_id, matrix); | 437 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaque_rect, resource_id, matrix); |
| 438 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 438 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
| 439 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 439 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 440 EXPECT_EQ(texture_id, copy_quad->texture_id); | 440 EXPECT_EQ(resource_id, copy_quad->resource_id); |
| 441 EXPECT_EQ(matrix, copy_quad->matrix); | 441 EXPECT_EQ(matrix, copy_quad->matrix); |
| 442 | 442 |
| 443 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, texture_id, matrix); | 443 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, resource_id, matrix); |
| 444 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 444 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
| 445 EXPECT_EQ(texture_id, copy_quad->texture_id); | 445 EXPECT_EQ(resource_id, copy_quad->resource_id); |
| 446 EXPECT_EQ(matrix, copy_quad->matrix); | 446 EXPECT_EQ(matrix, copy_quad->matrix); |
| 447 } | 447 } |
| 448 | 448 |
| 449 TEST(DrawQuadTest, CopyTextureDrawQuad) { | 449 TEST(DrawQuadTest, CopyTextureDrawQuad) { |
| 450 gfx::Rect opaque_rect(3, 7, 10, 12); | 450 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 451 unsigned resource_id = 82; | 451 unsigned resource_id = 82; |
| 452 bool premultiplied_alpha = true; | 452 bool premultiplied_alpha = true; |
| 453 gfx::PointF uv_top_left(0.5f, 224.f); | 453 gfx::PointF uv_top_left(0.5f, 224.f); |
| 454 gfx::PointF uv_bottom_right(51.5f, 260.f); | 454 gfx::PointF uv_bottom_right(51.5f, 260.f); |
| 455 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | 455 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); | 610 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); |
| 611 EXPECT_EQ(resource_id, copy_quad->resource_id); | 611 EXPECT_EQ(resource_id, copy_quad->resource_id); |
| 612 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 612 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 613 EXPECT_EQ(texture_size, copy_quad->texture_size); | 613 EXPECT_EQ(texture_size, copy_quad->texture_size); |
| 614 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 614 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
| 615 } | 615 } |
| 616 | 616 |
| 617 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { | 617 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { |
| 618 gfx::Rect opaque_rect(3, 7, 10, 12); | 618 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 619 gfx::SizeF tex_scale(0.75f, 0.5f); | 619 gfx::SizeF tex_scale(0.75f, 0.5f); |
| 620 VideoLayerImpl::FramePlane y_plane; | 620 ResourceProvider::ResourceId y_plane_resource_id = 45; |
| 621 y_plane.resource_id = 45; | 621 ResourceProvider::ResourceId u_plane_resource_id = 532; |
| 622 y_plane.size = gfx::Size(34, 23); | 622 ResourceProvider::ResourceId v_plane_resource_id = 4; |
| 623 y_plane.format = 8; | |
| 624 VideoLayerImpl::FramePlane u_plane; | |
| 625 u_plane.resource_id = 532; | |
| 626 u_plane.size = gfx::Size(134, 16); | |
| 627 u_plane.format = 2; | |
| 628 VideoLayerImpl::FramePlane v_plane; | |
| 629 v_plane.resource_id = 4; | |
| 630 v_plane.size = gfx::Size(456, 486); | |
| 631 v_plane.format = 46; | |
| 632 CREATE_SHARED_STATE(); | 623 CREATE_SHARED_STATE(); |
| 633 | 624 |
| 634 CREATE_QUAD_5_NEW( | 625 CREATE_QUAD_5_NEW(YUVVideoDrawQuad, |
| 635 YUVVideoDrawQuad, opaque_rect, tex_scale, y_plane, u_plane, v_plane); | 626 opaque_rect, |
| 627 tex_scale, |
| 628 y_plane_resource_id, |
| 629 u_plane_resource_id, |
| 630 v_plane_resource_id); |
| 636 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 631 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 637 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 632 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 638 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 633 EXPECT_EQ(tex_scale, copy_quad->tex_scale); |
| 639 EXPECT_EQ(y_plane.resource_id, copy_quad->y_plane.resource_id); | 634 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
| 640 EXPECT_EQ(y_plane.size, copy_quad->y_plane.size); | 635 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
| 641 EXPECT_EQ(y_plane.format, copy_quad->y_plane.format); | 636 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
| 642 EXPECT_EQ(u_plane.resource_id, copy_quad->u_plane.resource_id); | |
| 643 EXPECT_EQ(u_plane.size, copy_quad->u_plane.size); | |
| 644 EXPECT_EQ(u_plane.format, copy_quad->u_plane.format); | |
| 645 EXPECT_EQ(v_plane.resource_id, copy_quad->v_plane.resource_id); | |
| 646 EXPECT_EQ(v_plane.size, copy_quad->v_plane.size); | |
| 647 EXPECT_EQ(v_plane.format, copy_quad->v_plane.format); | |
| 648 | 637 |
| 649 CREATE_QUAD_4_ALL(YUVVideoDrawQuad, tex_scale, y_plane, u_plane, v_plane); | 638 CREATE_QUAD_4_ALL(YUVVideoDrawQuad, |
| 639 tex_scale, |
| 640 y_plane_resource_id, |
| 641 u_plane_resource_id, |
| 642 v_plane_resource_id); |
| 650 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 643 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 651 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 644 EXPECT_EQ(tex_scale, copy_quad->tex_scale); |
| 652 EXPECT_EQ(y_plane.resource_id, copy_quad->y_plane.resource_id); | 645 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
| 653 EXPECT_EQ(y_plane.size, copy_quad->y_plane.size); | 646 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
| 654 EXPECT_EQ(y_plane.format, copy_quad->y_plane.format); | 647 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
| 655 EXPECT_EQ(u_plane.resource_id, copy_quad->u_plane.resource_id); | |
| 656 EXPECT_EQ(u_plane.size, copy_quad->u_plane.size); | |
| 657 EXPECT_EQ(u_plane.format, copy_quad->u_plane.format); | |
| 658 EXPECT_EQ(v_plane.resource_id, copy_quad->v_plane.resource_id); | |
| 659 EXPECT_EQ(v_plane.size, copy_quad->v_plane.size); | |
| 660 EXPECT_EQ(v_plane.format, copy_quad->v_plane.format); | |
| 661 } | 648 } |
| 662 | 649 |
| 663 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 650 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
| 664 gfx::Rect opaque_rect(33, 44, 22, 33); | 651 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 665 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 652 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 666 gfx::Size texture_size(85, 32); | 653 gfx::Size texture_size(85, 32); |
| 667 bool swizzle_contents = true; | 654 bool swizzle_contents = true; |
| 668 gfx::Rect content_rect(30, 40, 20, 30); | 655 gfx::Rect content_rect(30, 40, 20, 30); |
| 669 float contents_scale = 3.141592f; | 656 float contents_scale = 3.141592f; |
| 670 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); | 657 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 int width = 99; | 722 int width = 99; |
| 736 | 723 |
| 737 CREATE_SHARED_STATE(); | 724 CREATE_SHARED_STATE(); |
| 738 CREATE_QUAD_2_NEW(DebugBorderDrawQuad, color, width); | 725 CREATE_QUAD_2_NEW(DebugBorderDrawQuad, color, width); |
| 739 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 726 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
| 740 } | 727 } |
| 741 | 728 |
| 742 TEST_F(DrawQuadIteratorTest, IOSurfaceDrawQuad) { | 729 TEST_F(DrawQuadIteratorTest, IOSurfaceDrawQuad) { |
| 743 gfx::Rect opaque_rect(3, 7, 10, 12); | 730 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 744 gfx::Size size(58, 95); | 731 gfx::Size size(58, 95); |
| 745 unsigned texture_id = 72; | 732 ResourceProvider::ResourceId resource_id = 72; |
| 746 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED; | 733 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED; |
| 747 | 734 |
| 748 CREATE_SHARED_STATE(); | 735 CREATE_SHARED_STATE(); |
| 749 CREATE_QUAD_4_NEW( | 736 CREATE_QUAD_4_NEW( |
| 750 IOSurfaceDrawQuad, opaque_rect, size, texture_id, orientation); | 737 IOSurfaceDrawQuad, opaque_rect, size, resource_id, orientation); |
| 751 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 738 EXPECT_EQ(resource_id, quad_new->io_surface_resource_id); |
| 739 EXPECT_EQ(1, IterateAndCount(quad_new.get())); |
| 740 EXPECT_EQ(resource_id + 1, quad_new->io_surface_resource_id); |
| 752 } | 741 } |
| 753 | 742 |
| 754 TEST_F(DrawQuadIteratorTest, RenderPassDrawQuad) { | 743 TEST_F(DrawQuadIteratorTest, RenderPassDrawQuad) { |
| 755 RenderPass::Id render_pass_id(22, 64); | 744 RenderPass::Id render_pass_id(22, 64); |
| 756 bool is_replica = true; | 745 bool is_replica = true; |
| 757 ResourceProvider::ResourceId mask_resource_id = 78; | 746 ResourceProvider::ResourceId mask_resource_id = 78; |
| 758 gfx::Rect contents_changed_since_last_frame(42, 11, 74, 24); | 747 gfx::Rect contents_changed_since_last_frame(42, 11, 74, 24); |
| 759 gfx::RectF mask_u_v_rect(-45.f, -21.f, 33.f, 19.f); | 748 gfx::RectF mask_u_v_rect(-45.f, -21.f, 33.f, 19.f); |
| 760 WebKit::WebFilterOperations filters; | 749 WebKit::WebFilterOperations filters; |
| 761 filters.append(WebKit::WebFilterOperation::createBlurFilter(1.f)); | 750 filters.append(WebKit::WebFilterOperation::createBlurFilter(1.f)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 786 TEST_F(DrawQuadIteratorTest, SolidColorDrawQuad) { | 775 TEST_F(DrawQuadIteratorTest, SolidColorDrawQuad) { |
| 787 SkColor color = 0x49494949; | 776 SkColor color = 0x49494949; |
| 788 | 777 |
| 789 CREATE_SHARED_STATE(); | 778 CREATE_SHARED_STATE(); |
| 790 CREATE_QUAD_1_NEW(SolidColorDrawQuad, color); | 779 CREATE_QUAD_1_NEW(SolidColorDrawQuad, color); |
| 791 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 780 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
| 792 } | 781 } |
| 793 | 782 |
| 794 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) { | 783 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) { |
| 795 gfx::Rect opaque_rect(3, 7, 10, 12); | 784 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 796 unsigned texture_id = 64; | 785 ResourceProvider::ResourceId resource_id = 64; |
| 797 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); | 786 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
| 798 | 787 |
| 799 CREATE_SHARED_STATE(); | 788 CREATE_SHARED_STATE(); |
| 800 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaque_rect, texture_id, matrix); | 789 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaque_rect, resource_id, matrix); |
| 801 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 790 EXPECT_EQ(resource_id, quad_new->resource_id); |
| 791 EXPECT_EQ(1, IterateAndCount(quad_new.get())); |
| 792 EXPECT_EQ(resource_id + 1, quad_new->resource_id); |
| 802 } | 793 } |
| 803 | 794 |
| 804 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { | 795 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { |
| 805 gfx::Rect opaque_rect(3, 7, 10, 12); | 796 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 806 unsigned resource_id = 82; | 797 unsigned resource_id = 82; |
| 807 bool premultiplied_alpha = true; | 798 bool premultiplied_alpha = true; |
| 808 gfx::PointF uv_top_left(0.5f, 224.f); | 799 gfx::PointF uv_top_left(0.5f, 224.f); |
| 809 gfx::PointF uv_bottom_right(51.5f, 260.f); | 800 gfx::PointF uv_bottom_right(51.5f, 260.f); |
| 810 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | 801 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
| 811 bool flipped = true; | 802 bool flipped = true; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 839 texture_size, | 830 texture_size, |
| 840 swizzle_contents); | 831 swizzle_contents); |
| 841 EXPECT_EQ(resource_id, quad_new->resource_id); | 832 EXPECT_EQ(resource_id, quad_new->resource_id); |
| 842 EXPECT_EQ(1, IterateAndCount(quad_new.get())); | 833 EXPECT_EQ(1, IterateAndCount(quad_new.get())); |
| 843 EXPECT_EQ(resource_id + 1, quad_new->resource_id); | 834 EXPECT_EQ(resource_id + 1, quad_new->resource_id); |
| 844 } | 835 } |
| 845 | 836 |
| 846 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { | 837 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { |
| 847 gfx::Rect opaque_rect(3, 7, 10, 12); | 838 gfx::Rect opaque_rect(3, 7, 10, 12); |
| 848 gfx::SizeF tex_scale(0.75f, 0.5f); | 839 gfx::SizeF tex_scale(0.75f, 0.5f); |
| 849 VideoLayerImpl::FramePlane y_plane; | 840 ResourceProvider::ResourceId y_plane_resource_id = 45; |
| 850 y_plane.resource_id = 45; | 841 ResourceProvider::ResourceId u_plane_resource_id = 532; |
| 851 y_plane.size = gfx::Size(34, 23); | 842 ResourceProvider::ResourceId v_plane_resource_id = 4; |
| 852 y_plane.format = 8; | |
| 853 VideoLayerImpl::FramePlane u_plane; | |
| 854 u_plane.resource_id = 532; | |
| 855 u_plane.size = gfx::Size(134, 16); | |
| 856 u_plane.format = 2; | |
| 857 VideoLayerImpl::FramePlane v_plane; | |
| 858 v_plane.resource_id = 4; | |
| 859 v_plane.size = gfx::Size(456, 486); | |
| 860 v_plane.format = 46; | |
| 861 | 843 |
| 862 CREATE_SHARED_STATE(); | 844 CREATE_SHARED_STATE(); |
| 863 CREATE_QUAD_5_NEW( | 845 CREATE_QUAD_5_NEW(YUVVideoDrawQuad, |
| 864 YUVVideoDrawQuad, opaque_rect, tex_scale, y_plane, u_plane, v_plane); | 846 opaque_rect, |
| 847 tex_scale, |
| 848 y_plane_resource_id, |
| 849 u_plane_resource_id, |
| 850 v_plane_resource_id); |
| 865 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 851 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 866 EXPECT_EQ(y_plane.resource_id, quad_new->y_plane.resource_id); | 852 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); |
| 867 EXPECT_EQ(u_plane.resource_id, quad_new->u_plane.resource_id); | 853 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); |
| 868 EXPECT_EQ(v_plane.resource_id, quad_new->v_plane.resource_id); | 854 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); |
| 869 EXPECT_EQ(3, IterateAndCount(quad_new.get())); | 855 EXPECT_EQ(3, IterateAndCount(quad_new.get())); |
| 870 EXPECT_EQ(y_plane.resource_id + 1, quad_new->y_plane.resource_id); | 856 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); |
| 871 EXPECT_EQ(u_plane.resource_id + 1, quad_new->u_plane.resource_id); | 857 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); |
| 872 EXPECT_EQ(v_plane.resource_id + 1, quad_new->v_plane.resource_id); | 858 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); |
| 873 } | 859 } |
| 874 | 860 |
| 875 TEST_F(DrawQuadIteratorTest, PictureDrawQuad) { | 861 TEST_F(DrawQuadIteratorTest, PictureDrawQuad) { |
| 876 gfx::Rect opaque_rect(33, 44, 22, 33); | 862 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 877 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 863 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 878 gfx::Size texture_size(85, 32); | 864 gfx::Size texture_size(85, 32); |
| 879 bool swizzle_contents = true; | 865 bool swizzle_contents = true; |
| 880 gfx::Rect content_rect(30, 40, 20, 30); | 866 gfx::Rect content_rect(30, 40, 20, 30); |
| 881 float contents_scale = 3.141592f; | 867 float contents_scale = 3.141592f; |
| 882 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); | 868 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); |
| 883 | 869 |
| 884 CREATE_SHARED_STATE(); | 870 CREATE_SHARED_STATE(); |
| 885 CREATE_QUAD_7_NEW(PictureDrawQuad, | 871 CREATE_QUAD_7_NEW(PictureDrawQuad, |
| 886 opaque_rect, | 872 opaque_rect, |
| 887 tex_coord_rect, | 873 tex_coord_rect, |
| 888 texture_size, | 874 texture_size, |
| 889 swizzle_contents, | 875 swizzle_contents, |
| 890 content_rect, | 876 content_rect, |
| 891 contents_scale, | 877 contents_scale, |
| 892 picture_pile); | 878 picture_pile); |
| 893 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 879 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
| 894 } | 880 } |
| 895 | 881 |
| 896 } // namespace | 882 } // namespace |
| 897 } // namespace cc | 883 } // namespace cc |
| OLD | NEW |