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