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