Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1869)

Side by Side Diff: cc/ipc/shared_quad_state_struct_traits.h

Issue 2502373003: stop using SkXfermode -- use SkBlendMode instead (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/ipc/cc_param_traits_unittest.cc ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-shared.h" 8 #include "cc/ipc/shared_quad_state.mojom-shared.h"
9 #include "cc/quads/shared_quad_state.h" 9 #include "cc/quads/shared_quad_state.h"
10 10
(...skipping 29 matching lines...) Expand all
40 40
41 static bool is_clipped(const OptSharedQuadState& input) { 41 static bool is_clipped(const OptSharedQuadState& input) {
42 return input.sqs->is_clipped; 42 return input.sqs->is_clipped;
43 } 43 }
44 44
45 static float opacity(const OptSharedQuadState& input) { 45 static float opacity(const OptSharedQuadState& input) {
46 return input.sqs->opacity; 46 return input.sqs->opacity;
47 } 47 }
48 48
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 static_cast<uint32_t>(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::SharedQuadStateDataView, 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(
(...skipping 14 matching lines...) Expand all
75 return sqs.clip_rect; 75 return sqs.clip_rect;
76 } 76 }
77 77
78 static bool is_clipped(const cc::SharedQuadState& sqs) { 78 static bool is_clipped(const cc::SharedQuadState& sqs) {
79 return sqs.is_clipped; 79 return sqs.is_clipped;
80 } 80 }
81 81
82 static float opacity(const cc::SharedQuadState& sqs) { return sqs.opacity; } 82 static float opacity(const cc::SharedQuadState& sqs) { return sqs.opacity; }
83 83
84 static uint32_t blend_mode(const cc::SharedQuadState& sqs) { 84 static uint32_t blend_mode(const cc::SharedQuadState& sqs) {
85 return sqs.blend_mode; 85 return static_cast<uint32_t>(sqs.blend_mode);
86 } 86 }
87 87
88 static int32_t sorting_context_id(const cc::SharedQuadState& sqs) { 88 static int32_t sorting_context_id(const cc::SharedQuadState& sqs) {
89 return sqs.sorting_context_id; 89 return sqs.sorting_context_id;
90 } 90 }
91 91
92 static bool Read(cc::mojom::SharedQuadStateDataView data, 92 static bool Read(cc::mojom::SharedQuadStateDataView data,
93 cc::SharedQuadState* out) { 93 cc::SharedQuadState* out) {
94 if (!data.ReadQuadToTargetTransform(&out->quad_to_target_transform) || 94 if (!data.ReadQuadToTargetTransform(&out->quad_to_target_transform) ||
95 !data.ReadQuadLayerBounds(&out->quad_layer_bounds) || 95 !data.ReadQuadLayerBounds(&out->quad_layer_bounds) ||
96 !data.ReadVisibleQuadLayerRect(&out->visible_quad_layer_rect) || 96 !data.ReadVisibleQuadLayerRect(&out->visible_quad_layer_rect) ||
97 !data.ReadClipRect(&out->clip_rect)) { 97 !data.ReadClipRect(&out->clip_rect)) {
98 return false; 98 return false;
99 } 99 }
100 100
101 out->is_clipped = data.is_clipped(); 101 out->is_clipped = data.is_clipped();
102 out->opacity = data.opacity(); 102 out->opacity = data.opacity();
103 if (data.blend_mode() > SkXfermode::kLastMode) 103 if (data.blend_mode() > static_cast<int>(SkBlendMode::kLastMode))
104 return false; 104 return false;
105 out->blend_mode = static_cast<SkXfermode::Mode>(data.blend_mode()); 105 out->blend_mode = static_cast<SkBlendMode>(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_
OLDNEW
« no previous file with comments | « cc/ipc/cc_param_traits_unittest.cc ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698