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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 663 } |
664 | 664 |
665 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 665 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
666 gfx::Rect opaque_rect(33, 44, 22, 33); | 666 gfx::Rect opaque_rect(33, 44, 22, 33); |
667 gfx::Rect visible_rect(40, 50, 30, 20); | 667 gfx::Rect visible_rect(40, 50, 30, 20); |
668 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 668 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
669 gfx::Size texture_size(85, 32); | 669 gfx::Size texture_size(85, 32); |
670 ResourceFormat texture_format = RGBA_8888; | 670 ResourceFormat texture_format = RGBA_8888; |
671 gfx::Rect content_rect(30, 40, 20, 30); | 671 gfx::Rect content_rect(30, 40, 20, 30); |
672 float contents_scale = 3.141592f; | 672 float contents_scale = 3.141592f; |
673 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(); | 673 scoped_refptr<RasterSource> raster_source = PicturePileImpl::Create(); |
674 CREATE_SHARED_STATE(); | 674 CREATE_SHARED_STATE(); |
675 | 675 |
676 CREATE_QUAD_8_NEW(PictureDrawQuad, | 676 CREATE_QUAD_8_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
677 opaque_rect, | 677 texture_size, texture_format, content_rect, contents_scale, |
678 visible_rect, | 678 raster_source); |
679 tex_coord_rect, | |
680 texture_size, | |
681 texture_format, | |
682 content_rect, | |
683 contents_scale, | |
684 picture_pile); | |
685 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 679 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
686 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 680 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
687 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); | 681 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); |
688 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 682 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
689 EXPECT_EQ(texture_size, copy_quad->texture_size); | 683 EXPECT_EQ(texture_size, copy_quad->texture_size); |
690 EXPECT_EQ(texture_format, copy_quad->texture_format); | 684 EXPECT_EQ(texture_format, copy_quad->texture_format); |
691 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); | 685 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); |
692 EXPECT_EQ(contents_scale, copy_quad->contents_scale); | 686 EXPECT_EQ(contents_scale, copy_quad->contents_scale); |
693 EXPECT_EQ(picture_pile, copy_quad->picture_pile); | 687 EXPECT_EQ(raster_source, copy_quad->raster_source); |
694 | 688 |
695 CREATE_QUAD_6_ALL(PictureDrawQuad, | 689 CREATE_QUAD_6_ALL(PictureDrawQuad, tex_coord_rect, texture_size, |
696 tex_coord_rect, | 690 texture_format, content_rect, contents_scale, |
697 texture_size, | 691 raster_source); |
698 texture_format, | |
699 content_rect, | |
700 contents_scale, | |
701 picture_pile); | |
702 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 692 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
703 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 693 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
704 EXPECT_EQ(texture_size, copy_quad->texture_size); | 694 EXPECT_EQ(texture_size, copy_quad->texture_size); |
705 EXPECT_EQ(texture_format, copy_quad->texture_format); | 695 EXPECT_EQ(texture_format, copy_quad->texture_format); |
706 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); | 696 EXPECT_RECT_EQ(content_rect, copy_quad->content_rect); |
707 EXPECT_EQ(contents_scale, copy_quad->contents_scale); | 697 EXPECT_EQ(contents_scale, copy_quad->contents_scale); |
708 EXPECT_EQ(picture_pile, copy_quad->picture_pile); | 698 EXPECT_EQ(raster_source, copy_quad->raster_source); |
709 } | 699 } |
710 | 700 |
711 class DrawQuadIteratorTest : public testing::Test { | 701 class DrawQuadIteratorTest : public testing::Test { |
712 protected: | 702 protected: |
713 ResourceProvider::ResourceId IncrementResourceId( | 703 ResourceProvider::ResourceId IncrementResourceId( |
714 ResourceProvider::ResourceId id) { | 704 ResourceProvider::ResourceId id) { |
715 ++num_resources_; | 705 ++num_resources_; |
716 return id + 1; | 706 return id + 1; |
717 } | 707 } |
718 | 708 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 905 |
916 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 | 906 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 |
917 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 907 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
918 gfx::Rect opaque_rect(33, 44, 22, 33); | 908 gfx::Rect opaque_rect(33, 44, 22, 33); |
919 gfx::Rect visible_rect(40, 50, 30, 20); | 909 gfx::Rect visible_rect(40, 50, 30, 20); |
920 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 910 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
921 gfx::Size texture_size(85, 32); | 911 gfx::Size texture_size(85, 32); |
922 ResourceFormat texture_format = RGBA_8888; | 912 ResourceFormat texture_format = RGBA_8888; |
923 gfx::Rect content_rect(30, 40, 20, 30); | 913 gfx::Rect content_rect(30, 40, 20, 30); |
924 float contents_scale = 3.141592f; | 914 float contents_scale = 3.141592f; |
925 scoped_refptr<PicturePileImpl> picture_pile = PicturePileImpl::Create(); | 915 scoped_refptr<PicturePileImpl> raster_source = PicturePileImpl::Create(); |
926 | 916 |
927 CREATE_SHARED_STATE(); | 917 CREATE_SHARED_STATE(); |
928 CREATE_QUAD_8_NEW(PictureDrawQuad, | 918 CREATE_QUAD_8_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
929 opaque_rect, | 919 texture_size, texture_format, content_rect, contents_scale, |
930 visible_rect, | 920 raster_source); |
931 tex_coord_rect, | |
932 texture_size, | |
933 texture_format, | |
934 content_rect, | |
935 contents_scale, | |
936 picture_pile); | |
937 EXPECT_EQ(0, IterateAndCount(quad_new)); | 921 EXPECT_EQ(0, IterateAndCount(quad_new)); |
938 } | 922 } |
939 | 923 |
940 TEST(DrawQuadTest, LargestQuadType) { | 924 TEST(DrawQuadTest, LargestQuadType) { |
941 size_t largest = 0; | 925 size_t largest = 0; |
942 | 926 |
943 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) { | 927 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) { |
944 switch (static_cast<DrawQuad::Material>(i)) { | 928 switch (static_cast<DrawQuad::Material>(i)) { |
945 case DrawQuad::CHECKERBOARD: | 929 case DrawQuad::CHECKERBOARD: |
946 largest = std::max(largest, sizeof(CheckerboardDrawQuad)); | 930 largest = std::max(largest, sizeof(CheckerboardDrawQuad)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1007 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
1024 break; | 1008 break; |
1025 case DrawQuad::INVALID: | 1009 case DrawQuad::INVALID: |
1026 break; | 1010 break; |
1027 } | 1011 } |
1028 } | 1012 } |
1029 } | 1013 } |
1030 | 1014 |
1031 } // namespace | 1015 } // namespace |
1032 } // namespace cc | 1016 } // namespace cc |
OLD | NEW |