| 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 = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.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 clipRect(19, 21, 23, 25); |
| 31 gfx::Rect clipRect = clippedRectInTarget; | |
| 32 bool isClipped = true; | 31 bool isClipped = true; |
| 33 float opacity = 0.25; | 32 float opacity = 0.25; |
| 34 | 33 |
| 35 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); | 34 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); |
| 36 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe
ct, isClipped, opacity); | 35 state->SetAll(quadTransform, visibleContentRect, clipRect, isClipped, opacit
y); |
| 37 | 36 |
| 38 scoped_ptr<SharedQuadState> copy(state->Copy()); | 37 scoped_ptr<SharedQuadState> copy(state->Copy()); |
| 39 EXPECT_EQ(quadTransform, copy->content_to_target_transform); | 38 EXPECT_EQ(quadTransform, copy->content_to_target_transform); |
| 40 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect); | 39 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect); |
| 41 EXPECT_RECT_EQ(clippedRectInTarget, copy->clipped_rect_in_target); | |
| 42 EXPECT_EQ(opacity, copy->opacity); | 40 EXPECT_EQ(opacity, copy->opacity); |
| 43 EXPECT_RECT_EQ(clipRect, copy->clip_rect); | 41 EXPECT_RECT_EQ(clipRect, copy->clip_rect); |
| 44 EXPECT_EQ(isClipped, copy->is_clipped); | 42 EXPECT_EQ(isClipped, copy->is_clipped); |
| 45 } | 43 } |
| 46 | 44 |
| 47 scoped_ptr<SharedQuadState> createSharedQuadState() | 45 scoped_ptr<SharedQuadState> createSharedQuadState() |
| 48 { | 46 { |
| 49 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 47 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); | 48 gfx::Rect visibleContentRect(10, 12, 14, 16); |
| 51 gfx::Rect clippedRectInTarget(19, 21, 23, 25); | 49 gfx::Rect clipRect(19, 21, 23, 25); |
| 52 gfx::Rect clipRect = clippedRectInTarget; | |
| 53 bool isClipped = false; | 50 bool isClipped = false; |
| 54 float opacity = 1; | 51 float opacity = 1; |
| 55 | 52 |
| 56 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); | 53 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); |
| 57 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe
ct, isClipped, opacity); | 54 state->SetAll(quadTransform, visibleContentRect, clipRect, isClipped, opacit
y); |
| 58 return state.Pass(); | 55 return state.Pass(); |
| 59 } | 56 } |
| 60 | 57 |
| 61 void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copyShared
State) | 58 void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copyShared
State) |
| 62 { | 59 { |
| 63 EXPECT_EQ(quad->material, copy->material); | 60 EXPECT_EQ(quad->material, copy->material); |
| 64 EXPECT_RECT_EQ(quad->rect, copy->rect); | 61 EXPECT_RECT_EQ(quad->rect, copy->rect); |
| 65 EXPECT_RECT_EQ(quad->visible_rect, copy->visible_rect); | 62 EXPECT_RECT_EQ(quad->visible_rect, copy->visible_rect); |
| 66 EXPECT_RECT_EQ(quad->opaque_rect, copy->opaque_rect); | 63 EXPECT_RECT_EQ(quad->opaque_rect, copy->opaque_rect); |
| 67 EXPECT_EQ(quad->needs_blending, copy->needs_blending); | 64 EXPECT_EQ(quad->needs_blending, copy->needs_blending); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId); | 531 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId); |
| 535 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size); | 532 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size); |
| 536 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format); | 533 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format); |
| 537 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId); | 534 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId); |
| 538 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size); | 535 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size); |
| 539 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format); | 536 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format); |
| 540 } | 537 } |
| 541 | 538 |
| 542 } // namespace | 539 } // namespace |
| 543 } // namespace cc | 540 } // namespace cc |
| OLD | NEW |