| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::RectF tex_coord_rect(0.0f, 0.0f, 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 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::kRec601_Jpeg; |
| 597 CREATE_SHARED_STATE(); | 598 CREATE_SHARED_STATE(); |
| 598 | 599 |
| 599 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, | 600 CREATE_QUAD_8_NEW(YUVVideoDrawQuad, |
| 600 opaque_rect, | 601 opaque_rect, |
| 601 visible_rect, | 602 visible_rect, |
| 602 tex_coord_rect, | 603 tex_coord_rect, |
| 603 y_plane_resource_id, | 604 y_plane_resource_id, |
| 604 u_plane_resource_id, | 605 u_plane_resource_id, |
| 605 v_plane_resource_id, | 606 v_plane_resource_id, |
| 606 a_plane_resource_id); | 607 a_plane_resource_id, |
| 608 color_space); |
| 607 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 609 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 608 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 610 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 609 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); | 611 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); |
| 610 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 612 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 611 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 613 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); | 614 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); | 615 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); | 616 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
| 617 EXPECT_EQ(color_space, copy_quad->color_space); |
| 615 | 618 |
| 616 CREATE_QUAD_5_ALL(YUVVideoDrawQuad, | 619 CREATE_QUAD_6_ALL(YUVVideoDrawQuad, |
| 617 tex_coord_rect, | 620 tex_coord_rect, |
| 618 y_plane_resource_id, | 621 y_plane_resource_id, |
| 619 u_plane_resource_id, | 622 u_plane_resource_id, |
| 620 v_plane_resource_id, | 623 v_plane_resource_id, |
| 621 a_plane_resource_id); | 624 a_plane_resource_id, |
| 625 color_space); |
| 622 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 626 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 623 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 627 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 624 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 628 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); | 629 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); | 630 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); | 631 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
| 632 EXPECT_EQ(color_space, copy_quad->color_space); |
| 628 } | 633 } |
| 629 | 634 |
| 630 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 635 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
| 631 gfx::Rect opaque_rect(33, 44, 22, 33); | 636 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 632 gfx::Rect visible_rect(40, 50, 30, 20); | 637 gfx::Rect visible_rect(40, 50, 30, 20); |
| 633 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 638 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 634 gfx::Size texture_size(85, 32); | 639 gfx::Size texture_size(85, 32); |
| 635 ResourceFormat texture_format = RGBA_8888; | 640 ResourceFormat texture_format = RGBA_8888; |
| 636 gfx::Rect content_rect(30, 40, 20, 30); | 641 gfx::Rect content_rect(30, 40, 20, 30); |
| 637 float contents_scale = 3.141592f; | 642 float contents_scale = 3.141592f; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 } | 851 } |
| 847 | 852 |
| 848 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { | 853 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { |
| 849 gfx::Rect opaque_rect(33, 47, 10, 12); | 854 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 850 gfx::Rect visible_rect(40, 50, 30, 20); | 855 gfx::Rect visible_rect(40, 50, 30, 20); |
| 851 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); | 856 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); |
| 852 ResourceProvider::ResourceId y_plane_resource_id = 45; | 857 ResourceProvider::ResourceId y_plane_resource_id = 45; |
| 853 ResourceProvider::ResourceId u_plane_resource_id = 532; | 858 ResourceProvider::ResourceId u_plane_resource_id = 532; |
| 854 ResourceProvider::ResourceId v_plane_resource_id = 4; | 859 ResourceProvider::ResourceId v_plane_resource_id = 4; |
| 855 ResourceProvider::ResourceId a_plane_resource_id = 63; | 860 ResourceProvider::ResourceId a_plane_resource_id = 63; |
| 861 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::kRec601_Jpeg; |
| 856 | 862 |
| 857 CREATE_SHARED_STATE(); | 863 CREATE_SHARED_STATE(); |
| 858 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, | 864 CREATE_QUAD_8_NEW(YUVVideoDrawQuad, |
| 859 opaque_rect, | 865 opaque_rect, |
| 860 visible_rect, | 866 visible_rect, |
| 861 tex_coord_rect, | 867 tex_coord_rect, |
| 862 y_plane_resource_id, | 868 y_plane_resource_id, |
| 863 u_plane_resource_id, | 869 u_plane_resource_id, |
| 864 v_plane_resource_id, | 870 v_plane_resource_id, |
| 865 a_plane_resource_id); | 871 a_plane_resource_id, |
| 872 color_space); |
| 866 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 873 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
| 867 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); | 874 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); | 875 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); | 876 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); | 877 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); |
| 878 EXPECT_EQ(color_space, quad_new->color_space); |
| 871 EXPECT_EQ(4, IterateAndCount(quad_new.get())); | 879 EXPECT_EQ(4, IterateAndCount(quad_new.get())); |
| 872 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); | 880 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); |
| 873 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); | 881 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); |
| 874 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); | 882 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); |
| 875 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); | 883 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); |
| 876 } | 884 } |
| 877 | 885 |
| 878 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 | 886 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 |
| 879 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 887 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
| 880 gfx::Rect opaque_rect(33, 44, 22, 33); | 888 gfx::Rect opaque_rect(33, 44, 22, 33); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 894 texture_size, | 902 texture_size, |
| 895 texture_format, | 903 texture_format, |
| 896 content_rect, | 904 content_rect, |
| 897 contents_scale, | 905 contents_scale, |
| 898 picture_pile); | 906 picture_pile); |
| 899 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 907 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
| 900 } | 908 } |
| 901 | 909 |
| 902 } // namespace | 910 } // namespace |
| 903 } // namespace cc | 911 } // namespace cc |
| OLD | NEW |