| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); | 484 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); |
| 485 EXPECT_EQ(color, copy_quad->color); | 485 EXPECT_EQ(color, copy_quad->color); |
| 486 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off); | 486 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off); |
| 487 } | 487 } |
| 488 | 488 |
| 489 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) { | 489 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) { |
| 490 gfx::Rect opaque_rect(33, 47, 10, 12); | 490 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 491 gfx::Rect visible_rect(40, 50, 30, 20); | 491 gfx::Rect visible_rect(40, 50, 30, 20); |
| 492 ResourceId resource_id = 64; | 492 ResourceId resource_id = 64; |
| 493 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); | 493 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); |
| 494 gfx::BufferFormat format = gfx::BufferFormat::BGRA_8888; |
| 494 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); | 495 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
| 495 CREATE_SHARED_STATE(); | 496 CREATE_SHARED_STATE(); |
| 496 | 497 |
| 497 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, | 498 CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, |
| 498 resource_size_in_pixels, matrix); | 499 resource_size_in_pixels, format, matrix); |
| 499 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 500 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
| 500 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 501 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
| 501 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 502 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 502 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 503 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
| 503 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); | 504 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); |
| 505 EXPECT_EQ(format, copy_quad->format); |
| 504 EXPECT_EQ(matrix, copy_quad->matrix); | 506 EXPECT_EQ(matrix, copy_quad->matrix); |
| 505 | 507 |
| 506 CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, | 508 CREATE_QUAD_4_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, |
| 507 matrix); | 509 format, matrix); |
| 508 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 510 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
| 509 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 511 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
| 510 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); | 512 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); |
| 513 EXPECT_EQ(format, copy_quad->format); |
| 511 EXPECT_EQ(matrix, copy_quad->matrix); | 514 EXPECT_EQ(matrix, copy_quad->matrix); |
| 512 } | 515 } |
| 513 | 516 |
| 514 TEST(DrawQuadTest, CopySurfaceDrawQuad) { | 517 TEST(DrawQuadTest, CopySurfaceDrawQuad) { |
| 515 gfx::Rect visible_rect(40, 50, 30, 20); | 518 gfx::Rect visible_rect(40, 50, 30, 20); |
| 516 SurfaceId surface_id(kArbitraryFrameSinkId, | 519 SurfaceId surface_id(kArbitraryFrameSinkId, |
| 517 LocalSurfaceId(1234, base::UnguessableToken::Create())); | 520 LocalSurfaceId(1234, base::UnguessableToken::Create())); |
| 518 CREATE_SHARED_STATE(); | 521 CREATE_SHARED_STATE(); |
| 519 | 522 |
| 520 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); | 523 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 CREATE_QUAD_3_NEW( | 780 CREATE_QUAD_3_NEW( |
| 778 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off); | 781 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off); |
| 779 EXPECT_EQ(0, IterateAndCount(quad_new)); | 782 EXPECT_EQ(0, IterateAndCount(quad_new)); |
| 780 } | 783 } |
| 781 | 784 |
| 782 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) { | 785 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) { |
| 783 gfx::Rect opaque_rect(33, 47, 10, 12); | 786 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 784 gfx::Rect visible_rect(40, 50, 30, 20); | 787 gfx::Rect visible_rect(40, 50, 30, 20); |
| 785 ResourceId resource_id = 64; | 788 ResourceId resource_id = 64; |
| 786 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); | 789 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); |
| 790 gfx::BufferFormat format = gfx::BufferFormat::BGRA_8888; |
| 787 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); | 791 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
| 788 | 792 |
| 789 CREATE_SHARED_STATE(); | 793 CREATE_SHARED_STATE(); |
| 790 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, | 794 CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, |
| 791 resource_size_in_pixels, matrix); | 795 resource_size_in_pixels, format, matrix); |
| 792 EXPECT_EQ(resource_id, quad_new->resource_id()); | 796 EXPECT_EQ(resource_id, quad_new->resource_id()); |
| 793 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); | 797 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); |
| 794 EXPECT_EQ(1, IterateAndCount(quad_new)); | 798 EXPECT_EQ(1, IterateAndCount(quad_new)); |
| 795 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); | 799 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); |
| 796 } | 800 } |
| 797 | 801 |
| 798 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { | 802 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { |
| 799 gfx::Rect visible_rect(40, 50, 30, 20); | 803 gfx::Rect visible_rect(40, 50, 30, 20); |
| 800 SurfaceId surface_id(kArbitraryFrameSinkId, | 804 SurfaceId surface_id(kArbitraryFrameSinkId, |
| 801 LocalSurfaceId(4321, base::UnguessableToken::Create())); | 805 LocalSurfaceId(4321, base::UnguessableToken::Create())); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 981 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 978 break; | 982 break; |
| 979 case DrawQuad::INVALID: | 983 case DrawQuad::INVALID: |
| 980 break; | 984 break; |
| 981 } | 985 } |
| 982 } | 986 } |
| 983 } | 987 } |
| 984 | 988 |
| 985 } // namespace | 989 } // namespace |
| 986 } // namespace cc | 990 } // namespace cc |
| OLD | NEW |