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

Side by Side Diff: ui/gfx/range/mojo/range_struct_traits.h

Issue 2531323002: Struct traits for gfx::Range and gfx::RangeF. (Closed)
Patch Set: Addressed feedback. Created 4 years 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 | « ui/gfx/range/mojo/range.typemap ('k') | ui/gfx/range/mojo/range_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 UI_GFX_RANGE_MOJO_RANGE_STRUCT_TRAITS_H_
6 #define UI_GFX_RANGE_MOJO_RANGE_STRUCT_TRAITS_H_
7
8 #include "ui/gfx/range/mojo/range.mojom-shared.h"
9 #include "ui/gfx/range/range.h"
10 #include "ui/gfx/range/range_f.h"
11
12 namespace mojo {
13
14 template <>
15 struct StructTraits<gfx::mojom::RangeDataView, gfx::Range> {
16 static uint32_t start(const gfx::Range& r) { return r.start(); }
17 static uint32_t end(const gfx::Range& r) { return r.end(); }
18 static bool Read(gfx::mojom::RangeDataView data, gfx::Range* out) {
19 out->set_start(data.start());
20 out->set_end(data.end());
21 return true;
22 }
23 };
24
25 template <>
26 struct StructTraits<gfx::mojom::RangeFDataView, gfx::RangeF> {
27 static float start(const gfx::RangeF& r) { return r.start(); }
28 static float end(const gfx::RangeF& r) { return r.end(); }
29 static bool Read(gfx::mojom::RangeFDataView data, gfx::RangeF* out) {
30 out->set_start(data.start());
31 out->set_end(data.end());
32 return true;
33 }
34 };
35
36 } // namespace mojo
37
38 #endif // UI_GFX_RANGE_MOJO_RANGE_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « ui/gfx/range/mojo/range.typemap ('k') | ui/gfx/range/mojo/range_struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698