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

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

Issue 2032643002: Implement cc::SharedQuadState StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed rockot's comment Created 4 years, 6 months 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/shared_quad_state.typemap ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_
6 #define CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_
7
8 #include "cc/ipc/shared_quad_state.mojom.h"
9 #include "cc/quads/shared_quad_state.h"
10
11 namespace mojo {
12
13 template <>
14 struct StructTraits<cc::mojom::SharedQuadState, cc::SharedQuadState> {
15 static gfx::Transform quad_to_target_transform(
16 const cc::SharedQuadState& sqs) {
17 return sqs.quad_to_target_transform;
18 }
19
20 static gfx::Size quad_layer_bounds(const cc::SharedQuadState& sqs) {
21 return sqs.quad_layer_bounds;
22 }
23
24 static gfx::Rect visible_quad_layer_rect(const cc::SharedQuadState& sqs) {
25 return sqs.visible_quad_layer_rect;
26 }
27
28 static gfx::Rect clip_rect(const cc::SharedQuadState& sqs) {
29 return sqs.clip_rect;
30 }
31
32 static bool is_clipped(const cc::SharedQuadState& sqs) {
33 return sqs.is_clipped;
34 }
35
36 static float opacity(const cc::SharedQuadState& sqs) { return sqs.opacity; }
37
38 static int32_t blend_mode(const cc::SharedQuadState& sqs) {
39 return sqs.blend_mode;
40 }
41
42 static int32_t sorting_context_id(const cc::SharedQuadState& sqs) {
43 return sqs.sorting_context_id;
44 }
45
46 static bool Read(cc::mojom::SharedQuadStateDataView data,
47 cc::SharedQuadState* out) {
48 if (!data.ReadQuadToTargetTransform(&out->quad_to_target_transform) ||
49 !data.ReadQuadLayerBounds(&out->quad_layer_bounds) ||
50 !data.ReadVisibleQuadLayerRect(&out->visible_quad_layer_rect) ||
51 !data.ReadClipRect(&out->clip_rect)) {
52 return false;
53 }
54
55 out->is_clipped = data.is_clipped();
56 out->opacity = data.opacity();
57 if (data.blend_mode() > SkXfermode::kLastMode)
Tom Sepez 2016/06/03 18:14:28 blend_mode is signed, so it could be < 0 (at least
58 return false;
59 out->blend_mode = static_cast<SkXfermode::Mode>(data.blend_mode());
60 out->sorting_context_id = data.sorting_context_id();
61 return true;
62 }
63 };
64
65 } // namespace mojo
66
67 #endif // CC_IPC_SHARED_QUAD_STATE_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « cc/ipc/shared_quad_state.typemap ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698