| 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 25 matching lines...) Expand all Loading... |
| 36 TEST(DrawQuadTest, CopySharedQuadState) { | 36 TEST(DrawQuadTest, CopySharedQuadState) { |
| 37 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 37 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
| 38 gfx::Size layer_bounds(26, 28); | 38 gfx::Size layer_bounds(26, 28); |
| 39 gfx::Rect visible_layer_rect(10, 12, 14, 16); | 39 gfx::Rect visible_layer_rect(10, 12, 14, 16); |
| 40 gfx::Rect clip_rect(19, 21, 23, 25); | 40 gfx::Rect clip_rect(19, 21, 23, 25); |
| 41 bool is_clipped = true; | 41 bool is_clipped = true; |
| 42 float opacity = 0.25f; | 42 float opacity = 0.25f; |
| 43 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 43 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
| 44 int sorting_context_id = 65536; | 44 int sorting_context_id = 65536; |
| 45 | 45 |
| 46 scoped_ptr<SharedQuadState> state(new SharedQuadState); | 46 std::unique_ptr<SharedQuadState> state(new SharedQuadState); |
| 47 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect, | 47 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect, |
| 48 is_clipped, opacity, blend_mode, sorting_context_id); | 48 is_clipped, opacity, blend_mode, sorting_context_id); |
| 49 | 49 |
| 50 scoped_ptr<SharedQuadState> copy(new SharedQuadState); | 50 std::unique_ptr<SharedQuadState> copy(new SharedQuadState); |
| 51 copy->CopyFrom(state.get()); | 51 copy->CopyFrom(state.get()); |
| 52 EXPECT_EQ(quad_transform, copy->quad_to_target_transform); | 52 EXPECT_EQ(quad_transform, copy->quad_to_target_transform); |
| 53 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect); | 53 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect); |
| 54 EXPECT_EQ(opacity, copy->opacity); | 54 EXPECT_EQ(opacity, copy->opacity); |
| 55 EXPECT_EQ(clip_rect, copy->clip_rect); | 55 EXPECT_EQ(clip_rect, copy->clip_rect); |
| 56 EXPECT_EQ(is_clipped, copy->is_clipped); | 56 EXPECT_EQ(is_clipped, copy->is_clipped); |
| 57 EXPECT_EQ(blend_mode, copy->blend_mode); | 57 EXPECT_EQ(blend_mode, copy->blend_mode); |
| 58 } | 58 } |
| 59 | 59 |
| 60 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { | 60 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 78 SharedQuadState* copy_shared_state) { | 78 SharedQuadState* copy_shared_state) { |
| 79 EXPECT_EQ(quad->material, copy->material); | 79 EXPECT_EQ(quad->material, copy->material); |
| 80 EXPECT_EQ(quad->rect, copy->rect); | 80 EXPECT_EQ(quad->rect, copy->rect); |
| 81 EXPECT_EQ(quad->visible_rect, copy->visible_rect); | 81 EXPECT_EQ(quad->visible_rect, copy->visible_rect); |
| 82 EXPECT_EQ(quad->opaque_rect, copy->opaque_rect); | 82 EXPECT_EQ(quad->opaque_rect, copy->opaque_rect); |
| 83 EXPECT_EQ(quad->needs_blending, copy->needs_blending); | 83 EXPECT_EQ(quad->needs_blending, copy->needs_blending); |
| 84 EXPECT_EQ(copy_shared_state, copy->shared_quad_state); | 84 EXPECT_EQ(copy_shared_state, copy->shared_quad_state); |
| 85 } | 85 } |
| 86 | 86 |
| 87 #define CREATE_SHARED_STATE() \ | 87 #define CREATE_SHARED_STATE() \ |
| 88 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); \ | 88 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); \ |
| 89 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \ | 89 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \ |
| 90 SharedQuadState* copy_shared_state = \ | 90 SharedQuadState* copy_shared_state = \ |
| 91 render_pass->CreateAndAppendSharedQuadState(); \ | 91 render_pass->CreateAndAppendSharedQuadState(); \ |
| 92 copy_shared_state->CopyFrom(shared_state); | 92 copy_shared_state->CopyFrom(shared_state); |
| 93 | 93 |
| 94 #define QUAD_DATA \ | 94 #define QUAD_DATA \ |
| 95 gfx::Rect quad_rect(30, 40, 50, 60); \ | 95 gfx::Rect quad_rect(30, 40, 50, 60); \ |
| 96 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ | 96 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ |
| 97 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \ | 97 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \ |
| 98 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \ | 98 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \ |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1030 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 1031 break; | 1031 break; |
| 1032 case DrawQuad::INVALID: | 1032 case DrawQuad::INVALID: |
| 1033 break; | 1033 break; |
| 1034 } | 1034 } |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 } // namespace | 1038 } // namespace |
| 1039 } // namespace cc | 1039 } // namespace cc |
| OLD | NEW |