| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); | 489 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material); |
| 490 EXPECT_EQ(color, copy_quad->color); | 490 EXPECT_EQ(color, copy_quad->color); |
| 491 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off); | 491 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off); |
| 492 } | 492 } |
| 493 | 493 |
| 494 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) { | 494 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) { |
| 495 gfx::Rect opaque_rect(33, 47, 10, 12); | 495 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 496 gfx::Rect visible_rect(40, 50, 30, 20); | 496 gfx::Rect visible_rect(40, 50, 30, 20); |
| 497 ResourceId resource_id = 64; | 497 ResourceId resource_id = 64; |
| 498 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); | 498 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); |
| 499 gfx::BufferFormat format = gfx::BufferFormat::BGRA_8888; |
| 499 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); | 500 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
| 500 CREATE_SHARED_STATE(); | 501 CREATE_SHARED_STATE(); |
| 501 | 502 |
| 502 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, | 503 CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, |
| 503 resource_size_in_pixels, matrix); | 504 resource_size_in_pixels, format, matrix); |
| 504 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 505 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
| 505 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 506 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
| 506 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 507 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 507 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 508 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
| 508 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); | 509 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); |
| 510 EXPECT_EQ(format, copy_quad->format); |
| 509 EXPECT_EQ(matrix, copy_quad->matrix); | 511 EXPECT_EQ(matrix, copy_quad->matrix); |
| 510 | 512 |
| 511 CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, | 513 CREATE_QUAD_4_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, |
| 512 matrix); | 514 format, matrix); |
| 513 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 515 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
| 514 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 516 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
| 515 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); | 517 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); |
| 518 EXPECT_EQ(format, copy_quad->format); |
| 516 EXPECT_EQ(matrix, copy_quad->matrix); | 519 EXPECT_EQ(matrix, copy_quad->matrix); |
| 517 } | 520 } |
| 518 | 521 |
| 519 TEST(DrawQuadTest, CopySurfaceDrawQuad) { | 522 TEST(DrawQuadTest, CopySurfaceDrawQuad) { |
| 520 gfx::Rect visible_rect(40, 50, 30, 20); | 523 gfx::Rect visible_rect(40, 50, 30, 20); |
| 521 SurfaceId surface_id(kArbitraryFrameSinkId, | 524 SurfaceId surface_id(kArbitraryFrameSinkId, |
| 522 LocalSurfaceId(1234, base::UnguessableToken::Create())); | 525 LocalSurfaceId(1234, base::UnguessableToken::Create())); |
| 523 CREATE_SHARED_STATE(); | 526 CREATE_SHARED_STATE(); |
| 524 | 527 |
| 525 CREATE_QUAD_4_NEW(SurfaceDrawQuad, visible_rect, surface_id, | 528 CREATE_QUAD_4_NEW(SurfaceDrawQuad, visible_rect, surface_id, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 CREATE_QUAD_3_NEW( | 789 CREATE_QUAD_3_NEW( |
| 787 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off); | 790 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off); |
| 788 EXPECT_EQ(0, IterateAndCount(quad_new)); | 791 EXPECT_EQ(0, IterateAndCount(quad_new)); |
| 789 } | 792 } |
| 790 | 793 |
| 791 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) { | 794 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) { |
| 792 gfx::Rect opaque_rect(33, 47, 10, 12); | 795 gfx::Rect opaque_rect(33, 47, 10, 12); |
| 793 gfx::Rect visible_rect(40, 50, 30, 20); | 796 gfx::Rect visible_rect(40, 50, 30, 20); |
| 794 ResourceId resource_id = 64; | 797 ResourceId resource_id = 64; |
| 795 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); | 798 gfx::Size resource_size_in_pixels = gfx::Size(40, 41); |
| 799 gfx::BufferFormat format = gfx::BufferFormat::BGRA_8888; |
| 796 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); | 800 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
| 797 | 801 |
| 798 CREATE_SHARED_STATE(); | 802 CREATE_SHARED_STATE(); |
| 799 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, | 803 CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, |
| 800 resource_size_in_pixels, matrix); | 804 resource_size_in_pixels, format, matrix); |
| 801 EXPECT_EQ(resource_id, quad_new->resource_id()); | 805 EXPECT_EQ(resource_id, quad_new->resource_id()); |
| 802 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); | 806 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); |
| 803 EXPECT_EQ(1, IterateAndCount(quad_new)); | 807 EXPECT_EQ(1, IterateAndCount(quad_new)); |
| 804 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); | 808 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); |
| 805 } | 809 } |
| 806 | 810 |
| 807 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { | 811 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { |
| 808 gfx::Rect visible_rect(40, 50, 30, 20); | 812 gfx::Rect visible_rect(40, 50, 30, 20); |
| 809 SurfaceId surface_id(kArbitraryFrameSinkId, | 813 SurfaceId surface_id(kArbitraryFrameSinkId, |
| 810 LocalSurfaceId(4321, base::UnguessableToken::Create())); | 814 LocalSurfaceId(4321, base::UnguessableToken::Create())); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 991 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 988 break; | 992 break; |
| 989 case DrawQuad::INVALID: | 993 case DrawQuad::INVALID: |
| 990 break; | 994 break; |
| 991 } | 995 } |
| 992 } | 996 } |
| 993 } | 997 } |
| 994 | 998 |
| 995 } // namespace | 999 } // namespace |
| 996 } // namespace cc | 1000 } // namespace cc |
| OLD | NEW |