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 14 matching lines...) Expand all Loading... |
25 #include "cc/quads/yuv_video_draw_quad.h" | 25 #include "cc/quads/yuv_video_draw_quad.h" |
26 #include "cc/test/fake_raster_source.h" | 26 #include "cc/test/fake_raster_source.h" |
27 #include "cc/test/geometry_test_utils.h" | 27 #include "cc/test/geometry_test_utils.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 29 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
30 #include "ui/gfx/transform.h" | 30 #include "ui/gfx/transform.h" |
31 | 31 |
32 namespace cc { | 32 namespace cc { |
33 namespace { | 33 namespace { |
34 | 34 |
| 35 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); |
| 36 |
35 TEST(DrawQuadTest, CopySharedQuadState) { | 37 TEST(DrawQuadTest, CopySharedQuadState) { |
36 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 38 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
37 gfx::Size layer_bounds(26, 28); | 39 gfx::Size layer_bounds(26, 28); |
38 gfx::Rect visible_layer_rect(10, 12, 14, 16); | 40 gfx::Rect visible_layer_rect(10, 12, 14, 16); |
39 gfx::Rect clip_rect(19, 21, 23, 25); | 41 gfx::Rect clip_rect(19, 21, 23, 25); |
40 bool is_clipped = true; | 42 bool is_clipped = true; |
41 float opacity = 0.25f; | 43 float opacity = 0.25f; |
42 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 44 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
43 int sorting_context_id = 65536; | 45 int sorting_context_id = 65536; |
44 | 46 |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, | 517 CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, |
516 matrix); | 518 matrix); |
517 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); | 519 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); |
518 EXPECT_EQ(resource_id, copy_quad->resource_id()); | 520 EXPECT_EQ(resource_id, copy_quad->resource_id()); |
519 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); | 521 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); |
520 EXPECT_EQ(matrix, copy_quad->matrix); | 522 EXPECT_EQ(matrix, copy_quad->matrix); |
521 } | 523 } |
522 | 524 |
523 TEST(DrawQuadTest, CopySurfaceDrawQuad) { | 525 TEST(DrawQuadTest, CopySurfaceDrawQuad) { |
524 gfx::Rect visible_rect(40, 50, 30, 20); | 526 gfx::Rect visible_rect(40, 50, 30, 20); |
525 SurfaceId surface_id(0, 1234, 0); | 527 SurfaceId surface_id(kArbitraryFrameSinkId, 1234, 0); |
526 CREATE_SHARED_STATE(); | 528 CREATE_SHARED_STATE(); |
527 | 529 |
528 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); | 530 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); |
529 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); | 531 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); |
530 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 532 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
531 EXPECT_EQ(surface_id, copy_quad->surface_id); | 533 EXPECT_EQ(surface_id, copy_quad->surface_id); |
532 | 534 |
533 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id); | 535 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id); |
534 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); | 536 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); |
535 EXPECT_EQ(surface_id, copy_quad->surface_id); | 537 EXPECT_EQ(surface_id, copy_quad->surface_id); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, | 806 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, |
805 resource_size_in_pixels, matrix); | 807 resource_size_in_pixels, matrix); |
806 EXPECT_EQ(resource_id, quad_new->resource_id()); | 808 EXPECT_EQ(resource_id, quad_new->resource_id()); |
807 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); | 809 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); |
808 EXPECT_EQ(1, IterateAndCount(quad_new)); | 810 EXPECT_EQ(1, IterateAndCount(quad_new)); |
809 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); | 811 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); |
810 } | 812 } |
811 | 813 |
812 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { | 814 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { |
813 gfx::Rect visible_rect(40, 50, 30, 20); | 815 gfx::Rect visible_rect(40, 50, 30, 20); |
814 SurfaceId surface_id(0, 4321, 0); | 816 SurfaceId surface_id(kArbitraryFrameSinkId, 4321, 0); |
815 | 817 |
816 CREATE_SHARED_STATE(); | 818 CREATE_SHARED_STATE(); |
817 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); | 819 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); |
818 EXPECT_EQ(0, IterateAndCount(quad_new)); | 820 EXPECT_EQ(0, IterateAndCount(quad_new)); |
819 } | 821 } |
820 | 822 |
821 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { | 823 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { |
822 gfx::Rect opaque_rect(33, 47, 10, 12); | 824 gfx::Rect opaque_rect(33, 47, 10, 12); |
823 gfx::Rect visible_rect(40, 50, 30, 20); | 825 gfx::Rect visible_rect(40, 50, 30, 20); |
824 unsigned resource_id = 82; | 826 unsigned resource_id = 82; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 992 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
991 break; | 993 break; |
992 case DrawQuad::INVALID: | 994 case DrawQuad::INVALID: |
993 break; | 995 break; |
994 } | 996 } |
995 } | 997 } |
996 } | 998 } |
997 | 999 |
998 } // namespace | 1000 } // namespace |
999 } // namespace cc | 1001 } // namespace cc |
OLD | NEW |