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 "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 y_plane.size = gfx::Size(34, 23); | 621 y_plane.size = gfx::Size(34, 23); |
622 y_plane.format = 8; | 622 y_plane.format = 8; |
623 VideoLayerImpl::FramePlane u_plane; | 623 VideoLayerImpl::FramePlane u_plane; |
624 u_plane.resource_id = 532; | 624 u_plane.resource_id = 532; |
625 u_plane.size = gfx::Size(134, 16); | 625 u_plane.size = gfx::Size(134, 16); |
626 u_plane.format = 2; | 626 u_plane.format = 2; |
627 VideoLayerImpl::FramePlane v_plane; | 627 VideoLayerImpl::FramePlane v_plane; |
628 v_plane.resource_id = 4; | 628 v_plane.resource_id = 4; |
629 v_plane.size = gfx::Size(456, 486); | 629 v_plane.size = gfx::Size(456, 486); |
630 v_plane.format = 46; | 630 v_plane.format = 46; |
| 631 VideoLayerImpl::FramePlane a_plane; |
| 632 a_plane.resource_id = 400; |
| 633 a_plane.size = gfx::Size(634, 354); |
| 634 a_plane.format = 9; |
631 CREATE_SHARED_STATE(); | 635 CREATE_SHARED_STATE(); |
632 | 636 |
633 CREATE_QUAD_5_NEW( | 637 CREATE_QUAD_6_NEW( |
634 YUVVideoDrawQuad, opaque_rect, tex_scale, y_plane, u_plane, v_plane); | 638 YUVVideoDrawQuad, opaque_rect, tex_scale, |
| 639 &y_plane, &u_plane, &v_plane, &a_plane); |
635 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 640 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
636 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 641 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
637 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 642 EXPECT_EQ(tex_scale, copy_quad->tex_scale); |
638 EXPECT_EQ(y_plane.resource_id, copy_quad->y_plane.resource_id); | 643 EXPECT_EQ(y_plane.resource_id, copy_quad->y_plane.resource_id); |
639 EXPECT_EQ(y_plane.size, copy_quad->y_plane.size); | 644 EXPECT_EQ(y_plane.size, copy_quad->y_plane.size); |
640 EXPECT_EQ(y_plane.format, copy_quad->y_plane.format); | 645 EXPECT_EQ(y_plane.format, copy_quad->y_plane.format); |
641 EXPECT_EQ(u_plane.resource_id, copy_quad->u_plane.resource_id); | 646 EXPECT_EQ(u_plane.resource_id, copy_quad->u_plane.resource_id); |
642 EXPECT_EQ(u_plane.size, copy_quad->u_plane.size); | 647 EXPECT_EQ(u_plane.size, copy_quad->u_plane.size); |
643 EXPECT_EQ(u_plane.format, copy_quad->u_plane.format); | 648 EXPECT_EQ(u_plane.format, copy_quad->u_plane.format); |
644 EXPECT_EQ(v_plane.resource_id, copy_quad->v_plane.resource_id); | 649 EXPECT_EQ(v_plane.resource_id, copy_quad->v_plane.resource_id); |
645 EXPECT_EQ(v_plane.size, copy_quad->v_plane.size); | 650 EXPECT_EQ(v_plane.size, copy_quad->v_plane.size); |
646 EXPECT_EQ(v_plane.format, copy_quad->v_plane.format); | 651 EXPECT_EQ(v_plane.format, copy_quad->v_plane.format); |
| 652 EXPECT_EQ(a_plane.resource_id, copy_quad->a_plane.resource_id); |
| 653 EXPECT_EQ(a_plane.size, copy_quad->a_plane.size); |
| 654 EXPECT_EQ(a_plane.format, copy_quad->a_plane.format); |
647 | 655 |
648 CREATE_QUAD_4_ALL(YUVVideoDrawQuad, tex_scale, y_plane, u_plane, v_plane); | 656 CREATE_QUAD_5_ALL(YUVVideoDrawQuad, tex_scale, |
| 657 &y_plane, &u_plane, &v_plane, &a_plane); |
649 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 658 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
650 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 659 EXPECT_EQ(tex_scale, copy_quad->tex_scale); |
651 EXPECT_EQ(y_plane.resource_id, copy_quad->y_plane.resource_id); | 660 EXPECT_EQ(y_plane.resource_id, copy_quad->y_plane.resource_id); |
652 EXPECT_EQ(y_plane.size, copy_quad->y_plane.size); | 661 EXPECT_EQ(y_plane.size, copy_quad->y_plane.size); |
653 EXPECT_EQ(y_plane.format, copy_quad->y_plane.format); | 662 EXPECT_EQ(y_plane.format, copy_quad->y_plane.format); |
654 EXPECT_EQ(u_plane.resource_id, copy_quad->u_plane.resource_id); | 663 EXPECT_EQ(u_plane.resource_id, copy_quad->u_plane.resource_id); |
655 EXPECT_EQ(u_plane.size, copy_quad->u_plane.size); | 664 EXPECT_EQ(u_plane.size, copy_quad->u_plane.size); |
656 EXPECT_EQ(u_plane.format, copy_quad->u_plane.format); | 665 EXPECT_EQ(u_plane.format, copy_quad->u_plane.format); |
657 EXPECT_EQ(v_plane.resource_id, copy_quad->v_plane.resource_id); | 666 EXPECT_EQ(v_plane.resource_id, copy_quad->v_plane.resource_id); |
658 EXPECT_EQ(v_plane.size, copy_quad->v_plane.size); | 667 EXPECT_EQ(v_plane.size, copy_quad->v_plane.size); |
659 EXPECT_EQ(v_plane.format, copy_quad->v_plane.format); | 668 EXPECT_EQ(v_plane.format, copy_quad->v_plane.format); |
| 669 EXPECT_EQ(a_plane.resource_id, copy_quad->a_plane.resource_id); |
| 670 EXPECT_EQ(a_plane.size, copy_quad->a_plane.size); |
| 671 EXPECT_EQ(a_plane.format, copy_quad->a_plane.format); |
660 } | 672 } |
661 | 673 |
662 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 674 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
663 gfx::Rect opaque_rect(33, 44, 22, 33); | 675 gfx::Rect opaque_rect(33, 44, 22, 33); |
664 unsigned resource_id = 104; | 676 unsigned resource_id = 104; |
665 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 677 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
666 gfx::Size texture_size(85, 32); | 678 gfx::Size texture_size(85, 32); |
667 bool swizzle_contents = true; | 679 bool swizzle_contents = true; |
668 gfx::Rect content_rect(30, 40, 20, 30); | 680 gfx::Rect content_rect(30, 40, 20, 30); |
669 float contents_scale = 3.141592f; | 681 float contents_scale = 3.141592f; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 y_plane.size = gfx::Size(34, 23); | 863 y_plane.size = gfx::Size(34, 23); |
852 y_plane.format = 8; | 864 y_plane.format = 8; |
853 VideoLayerImpl::FramePlane u_plane; | 865 VideoLayerImpl::FramePlane u_plane; |
854 u_plane.resource_id = 532; | 866 u_plane.resource_id = 532; |
855 u_plane.size = gfx::Size(134, 16); | 867 u_plane.size = gfx::Size(134, 16); |
856 u_plane.format = 2; | 868 u_plane.format = 2; |
857 VideoLayerImpl::FramePlane v_plane; | 869 VideoLayerImpl::FramePlane v_plane; |
858 v_plane.resource_id = 4; | 870 v_plane.resource_id = 4; |
859 v_plane.size = gfx::Size(456, 486); | 871 v_plane.size = gfx::Size(456, 486); |
860 v_plane.format = 46; | 872 v_plane.format = 46; |
| 873 VideoLayerImpl::FramePlane a_plane; |
| 874 a_plane.resource_id = 400; |
| 875 a_plane.size = gfx::Size(634, 354); |
| 876 a_plane.format = 9; |
861 | 877 |
862 CREATE_SHARED_STATE(); | 878 CREATE_SHARED_STATE(); |
863 CREATE_QUAD_5_NEW( | 879 CREATE_QUAD_6_NEW( |
864 YUVVideoDrawQuad, opaque_rect, tex_scale, y_plane, u_plane, v_plane); | 880 YUVVideoDrawQuad, opaque_rect, tex_scale, |
| 881 &y_plane, &u_plane, &v_plane, &a_plane); |
865 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 882 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
866 EXPECT_EQ(y_plane.resource_id, quad_new->y_plane.resource_id); | 883 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); | 884 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); | 885 EXPECT_EQ(v_plane.resource_id, quad_new->v_plane.resource_id); |
869 EXPECT_EQ(3, IterateAndCount(quad_new.get())); | 886 EXPECT_EQ(a_plane.resource_id, quad_new->a_plane.resource_id); |
| 887 EXPECT_EQ(4, IterateAndCount(quad_new.get())); |
870 EXPECT_EQ(y_plane.resource_id + 1, quad_new->y_plane.resource_id); | 888 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); | 889 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); | 890 EXPECT_EQ(v_plane.resource_id + 1, quad_new->v_plane.resource_id); |
| 891 EXPECT_EQ(a_plane.resource_id + 1, quad_new->a_plane.resource_id); |
873 } | 892 } |
874 | 893 |
875 TEST_F(DrawQuadIteratorTest, PictureDrawQuad) { | 894 TEST_F(DrawQuadIteratorTest, PictureDrawQuad) { |
876 gfx::Rect opaque_rect(33, 44, 22, 33); | 895 gfx::Rect opaque_rect(33, 44, 22, 33); |
877 unsigned resource_id = 104; | 896 unsigned resource_id = 104; |
878 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 897 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
879 gfx::Size texture_size(85, 32); | 898 gfx::Size texture_size(85, 32); |
880 bool swizzle_contents = true; | 899 bool swizzle_contents = true; |
881 gfx::Rect content_rect(30, 40, 20, 30); | 900 gfx::Rect content_rect(30, 40, 20, 30); |
882 float contents_scale = 3.141592f; | 901 float contents_scale = 3.141592f; |
883 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); | 902 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); |
884 | 903 |
885 CREATE_SHARED_STATE(); | 904 CREATE_SHARED_STATE(); |
886 CREATE_QUAD_7_NEW(PictureDrawQuad, | 905 CREATE_QUAD_7_NEW(PictureDrawQuad, |
887 opaque_rect, | 906 opaque_rect, |
888 tex_coord_rect, | 907 tex_coord_rect, |
889 texture_size, | 908 texture_size, |
890 swizzle_contents, | 909 swizzle_contents, |
891 content_rect, | 910 content_rect, |
892 contents_scale, | 911 contents_scale, |
893 picture_pile); | 912 picture_pile); |
894 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 913 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
895 } | 914 } |
896 | 915 |
897 } // namespace | 916 } // namespace |
898 } // namespace cc | 917 } // namespace cc |
OLD | NEW |