| 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); | 582 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); |
| 583 EXPECT_EQ(resource_id, copy_quad->resource_id); | 583 EXPECT_EQ(resource_id, copy_quad->resource_id); |
| 584 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 584 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 585 EXPECT_EQ(texture_size, copy_quad->texture_size); | 585 EXPECT_EQ(texture_size, copy_quad->texture_size); |
| 586 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 586 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
| 587 } | 587 } |
| 588 | 588 |
| 589 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { | 589 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { |
| 590 gfx::Rect opaque_rect(33, 47, 10, 12); | 590 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 591 gfx::Rect visible_rect(40, 50, 30, 20); | 591 gfx::Rect visible_rect(40, 50, 30, 20); |
| 592 gfx::SizeF tex_scale(0.75f, 0.5f); | 592 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); |
| 593 ResourceProvider::ResourceId y_plane_resource_id = 45; | 593 ResourceProvider::ResourceId y_plane_resource_id = 45; |
| 594 ResourceProvider::ResourceId u_plane_resource_id = 532; | 594 ResourceProvider::ResourceId u_plane_resource_id = 532; |
| 595 ResourceProvider::ResourceId v_plane_resource_id = 4; | 595 ResourceProvider::ResourceId v_plane_resource_id = 4; |
| 596 ResourceProvider::ResourceId a_plane_resource_id = 63; | 596 ResourceProvider::ResourceId a_plane_resource_id = 63; |
| 597 CREATE_SHARED_STATE(); | 597 CREATE_SHARED_STATE(); |
| 598 | 598 |
| 599 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, | 599 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, |
| 600 opaque_rect, | 600 opaque_rect, |
| 601 visible_rect, | 601 visible_rect, |
| 602 tex_scale, | 602 tex_coord_rect, |
| 603 y_plane_resource_id, | 603 y_plane_resource_id, |
| 604 u_plane_resource_id, | 604 u_plane_resource_id, |
| 605 v_plane_resource_id, | 605 v_plane_resource_id, |
| 606 a_plane_resource_id); | 606 a_plane_resource_id); |
| 607 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 607 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 608 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 608 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 609 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); | 609 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); |
| 610 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 610 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 611 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 611 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
| 612 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 612 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
| 613 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 613 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
| 614 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 614 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
| 615 | 615 |
| 616 CREATE_QUAD_5_ALL(YUVVideoDrawQuad, | 616 CREATE_QUAD_5_ALL(YUVVideoDrawQuad, |
| 617 tex_scale, | 617 tex_coord_rect, |
| 618 y_plane_resource_id, | 618 y_plane_resource_id, |
| 619 u_plane_resource_id, | 619 u_plane_resource_id, |
| 620 v_plane_resource_id, | 620 v_plane_resource_id, |
| 621 a_plane_resource_id); | 621 a_plane_resource_id); |
| 622 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 622 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 623 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 623 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 624 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 624 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
| 625 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 625 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
| 626 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 626 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
| 627 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 627 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
| 628 } | 628 } |
| 629 | 629 |
| 630 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 630 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
| 631 gfx::Rect opaque_rect(33, 44, 22, 33); | 631 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 632 gfx::Rect visible_rect(40, 50, 30, 20); | 632 gfx::Rect visible_rect(40, 50, 30, 20); |
| 633 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 633 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 texture_size, | 841 texture_size, |
| 842 swizzle_contents); | 842 swizzle_contents); |
| 843 EXPECT_EQ(resource_id, quad_new->resource_id); | 843 EXPECT_EQ(resource_id, quad_new->resource_id); |
| 844 EXPECT_EQ(1, IterateAndCount(quad_new.get())); | 844 EXPECT_EQ(1, IterateAndCount(quad_new.get())); |
| 845 EXPECT_EQ(resource_id + 1, quad_new->resource_id); | 845 EXPECT_EQ(resource_id + 1, quad_new->resource_id); |
| 846 } | 846 } |
| 847 | 847 |
| 848 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { | 848 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { |
| 849 gfx::Rect opaque_rect(33, 47, 10, 12); | 849 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 850 gfx::Rect visible_rect(40, 50, 30, 20); | 850 gfx::Rect visible_rect(40, 50, 30, 20); |
| 851 gfx::SizeF tex_scale(0.75f, 0.5f); | 851 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); |
| 852 ResourceProvider::ResourceId y_plane_resource_id = 45; | 852 ResourceProvider::ResourceId y_plane_resource_id = 45; |
| 853 ResourceProvider::ResourceId u_plane_resource_id = 532; | 853 ResourceProvider::ResourceId u_plane_resource_id = 532; |
| 854 ResourceProvider::ResourceId v_plane_resource_id = 4; | 854 ResourceProvider::ResourceId v_plane_resource_id = 4; |
| 855 ResourceProvider::ResourceId a_plane_resource_id = 63; | 855 ResourceProvider::ResourceId a_plane_resource_id = 63; |
| 856 | 856 |
| 857 CREATE_SHARED_STATE(); | 857 CREATE_SHARED_STATE(); |
| 858 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, | 858 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, |
| 859 opaque_rect, | 859 opaque_rect, |
| 860 visible_rect, | 860 visible_rect, |
| 861 tex_scale, | 861 tex_coord_rect, |
| 862 y_plane_resource_id, | 862 y_plane_resource_id, |
| 863 u_plane_resource_id, | 863 u_plane_resource_id, |
| 864 v_plane_resource_id, | 864 v_plane_resource_id, |
| 865 a_plane_resource_id); | 865 a_plane_resource_id); |
| 866 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 866 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 867 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); | 867 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); |
| 868 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); | 868 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); |
| 869 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); | 869 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); |
| 870 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); | 870 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); |
| 871 EXPECT_EQ(4, IterateAndCount(quad_new.get())); | 871 EXPECT_EQ(4, IterateAndCount(quad_new.get())); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 894 texture_size, | 894 texture_size, |
| 895 texture_format, | 895 texture_format, |
| 896 content_rect, | 896 content_rect, |
| 897 contents_scale, | 897 contents_scale, |
| 898 picture_pile); | 898 picture_pile); |
| 899 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 899 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
| 900 } | 900 } |
| 901 | 901 |
| 902 } // namespace | 902 } // namespace |
| 903 } // namespace cc | 903 } // namespace cc |
| OLD | NEW |