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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 631 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
632 EXPECT_EQ(texture_size, copy_quad->texture_size); | 632 EXPECT_EQ(texture_size, copy_quad->texture_size); |
633 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 633 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
634 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); | 634 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); |
635 } | 635 } |
636 | 636 |
637 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { | 637 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { |
638 gfx::Rect opaque_rect(33, 47, 10, 12); | 638 gfx::Rect opaque_rect(33, 47, 10, 12); |
639 gfx::Rect visible_rect(40, 50, 30, 20); | 639 gfx::Rect visible_rect(40, 50, 30, 20); |
640 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); | 640 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); |
| 641 gfx::Size tex_size(32, 68); |
641 ResourceProvider::ResourceId y_plane_resource_id = 45; | 642 ResourceProvider::ResourceId y_plane_resource_id = 45; |
642 ResourceProvider::ResourceId u_plane_resource_id = 532; | 643 ResourceProvider::ResourceId u_plane_resource_id = 532; |
643 ResourceProvider::ResourceId v_plane_resource_id = 4; | 644 ResourceProvider::ResourceId v_plane_resource_id = 4; |
644 ResourceProvider::ResourceId a_plane_resource_id = 63; | 645 ResourceProvider::ResourceId a_plane_resource_id = 63; |
645 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601_JPEG; | 646 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601_JPEG; |
646 CREATE_SHARED_STATE(); | 647 CREATE_SHARED_STATE(); |
647 | 648 |
648 CREATE_QUAD_8_NEW(YUVVideoDrawQuad, | 649 CREATE_QUAD_9_NEW(YUVVideoDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
649 opaque_rect, | 650 tex_size, y_plane_resource_id, u_plane_resource_id, |
650 visible_rect, | 651 v_plane_resource_id, a_plane_resource_id, color_space); |
651 tex_coord_rect, | |
652 y_plane_resource_id, | |
653 u_plane_resource_id, | |
654 v_plane_resource_id, | |
655 a_plane_resource_id, | |
656 color_space); | |
657 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 652 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
658 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 653 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
659 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 654 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
660 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 655 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 656 EXPECT_EQ(tex_size, copy_quad->tex_size); |
661 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 657 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
662 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 658 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
663 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 659 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
664 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 660 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
665 EXPECT_EQ(color_space, copy_quad->color_space); | 661 EXPECT_EQ(color_space, copy_quad->color_space); |
666 | 662 |
667 CREATE_QUAD_6_ALL(YUVVideoDrawQuad, | 663 CREATE_QUAD_7_ALL(YUVVideoDrawQuad, tex_coord_rect, tex_size, |
668 tex_coord_rect, | 664 y_plane_resource_id, u_plane_resource_id, |
669 y_plane_resource_id, | 665 v_plane_resource_id, a_plane_resource_id, color_space); |
670 u_plane_resource_id, | |
671 v_plane_resource_id, | |
672 a_plane_resource_id, | |
673 color_space); | |
674 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 666 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
675 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 667 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 668 EXPECT_EQ(tex_size, copy_quad->tex_size); |
676 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 669 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
677 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 670 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
678 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 671 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
679 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 672 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
680 EXPECT_EQ(color_space, copy_quad->color_space); | 673 EXPECT_EQ(color_space, copy_quad->color_space); |
681 } | 674 } |
682 | 675 |
683 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 676 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
684 gfx::Rect opaque_rect(33, 44, 22, 33); | 677 gfx::Rect opaque_rect(33, 44, 22, 33); |
685 gfx::Rect visible_rect(40, 50, 30, 20); | 678 gfx::Rect visible_rect(40, 50, 30, 20); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 nearest_neighbor); | 887 nearest_neighbor); |
895 EXPECT_EQ(resource_id, quad_new->resource_id); | 888 EXPECT_EQ(resource_id, quad_new->resource_id); |
896 EXPECT_EQ(1, IterateAndCount(quad_new)); | 889 EXPECT_EQ(1, IterateAndCount(quad_new)); |
897 EXPECT_EQ(resource_id + 1, quad_new->resource_id); | 890 EXPECT_EQ(resource_id + 1, quad_new->resource_id); |
898 } | 891 } |
899 | 892 |
900 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { | 893 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { |
901 gfx::Rect opaque_rect(33, 47, 10, 12); | 894 gfx::Rect opaque_rect(33, 47, 10, 12); |
902 gfx::Rect visible_rect(40, 50, 30, 20); | 895 gfx::Rect visible_rect(40, 50, 30, 20); |
903 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); | 896 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); |
| 897 gfx::Size tex_size(32, 68); |
904 ResourceProvider::ResourceId y_plane_resource_id = 45; | 898 ResourceProvider::ResourceId y_plane_resource_id = 45; |
905 ResourceProvider::ResourceId u_plane_resource_id = 532; | 899 ResourceProvider::ResourceId u_plane_resource_id = 532; |
906 ResourceProvider::ResourceId v_plane_resource_id = 4; | 900 ResourceProvider::ResourceId v_plane_resource_id = 4; |
907 ResourceProvider::ResourceId a_plane_resource_id = 63; | 901 ResourceProvider::ResourceId a_plane_resource_id = 63; |
908 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601_JPEG; | 902 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601_JPEG; |
909 | 903 |
910 CREATE_SHARED_STATE(); | 904 CREATE_SHARED_STATE(); |
911 CREATE_QUAD_8_NEW(YUVVideoDrawQuad, | 905 CREATE_QUAD_9_NEW(YUVVideoDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
912 opaque_rect, | 906 tex_size, y_plane_resource_id, u_plane_resource_id, |
913 visible_rect, | 907 v_plane_resource_id, a_plane_resource_id, color_space); |
914 tex_coord_rect, | |
915 y_plane_resource_id, | |
916 u_plane_resource_id, | |
917 v_plane_resource_id, | |
918 a_plane_resource_id, | |
919 color_space); | |
920 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 908 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
921 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); | 909 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); |
922 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); | 910 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); |
923 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); | 911 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); |
924 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); | 912 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); |
925 EXPECT_EQ(color_space, quad_new->color_space); | 913 EXPECT_EQ(color_space, quad_new->color_space); |
926 EXPECT_EQ(4, IterateAndCount(quad_new)); | 914 EXPECT_EQ(4, IterateAndCount(quad_new)); |
927 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); | 915 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); |
928 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); | 916 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); |
929 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); | 917 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1025 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
1038 break; | 1026 break; |
1039 case DrawQuad::INVALID: | 1027 case DrawQuad::INVALID: |
1040 break; | 1028 break; |
1041 } | 1029 } |
1042 } | 1030 } |
1043 } | 1031 } |
1044 | 1032 |
1045 } // namespace | 1033 } // namespace |
1046 } // namespace cc | 1034 } // namespace cc |
OLD | NEW |