OLD | NEW |
| (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 | |
OLD | NEW |