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

Side by Side Diff: mojo/geometry/geometry_type_converters.cc

Issue 298253005: Move geometry to mojo/services, extract input events to their own mojom (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/geometry/geometry_type_converters.h ('k') | mojo/geometry/mojo_geometry_export.h » ('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 2014 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 #include "mojo/geometry/geometry_type_converters.h"
6
7 namespace mojo {
8
9 // static
10 Point TypeConverter<Point, gfx::Point>::ConvertFrom(const gfx::Point& input,
11 Buffer* buf) {
12 Point::Builder point(buf);
13 point.set_x(input.x());
14 point.set_y(input.y());
15 return point.Finish();
16 }
17
18 // static
19 gfx::Point TypeConverter<Point, gfx::Point>::ConvertTo(const Point& input) {
20 return gfx::Point(input.x(), input.y());
21 }
22
23 // static
24 Size TypeConverter<Size, gfx::Size>::ConvertFrom(const gfx::Size& input,
25 Buffer* buf) {
26 Size::Builder size(buf);
27 size.set_width(input.width());
28 size.set_height(input.height());
29 return size.Finish();
30 }
31
32 // static
33 gfx::Size TypeConverter<Size, gfx::Size>::ConvertTo(const Size& input) {
34 return gfx::Size(input.width(), input.height());
35 }
36
37 // static
38 Rect TypeConverter<Rect, gfx::Rect>::ConvertFrom(const gfx::Rect& input,
39 Buffer* buf) {
40 Rect::Builder rect(buf);
41 rect.set_position(input.origin());
42 rect.set_size(input.size());
43 return rect.Finish();
44 }
45
46 // static
47 gfx::Rect TypeConverter<Rect, gfx::Rect>::ConvertTo(const Rect& input) {
48 return gfx::Rect(input.position().x(), input.position().y(),
49 input.size().width(), input.size().height());
50 }
51
52 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/geometry/geometry_type_converters.h ('k') | mojo/geometry/mojo_geometry_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698