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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 647 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
648 } | 648 } |
649 | 649 |
650 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 650 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
651 gfx::Rect opaque_rect(33, 44, 22, 33); | 651 gfx::Rect opaque_rect(33, 44, 22, 33); |
652 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 652 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
653 gfx::Size texture_size(85, 32); | 653 gfx::Size texture_size(85, 32); |
654 bool swizzle_contents = true; | 654 bool swizzle_contents = true; |
655 gfx::Rect content_rect(30, 40, 20, 30); | 655 gfx::Rect content_rect(30, 40, 20, 30); |
656 float contents_scale = 3.141592f; | 656 float contents_scale = 3.141592f; |
| 657 bool draw_direct_to_backbuffer = true; |
657 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); | 658 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); |
658 CREATE_SHARED_STATE(); | 659 CREATE_SHARED_STATE(); |
659 | 660 |
660 CREATE_QUAD_7_NEW(PictureDrawQuad, | 661 CREATE_QUAD_8_NEW(PictureDrawQuad, |
661 opaque_rect, | 662 opaque_rect, |
662 tex_coord_rect, | 663 tex_coord_rect, |
663 texture_size, | 664 texture_size, |
664 swizzle_contents, | 665 swizzle_contents, |
665 content_rect, | 666 content_rect, |
666 contents_scale, | 667 contents_scale, |
| 668 draw_direct_to_backbuffer, |
667 picture_pile); | 669 picture_pile); |
668 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 670 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
669 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 671 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
670 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 672 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
671 EXPECT_EQ(texture_size, copy_quad->texture_size); | 673 EXPECT_EQ(texture_size, copy_quad->texture_size); |
672 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 674 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
673 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); | 675 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); |
674 EXPECT_EQ(contents_scale, copy_quad->contents_scale); | 676 EXPECT_EQ(contents_scale, copy_quad->contents_scale); |
| 677 EXPECT_EQ(draw_direct_to_backbuffer, copy_quad->draw_direct_to_backbuffer); |
675 EXPECT_EQ(picture_pile, copy_quad->picture_pile); | 678 EXPECT_EQ(picture_pile, copy_quad->picture_pile); |
676 | 679 |
677 CREATE_QUAD_6_ALL(PictureDrawQuad, | 680 CREATE_QUAD_7_ALL(PictureDrawQuad, |
678 tex_coord_rect, | 681 tex_coord_rect, |
679 texture_size, | 682 texture_size, |
680 swizzle_contents, | 683 swizzle_contents, |
681 content_rect, | 684 content_rect, |
682 contents_scale, | 685 contents_scale, |
| 686 draw_direct_to_backbuffer, |
683 picture_pile); | 687 picture_pile); |
684 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 688 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
685 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 689 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
686 EXPECT_EQ(texture_size, copy_quad->texture_size); | 690 EXPECT_EQ(texture_size, copy_quad->texture_size); |
687 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 691 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
688 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); | 692 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); |
689 EXPECT_EQ(contents_scale, copy_quad->contents_scale); | 693 EXPECT_EQ(contents_scale, copy_quad->contents_scale); |
| 694 EXPECT_EQ(draw_direct_to_backbuffer, copy_quad->draw_direct_to_backbuffer); |
690 EXPECT_EQ(picture_pile, copy_quad->picture_pile); | 695 EXPECT_EQ(picture_pile, copy_quad->picture_pile); |
691 } | 696 } |
692 | 697 |
693 class DrawQuadIteratorTest : public testing::Test { | 698 class DrawQuadIteratorTest : public testing::Test { |
694 protected: | 699 protected: |
695 ResourceProvider::ResourceId IncrementResourceId( | 700 ResourceProvider::ResourceId IncrementResourceId( |
696 ResourceProvider::ResourceId id) { | 701 ResourceProvider::ResourceId id) { |
697 ++num_resources_; | 702 ++num_resources_; |
698 return id + 1; | 703 return id + 1; |
699 } | 704 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 } | 867 } |
863 | 868 |
864 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 | 869 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 |
865 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 870 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
866 gfx::Rect opaque_rect(33, 44, 22, 33); | 871 gfx::Rect opaque_rect(33, 44, 22, 33); |
867 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 872 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
868 gfx::Size texture_size(85, 32); | 873 gfx::Size texture_size(85, 32); |
869 bool swizzle_contents = true; | 874 bool swizzle_contents = true; |
870 gfx::Rect content_rect(30, 40, 20, 30); | 875 gfx::Rect content_rect(30, 40, 20, 30); |
871 float contents_scale = 3.141592f; | 876 float contents_scale = 3.141592f; |
| 877 bool draw_direct_to_backbuffer = true; |
872 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); | 878 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(false); |
873 | 879 |
874 CREATE_SHARED_STATE(); | 880 CREATE_SHARED_STATE(); |
875 CREATE_QUAD_7_NEW(PictureDrawQuad, | 881 CREATE_QUAD_8_NEW(PictureDrawQuad, |
876 opaque_rect, | 882 opaque_rect, |
877 tex_coord_rect, | 883 tex_coord_rect, |
878 texture_size, | 884 texture_size, |
879 swizzle_contents, | 885 swizzle_contents, |
880 content_rect, | 886 content_rect, |
881 contents_scale, | 887 contents_scale, |
| 888 draw_direct_to_backbuffer, |
882 picture_pile); | 889 picture_pile); |
883 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 890 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
884 } | 891 } |
885 | 892 |
886 } // namespace | 893 } // namespace |
887 } // namespace cc | 894 } // namespace cc |
OLD | NEW |