OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_ |
6 #define CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_ | 6 #define CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "cc/ipc/shared_quad_state.mojom.h" | 8 #include "cc/ipc/shared_quad_state.mojom.h" |
9 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 | 12 |
13 struct OptSharedQuadState { | 13 struct OptSharedQuadState { |
14 const cc::SharedQuadState* sqs; | 14 const cc::SharedQuadState* sqs; |
15 }; | 15 }; |
16 | 16 |
17 template <> | 17 template <> |
18 struct StructTraits<cc::mojom::SharedQuadState, OptSharedQuadState> { | 18 struct StructTraits<cc::mojom::SharedQuadStateDataView, OptSharedQuadState> { |
19 static bool IsNull(const OptSharedQuadState& input) { return !input.sqs; } | 19 static bool IsNull(const OptSharedQuadState& input) { return !input.sqs; } |
20 | 20 |
21 static void SetToNull(OptSharedQuadState* output) { output->sqs = nullptr; } | 21 static void SetToNull(OptSharedQuadState* output) { output->sqs = nullptr; } |
22 | 22 |
23 static const gfx::Transform& quad_to_target_transform( | 23 static const gfx::Transform& quad_to_target_transform( |
24 const OptSharedQuadState& input) { | 24 const OptSharedQuadState& input) { |
25 return input.sqs->quad_to_target_transform; | 25 return input.sqs->quad_to_target_transform; |
26 } | 26 } |
27 | 27 |
28 static const gfx::Size& quad_layer_bounds(const OptSharedQuadState& input) { | 28 static const gfx::Size& quad_layer_bounds(const OptSharedQuadState& input) { |
(...skipping 20 matching lines...) Expand all Loading... |
49 static uint32_t blend_mode(const OptSharedQuadState& input) { | 49 static uint32_t blend_mode(const OptSharedQuadState& input) { |
50 return input.sqs->blend_mode; | 50 return input.sqs->blend_mode; |
51 } | 51 } |
52 | 52 |
53 static int32_t sorting_context_id(const OptSharedQuadState& input) { | 53 static int32_t sorting_context_id(const OptSharedQuadState& input) { |
54 return input.sqs->sorting_context_id; | 54 return input.sqs->sorting_context_id; |
55 } | 55 } |
56 }; | 56 }; |
57 | 57 |
58 template <> | 58 template <> |
59 struct StructTraits<cc::mojom::SharedQuadState, cc::SharedQuadState> { | 59 struct StructTraits<cc::mojom::SharedQuadStateDataView, cc::SharedQuadState> { |
60 static const gfx::Transform& quad_to_target_transform( | 60 static const gfx::Transform& quad_to_target_transform( |
61 const cc::SharedQuadState& sqs) { | 61 const cc::SharedQuadState& sqs) { |
62 return sqs.quad_to_target_transform; | 62 return sqs.quad_to_target_transform; |
63 } | 63 } |
64 | 64 |
65 static const gfx::Size& quad_layer_bounds(const cc::SharedQuadState& sqs) { | 65 static const gfx::Size& quad_layer_bounds(const cc::SharedQuadState& sqs) { |
66 return sqs.quad_layer_bounds; | 66 return sqs.quad_layer_bounds; |
67 } | 67 } |
68 | 68 |
69 static const gfx::Rect& visible_quad_layer_rect( | 69 static const gfx::Rect& visible_quad_layer_rect( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return false; | 104 return false; |
105 out->blend_mode = static_cast<SkXfermode::Mode>(data.blend_mode()); | 105 out->blend_mode = static_cast<SkXfermode::Mode>(data.blend_mode()); |
106 out->sorting_context_id = data.sorting_context_id(); | 106 out->sorting_context_id = data.sorting_context_id(); |
107 return true; | 107 return true; |
108 } | 108 } |
109 }; | 109 }; |
110 | 110 |
111 } // namespace mojo | 111 } // namespace mojo |
112 | 112 |
113 #endif // CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_ | 113 #endif // CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_ |
OLD | NEW |