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/draw_quad.h" | 5 #include "cc/draw_quad.h" |
6 | 6 |
7 #include "cc/checkerboard_draw_quad.h" | 7 #include "cc/checkerboard_draw_quad.h" |
8 #include "cc/debug_border_draw_quad.h" | 8 #include "cc/debug_border_draw_quad.h" |
9 #include "cc/io_surface_draw_quad.h" | 9 #include "cc/io_surface_draw_quad.h" |
10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
11 #include "cc/render_pass_draw_quad.h" | 11 #include "cc/render_pass_draw_quad.h" |
12 #include "cc/solid_color_draw_quad.h" | 12 #include "cc/solid_color_draw_quad.h" |
13 #include "cc/stream_video_draw_quad.h" | 13 #include "cc/stream_video_draw_quad.h" |
14 #include "cc/test/geometry_test_utils.h" | 14 #include "cc/test/geometry_test_utils.h" |
15 #include "cc/texture_draw_quad.h" | 15 #include "cc/texture_draw_quad.h" |
16 #include "cc/tile_draw_quad.h" | 16 #include "cc/tile_draw_quad.h" |
17 #include "cc/yuv_video_draw_quad.h" | 17 #include "cc/yuv_video_draw_quad.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
20 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 20 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
22 | 22 |
23 namespace cc { | 23 namespace cc { |
24 namespace { | 24 namespace { |
25 | 25 |
26 TEST(DrawQuadTest, copySharedQuadState) | 26 TEST(DrawQuadTest, copySharedQuadState) |
27 { | 27 { |
28 gfx::Transform quadTransform = MathUtil::createGfxTransform(1, 0.5, 0, 1, 0.
5, 0); | 28 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
29 gfx::Rect visibleContentRect(10, 12, 14, 16); | 29 gfx::Rect visibleContentRect(10, 12, 14, 16); |
30 gfx::Rect clippedRectInTarget(19, 21, 23, 25); | 30 gfx::Rect clippedRectInTarget(19, 21, 23, 25); |
31 gfx::Rect clipRect = clippedRectInTarget; | 31 gfx::Rect clipRect = clippedRectInTarget; |
32 bool isClipped = true; | 32 bool isClipped = true; |
33 float opacity = 0.25; | 33 float opacity = 0.25; |
34 | 34 |
35 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); | 35 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); |
36 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe
ct, isClipped, opacity); | 36 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe
ct, isClipped, opacity); |
37 | 37 |
38 scoped_ptr<SharedQuadState> copy(state->Copy()); | 38 scoped_ptr<SharedQuadState> copy(state->Copy()); |
39 EXPECT_EQ(quadTransform, copy->content_to_target_transform); | 39 EXPECT_EQ(quadTransform, copy->content_to_target_transform); |
40 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect); | 40 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect); |
41 EXPECT_RECT_EQ(clippedRectInTarget, copy->clipped_rect_in_target); | 41 EXPECT_RECT_EQ(clippedRectInTarget, copy->clipped_rect_in_target); |
42 EXPECT_EQ(opacity, copy->opacity); | 42 EXPECT_EQ(opacity, copy->opacity); |
43 EXPECT_RECT_EQ(clipRect, copy->clip_rect); | 43 EXPECT_RECT_EQ(clipRect, copy->clip_rect); |
44 EXPECT_EQ(isClipped, copy->is_clipped); | 44 EXPECT_EQ(isClipped, copy->is_clipped); |
45 } | 45 } |
46 | 46 |
47 scoped_ptr<SharedQuadState> createSharedQuadState() | 47 scoped_ptr<SharedQuadState> createSharedQuadState() |
48 { | 48 { |
49 gfx::Transform quadTransform = MathUtil::createGfxTransform(1, 0.5, 0, 1, 0.
5, 0); | 49 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
50 gfx::Rect visibleContentRect(10, 12, 14, 16); | 50 gfx::Rect visibleContentRect(10, 12, 14, 16); |
51 gfx::Rect clippedRectInTarget(19, 21, 23, 25); | 51 gfx::Rect clippedRectInTarget(19, 21, 23, 25); |
52 gfx::Rect clipRect = clippedRectInTarget; | 52 gfx::Rect clipRect = clippedRectInTarget; |
53 bool isClipped = false; | 53 bool isClipped = false; |
54 float opacity = 1; | 54 float opacity = 1; |
55 | 55 |
56 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); | 56 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); |
57 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe
ct, isClipped, opacity); | 57 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe
ct, isClipped, opacity); |
58 return state.Pass(); | 58 return state.Pass(); |
59 } | 59 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 CREATE_QUAD_1_ALL(SolidColorDrawQuad, color); | 336 CREATE_QUAD_1_ALL(SolidColorDrawQuad, color); |
337 EXPECT_EQ(DrawQuad::SOLID_COLOR, copyQuad->material); | 337 EXPECT_EQ(DrawQuad::SOLID_COLOR, copyQuad->material); |
338 EXPECT_EQ(color, copyQuad->color); | 338 EXPECT_EQ(color, copyQuad->color); |
339 } | 339 } |
340 | 340 |
341 TEST(DrawQuadTest, copyStreamVideoDrawQuad) | 341 TEST(DrawQuadTest, copyStreamVideoDrawQuad) |
342 { | 342 { |
343 gfx::Rect opaqueRect(3, 7, 10, 12); | 343 gfx::Rect opaqueRect(3, 7, 10, 12); |
344 unsigned textureId = 64; | 344 unsigned textureId = 64; |
345 gfx::Transform matrix = MathUtil::createGfxTransform(0.5, 1, 0.25, 0.75, 0,
1); | 345 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1); |
346 CREATE_SHARED_STATE(); | 346 CREATE_SHARED_STATE(); |
347 | 347 |
348 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaqueRect, textureId, matrix); | 348 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaqueRect, textureId, matrix); |
349 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material); | 349 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material); |
350 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect); | 350 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect); |
351 EXPECT_EQ(textureId, copyQuad->texture_id); | 351 EXPECT_EQ(textureId, copyQuad->texture_id); |
352 EXPECT_EQ(matrix, copyQuad->matrix); | 352 EXPECT_EQ(matrix, copyQuad->matrix); |
353 | 353 |
354 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, textureId, matrix); | 354 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, textureId, matrix); |
355 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material); | 355 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId); | 463 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId); |
464 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size); | 464 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size); |
465 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format); | 465 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format); |
466 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId); | 466 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId); |
467 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size); | 467 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size); |
468 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format); | 468 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format); |
469 } | 469 } |
470 | 470 |
471 } // namespace | 471 } // namespace |
472 } // namespace cc | 472 } // namespace cc |
OLD | NEW |