| 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 28 matching lines...) Expand all Loading... |
| 39 gfx::Rect clip_rect(19, 21, 23, 25); | 39 gfx::Rect clip_rect(19, 21, 23, 25); |
| 40 bool is_clipped = true; | 40 bool is_clipped = true; |
| 41 float opacity = 0.25f; | 41 float opacity = 0.25f; |
| 42 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 42 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
| 43 int sorting_context_id = 65536; | 43 int sorting_context_id = 65536; |
| 44 | 44 |
| 45 std::unique_ptr<SharedQuadState> state(new SharedQuadState); | 45 std::unique_ptr<SharedQuadState> state(new SharedQuadState); |
| 46 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect, | 46 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect, |
| 47 is_clipped, opacity, blend_mode, sorting_context_id); | 47 is_clipped, opacity, blend_mode, sorting_context_id); |
| 48 | 48 |
| 49 std::unique_ptr<SharedQuadState> copy(new SharedQuadState); | 49 std::unique_ptr<SharedQuadState> copy(new SharedQuadState(*state)); |
| 50 copy->CopyFrom(state.get()); | |
| 51 EXPECT_EQ(quad_transform, copy->quad_to_target_transform); | 50 EXPECT_EQ(quad_transform, copy->quad_to_target_transform); |
| 52 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect); | 51 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect); |
| 53 EXPECT_EQ(opacity, copy->opacity); | 52 EXPECT_EQ(opacity, copy->opacity); |
| 54 EXPECT_EQ(clip_rect, copy->clip_rect); | 53 EXPECT_EQ(clip_rect, copy->clip_rect); |
| 55 EXPECT_EQ(is_clipped, copy->is_clipped); | 54 EXPECT_EQ(is_clipped, copy->is_clipped); |
| 56 EXPECT_EQ(blend_mode, copy->blend_mode); | 55 EXPECT_EQ(blend_mode, copy->blend_mode); |
| 57 } | 56 } |
| 58 | 57 |
| 59 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { | 58 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { |
| 60 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 59 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 81 EXPECT_EQ(quad->opaque_rect, copy->opaque_rect); | 80 EXPECT_EQ(quad->opaque_rect, copy->opaque_rect); |
| 82 EXPECT_EQ(quad->needs_blending, copy->needs_blending); | 81 EXPECT_EQ(quad->needs_blending, copy->needs_blending); |
| 83 EXPECT_EQ(copy_shared_state, copy->shared_quad_state); | 82 EXPECT_EQ(copy_shared_state, copy->shared_quad_state); |
| 84 } | 83 } |
| 85 | 84 |
| 86 #define CREATE_SHARED_STATE() \ | 85 #define CREATE_SHARED_STATE() \ |
| 87 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); \ | 86 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); \ |
| 88 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \ | 87 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \ |
| 89 SharedQuadState* copy_shared_state = \ | 88 SharedQuadState* copy_shared_state = \ |
| 90 render_pass->CreateAndAppendSharedQuadState(); \ | 89 render_pass->CreateAndAppendSharedQuadState(); \ |
| 91 copy_shared_state->CopyFrom(shared_state); | 90 *copy_shared_state = *shared_state; |
| 92 | 91 |
| 93 #define QUAD_DATA \ | 92 #define QUAD_DATA \ |
| 94 gfx::Rect quad_rect(30, 40, 50, 60); \ | 93 gfx::Rect quad_rect(30, 40, 50, 60); \ |
| 95 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ | 94 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ |
| 96 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \ | 95 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \ |
| 97 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \ | 96 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \ |
| 98 bool needs_blending = true; \ | 97 bool needs_blending = true; \ |
| 99 ALLOW_UNUSED_LOCAL(needs_blending); | 98 ALLOW_UNUSED_LOCAL(needs_blending); |
| 100 | 99 |
| 101 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \ | 100 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \ |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 973 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 975 break; | 974 break; |
| 976 case DrawQuad::INVALID: | 975 case DrawQuad::INVALID: |
| 977 break; | 976 break; |
| 978 } | 977 } |
| 979 } | 978 } |
| 980 } | 979 } |
| 981 | 980 |
| 982 } // namespace | 981 } // namespace |
| 983 } // namespace cc | 982 } // namespace cc |
| OLD | NEW |