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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 658 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
659 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 659 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
660 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 660 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
661 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 661 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
662 } | 662 } |
663 | 663 |
664 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 664 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
665 gfx::Rect opaque_rect(33, 44, 22, 33); | 665 gfx::Rect opaque_rect(33, 44, 22, 33); |
666 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 666 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
667 gfx::Size texture_size(85, 32); | 667 gfx::Size texture_size(85, 32); |
668 bool swizzle_contents = true; | 668 ResourceFormat texture_format = RGBA_8888; |
669 gfx::Rect content_rect(30, 40, 20, 30); | 669 gfx::Rect content_rect(30, 40, 20, 30); |
670 float contents_scale = 3.141592f; | 670 float contents_scale = 3.141592f; |
671 bool can_draw_direct_to_backbuffer = true; | 671 bool can_draw_direct_to_backbuffer = true; |
672 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(); | 672 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(); |
673 CREATE_SHARED_STATE(); | 673 CREATE_SHARED_STATE(); |
674 | 674 |
675 CREATE_QUAD_8_NEW(PictureDrawQuad, | 675 CREATE_QUAD_8_NEW(PictureDrawQuad, |
676 opaque_rect, | 676 opaque_rect, |
677 tex_coord_rect, | 677 tex_coord_rect, |
678 texture_size, | 678 texture_size, |
679 swizzle_contents, | 679 texture_format, |
680 content_rect, | 680 content_rect, |
681 contents_scale, | 681 contents_scale, |
682 can_draw_direct_to_backbuffer, | 682 can_draw_direct_to_backbuffer, |
683 picture_pile); | 683 picture_pile); |
684 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 684 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
685 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 685 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
686 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 686 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
687 EXPECT_EQ(texture_size, copy_quad->texture_size); | 687 EXPECT_EQ(texture_size, copy_quad->texture_size); |
688 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 688 EXPECT_EQ(texture_format, copy_quad->texture_format); |
689 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); | 689 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); |
690 EXPECT_EQ(contents_scale, copy_quad->contents_scale); | 690 EXPECT_EQ(contents_scale, copy_quad->contents_scale); |
691 EXPECT_EQ(can_draw_direct_to_backbuffer, | 691 EXPECT_EQ(can_draw_direct_to_backbuffer, |
692 copy_quad->can_draw_direct_to_backbuffer); | 692 copy_quad->can_draw_direct_to_backbuffer); |
693 EXPECT_EQ(picture_pile, copy_quad->picture_pile); | 693 EXPECT_EQ(picture_pile, copy_quad->picture_pile); |
694 | 694 |
695 CREATE_QUAD_7_ALL(PictureDrawQuad, | 695 CREATE_QUAD_7_ALL(PictureDrawQuad, |
696 tex_coord_rect, | 696 tex_coord_rect, |
697 texture_size, | 697 texture_size, |
698 swizzle_contents, | 698 texture_format, |
699 content_rect, | 699 content_rect, |
700 contents_scale, | 700 contents_scale, |
701 can_draw_direct_to_backbuffer, | 701 can_draw_direct_to_backbuffer, |
702 picture_pile); | 702 picture_pile); |
703 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 703 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
704 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 704 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
705 EXPECT_EQ(texture_size, copy_quad->texture_size); | 705 EXPECT_EQ(texture_size, copy_quad->texture_size); |
706 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 706 EXPECT_EQ(texture_format, copy_quad->texture_format); |
707 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); | 707 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); |
708 EXPECT_EQ(contents_scale, copy_quad->contents_scale); | 708 EXPECT_EQ(contents_scale, copy_quad->contents_scale); |
709 EXPECT_EQ(can_draw_direct_to_backbuffer, | 709 EXPECT_EQ(can_draw_direct_to_backbuffer, |
710 copy_quad->can_draw_direct_to_backbuffer); | 710 copy_quad->can_draw_direct_to_backbuffer); |
711 EXPECT_EQ(picture_pile, copy_quad->picture_pile); | 711 EXPECT_EQ(picture_pile, copy_quad->picture_pile); |
712 } | 712 } |
713 | 713 |
714 class DrawQuadIteratorTest : public testing::Test { | 714 class DrawQuadIteratorTest : public testing::Test { |
715 protected: | 715 protected: |
716 ResourceProvider::ResourceId IncrementResourceId( | 716 ResourceProvider::ResourceId IncrementResourceId( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); | 886 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); |
887 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); | 887 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); |
888 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); | 888 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); |
889 } | 889 } |
890 | 890 |
891 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 | 891 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 |
892 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 892 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
893 gfx::Rect opaque_rect(33, 44, 22, 33); | 893 gfx::Rect opaque_rect(33, 44, 22, 33); |
894 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 894 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
895 gfx::Size texture_size(85, 32); | 895 gfx::Size texture_size(85, 32); |
896 bool swizzle_contents = true; | 896 ResourceFormat texture_format = RGBA_8888; |
897 gfx::Rect content_rect(30, 40, 20, 30); | 897 gfx::Rect content_rect(30, 40, 20, 30); |
898 float contents_scale = 3.141592f; | 898 float contents_scale = 3.141592f; |
899 bool can_draw_direct_to_backbuffer = true; | 899 bool can_draw_direct_to_backbuffer = true; |
900 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(); | 900 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(); |
901 | 901 |
902 CREATE_SHARED_STATE(); | 902 CREATE_SHARED_STATE(); |
903 CREATE_QUAD_8_NEW(PictureDrawQuad, | 903 CREATE_QUAD_8_NEW(PictureDrawQuad, |
904 opaque_rect, | 904 opaque_rect, |
905 tex_coord_rect, | 905 tex_coord_rect, |
906 texture_size, | 906 texture_size, |
907 swizzle_contents, | 907 texture_format, |
908 content_rect, | 908 content_rect, |
909 contents_scale, | 909 contents_scale, |
910 can_draw_direct_to_backbuffer, | 910 can_draw_direct_to_backbuffer, |
911 picture_pile); | 911 picture_pile); |
912 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 912 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
913 } | 913 } |
914 | 914 |
915 } // namespace | 915 } // namespace |
916 } // namespace cc | 916 } // namespace cc |
OLD | NEW |