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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 | 545 |
546 TEST(DrawQuadTest, CopyTextureDrawQuad) { | 546 TEST(DrawQuadTest, CopyTextureDrawQuad) { |
547 gfx::Rect opaque_rect(33, 47, 10, 12); | 547 gfx::Rect opaque_rect(33, 47, 10, 12); |
548 gfx::Rect visible_rect(40, 50, 30, 20); | 548 gfx::Rect visible_rect(40, 50, 30, 20); |
549 unsigned resource_id = 82; | 549 unsigned resource_id = 82; |
550 bool premultiplied_alpha = true; | 550 bool premultiplied_alpha = true; |
551 gfx::PointF uv_top_left(0.5f, 224.f); | 551 gfx::PointF uv_top_left(0.5f, 224.f); |
552 gfx::PointF uv_bottom_right(51.5f, 260.f); | 552 gfx::PointF uv_bottom_right(51.5f, 260.f); |
553 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | 553 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
554 bool flipped = true; | 554 bool y_flipped = true; |
555 bool nearest_neighbor = true; | 555 bool nearest_neighbor = true; |
556 CREATE_SHARED_STATE(); | 556 CREATE_SHARED_STATE(); |
557 | 557 |
558 CREATE_QUAD_10_NEW(TextureDrawQuad, | 558 CREATE_QUAD_10_NEW(TextureDrawQuad, |
559 opaque_rect, | 559 opaque_rect, |
560 visible_rect, | 560 visible_rect, |
561 resource_id, | 561 resource_id, |
562 premultiplied_alpha, | 562 premultiplied_alpha, |
563 uv_top_left, | 563 uv_top_left, |
564 uv_bottom_right, | 564 uv_bottom_right, |
565 SK_ColorTRANSPARENT, | 565 SK_ColorTRANSPARENT, |
566 vertex_opacity, | 566 vertex_opacity, |
567 flipped, | 567 y_flipped, |
568 nearest_neighbor); | 568 nearest_neighbor); |
569 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material); | 569 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material); |
570 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 570 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
571 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 571 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
572 EXPECT_EQ(resource_id, copy_quad->resource_id); | 572 EXPECT_EQ(resource_id, copy_quad->resource_id); |
573 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha); | 573 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha); |
574 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left); | 574 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left); |
575 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right); | 575 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right); |
576 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4); | 576 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4); |
577 EXPECT_EQ(flipped, copy_quad->flipped); | 577 EXPECT_EQ(y_flipped, copy_quad->y_flipped); |
578 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); | 578 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); |
579 | 579 |
580 CREATE_QUAD_8_ALL(TextureDrawQuad, | 580 CREATE_QUAD_8_ALL(TextureDrawQuad, |
581 resource_id, | 581 resource_id, |
582 premultiplied_alpha, | 582 premultiplied_alpha, |
583 uv_top_left, | 583 uv_top_left, |
584 uv_bottom_right, | 584 uv_bottom_right, |
585 SK_ColorTRANSPARENT, | 585 SK_ColorTRANSPARENT, |
586 vertex_opacity, | 586 vertex_opacity, |
587 flipped, | 587 y_flipped, |
588 nearest_neighbor); | 588 nearest_neighbor); |
589 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material); | 589 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material); |
590 EXPECT_EQ(resource_id, copy_quad->resource_id); | 590 EXPECT_EQ(resource_id, copy_quad->resource_id); |
591 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha); | 591 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha); |
592 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left); | 592 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left); |
593 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right); | 593 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right); |
594 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4); | 594 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4); |
595 EXPECT_EQ(flipped, copy_quad->flipped); | 595 EXPECT_EQ(y_flipped, copy_quad->y_flipped); |
596 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); | 596 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); |
597 } | 597 } |
598 | 598 |
599 TEST(DrawQuadTest, CopyTileDrawQuad) { | 599 TEST(DrawQuadTest, CopyTileDrawQuad) { |
600 gfx::Rect opaque_rect(33, 44, 22, 33); | 600 gfx::Rect opaque_rect(33, 44, 22, 33); |
601 gfx::Rect visible_rect(40, 50, 30, 20); | 601 gfx::Rect visible_rect(40, 50, 30, 20); |
602 unsigned resource_id = 104; | 602 unsigned resource_id = 104; |
603 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 603 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
604 gfx::Size texture_size(85, 32); | 604 gfx::Size texture_size(85, 32); |
605 bool swizzle_contents = true; | 605 bool swizzle_contents = true; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 } | 848 } |
849 | 849 |
850 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { | 850 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { |
851 gfx::Rect opaque_rect(33, 47, 10, 12); | 851 gfx::Rect opaque_rect(33, 47, 10, 12); |
852 gfx::Rect visible_rect(40, 50, 30, 20); | 852 gfx::Rect visible_rect(40, 50, 30, 20); |
853 unsigned resource_id = 82; | 853 unsigned resource_id = 82; |
854 bool premultiplied_alpha = true; | 854 bool premultiplied_alpha = true; |
855 gfx::PointF uv_top_left(0.5f, 224.f); | 855 gfx::PointF uv_top_left(0.5f, 224.f); |
856 gfx::PointF uv_bottom_right(51.5f, 260.f); | 856 gfx::PointF uv_bottom_right(51.5f, 260.f); |
857 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | 857 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
858 bool flipped = true; | 858 bool y_flipped = true; |
859 bool nearest_neighbor = true; | 859 bool nearest_neighbor = true; |
860 | 860 |
861 CREATE_SHARED_STATE(); | 861 CREATE_SHARED_STATE(); |
862 CREATE_QUAD_10_NEW(TextureDrawQuad, | 862 CREATE_QUAD_10_NEW(TextureDrawQuad, |
863 opaque_rect, | 863 opaque_rect, |
864 visible_rect, | 864 visible_rect, |
865 resource_id, | 865 resource_id, |
866 premultiplied_alpha, | 866 premultiplied_alpha, |
867 uv_top_left, | 867 uv_top_left, |
868 uv_bottom_right, | 868 uv_bottom_right, |
869 SK_ColorTRANSPARENT, | 869 SK_ColorTRANSPARENT, |
870 vertex_opacity, | 870 vertex_opacity, |
871 flipped, | 871 y_flipped, |
872 nearest_neighbor); | 872 nearest_neighbor); |
873 EXPECT_EQ(resource_id, quad_new->resource_id); | 873 EXPECT_EQ(resource_id, quad_new->resource_id); |
874 EXPECT_EQ(1, IterateAndCount(quad_new)); | 874 EXPECT_EQ(1, IterateAndCount(quad_new)); |
875 EXPECT_EQ(resource_id + 1, quad_new->resource_id); | 875 EXPECT_EQ(resource_id + 1, quad_new->resource_id); |
876 } | 876 } |
877 | 877 |
878 TEST_F(DrawQuadIteratorTest, TileDrawQuad) { | 878 TEST_F(DrawQuadIteratorTest, TileDrawQuad) { |
879 gfx::Rect opaque_rect(33, 44, 22, 33); | 879 gfx::Rect opaque_rect(33, 44, 22, 33); |
880 gfx::Rect visible_rect(40, 50, 30, 20); | 880 gfx::Rect visible_rect(40, 50, 30, 20); |
881 unsigned resource_id = 104; | 881 unsigned resource_id = 104; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1035 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
1036 break; | 1036 break; |
1037 case DrawQuad::INVALID: | 1037 case DrawQuad::INVALID: |
1038 break; | 1038 break; |
1039 } | 1039 } |
1040 } | 1040 } |
1041 } | 1041 } |
1042 | 1042 |
1043 } // namespace | 1043 } // namespace |
1044 } // namespace cc | 1044 } // namespace cc |
OLD | NEW |