| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 587 } |
| 588 | 588 |
| 589 TEST(DrawQuadTest, CopyTileDrawQuad) { | 589 TEST(DrawQuadTest, CopyTileDrawQuad) { |
| 590 gfx::Rect opaque_rect(33, 44, 22, 33); | 590 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 591 gfx::Rect visible_rect(40, 50, 30, 20); | 591 gfx::Rect visible_rect(40, 50, 30, 20); |
| 592 unsigned resource_id = 104; | 592 unsigned resource_id = 104; |
| 593 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 593 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 594 gfx::Size texture_size(85, 32); | 594 gfx::Size texture_size(85, 32); |
| 595 bool swizzle_contents = true; | 595 bool swizzle_contents = true; |
| 596 bool nearest_neighbor = true; | 596 bool nearest_neighbor = true; |
| 597 bool allow_overlay = true; |
| 597 CREATE_SHARED_STATE(); | 598 CREATE_SHARED_STATE(); |
| 598 | 599 |
| 599 CREATE_QUAD_7_NEW(TileDrawQuad, | 600 CREATE_QUAD_8_NEW(TileDrawQuad, |
| 600 opaque_rect, | 601 opaque_rect, |
| 601 visible_rect, | 602 visible_rect, |
| 602 resource_id, | 603 resource_id, |
| 603 tex_coord_rect, | 604 tex_coord_rect, |
| 604 texture_size, | 605 texture_size, |
| 605 swizzle_contents, | 606 swizzle_contents, |
| 606 nearest_neighbor); | 607 nearest_neighbor, |
| 608 allow_overlay); |
| 607 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); | 609 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); |
| 608 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 610 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 609 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 611 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
| 610 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 612 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
| 611 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 613 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 612 EXPECT_EQ(texture_size, copy_quad->texture_size); | 614 EXPECT_EQ(texture_size, copy_quad->texture_size); |
| 613 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 615 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
| 614 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); | 616 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); |
| 617 EXPECT_EQ(allow_overlay, copy_quad->allow_overlay); |
| 615 | 618 |
| 616 CREATE_QUAD_5_ALL(TileDrawQuad, | 619 CREATE_QUAD_6_ALL(TileDrawQuad, |
| 617 resource_id, | 620 resource_id, |
| 618 tex_coord_rect, | 621 tex_coord_rect, |
| 619 texture_size, | 622 texture_size, |
| 620 swizzle_contents, | 623 swizzle_contents, |
| 621 nearest_neighbor); | 624 nearest_neighbor, |
| 625 allow_overlay); |
| 622 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); | 626 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material); |
| 623 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 627 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
| 624 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 628 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 625 EXPECT_EQ(texture_size, copy_quad->texture_size); | 629 EXPECT_EQ(texture_size, copy_quad->texture_size); |
| 626 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 630 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
| 627 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); | 631 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); |
| 632 EXPECT_EQ(allow_overlay, copy_quad->allow_overlay); |
| 628 } | 633 } |
| 629 | 634 |
| 630 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { | 635 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { |
| 631 gfx::Rect opaque_rect(33, 47, 10, 12); | 636 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 632 gfx::Rect visible_rect(40, 50, 30, 20); | 637 gfx::Rect visible_rect(40, 50, 30, 20); |
| 633 gfx::RectF ya_tex_coord_rect(40, 50, 30, 20); | 638 gfx::RectF ya_tex_coord_rect(40, 50, 30, 20); |
| 634 gfx::RectF uv_tex_coord_rect(20, 25, 15, 10); | 639 gfx::RectF uv_tex_coord_rect(20, 25, 15, 10); |
| 635 gfx::Size ya_tex_size(32, 68); | 640 gfx::Size ya_tex_size(32, 68); |
| 636 gfx::Size uv_tex_size(41, 51); | 641 gfx::Size uv_tex_size(41, 51); |
| 637 ResourceId y_plane_resource_id = 45; | 642 ResourceId y_plane_resource_id = 45; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 } | 872 } |
| 868 | 873 |
| 869 TEST_F(DrawQuadIteratorTest, TileDrawQuad) { | 874 TEST_F(DrawQuadIteratorTest, TileDrawQuad) { |
| 870 gfx::Rect opaque_rect(33, 44, 22, 33); | 875 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 871 gfx::Rect visible_rect(40, 50, 30, 20); | 876 gfx::Rect visible_rect(40, 50, 30, 20); |
| 872 unsigned resource_id = 104; | 877 unsigned resource_id = 104; |
| 873 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); |
| 874 gfx::Size texture_size(85, 32); | 879 gfx::Size texture_size(85, 32); |
| 875 bool swizzle_contents = true; | 880 bool swizzle_contents = true; |
| 876 bool nearest_neighbor = true; | 881 bool nearest_neighbor = true; |
| 882 bool allow_overlay = true; |
| 877 | 883 |
| 878 CREATE_SHARED_STATE(); | 884 CREATE_SHARED_STATE(); |
| 879 CREATE_QUAD_7_NEW(TileDrawQuad, | 885 CREATE_QUAD_8_NEW(TileDrawQuad, |
| 880 opaque_rect, | 886 opaque_rect, |
| 881 visible_rect, | 887 visible_rect, |
| 882 resource_id, | 888 resource_id, |
| 883 tex_coord_rect, | 889 tex_coord_rect, |
| 884 texture_size, | 890 texture_size, |
| 885 swizzle_contents, | 891 swizzle_contents, |
| 886 nearest_neighbor); | 892 nearest_neighbor, |
| 893 allow_overlay); |
| 887 EXPECT_EQ(resource_id, quad_new->resource_id()); | 894 EXPECT_EQ(resource_id, quad_new->resource_id()); |
| 888 EXPECT_EQ(1, IterateAndCount(quad_new)); | 895 EXPECT_EQ(1, IterateAndCount(quad_new)); |
| 889 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); | 896 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); |
| 890 } | 897 } |
| 891 | 898 |
| 892 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { | 899 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { |
| 893 gfx::Rect opaque_rect(33, 47, 10, 12); | 900 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 894 gfx::Rect visible_rect(40, 50, 30, 20); | 901 gfx::Rect visible_rect(40, 50, 30, 20); |
| 895 gfx::RectF ya_tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); | 902 gfx::RectF ya_tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f); |
| 896 gfx::RectF uv_tex_coord_rect(0.0f, 0.0f, 0.375f, 0.25f); | 903 gfx::RectF uv_tex_coord_rect(0.0f, 0.0f, 0.375f, 0.25f); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1027 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 1021 break; | 1028 break; |
| 1022 case DrawQuad::INVALID: | 1029 case DrawQuad::INVALID: |
| 1023 break; | 1030 break; |
| 1024 } | 1031 } |
| 1025 } | 1032 } |
| 1026 } | 1033 } |
| 1027 | 1034 |
| 1028 } // namespace | 1035 } // namespace |
| 1029 } // namespace cc | 1036 } // namespace cc |
| OLD | NEW |