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