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.
5 #include "mojo/geometry/geometry_type_converters.h"
10 Point TypeConverter
<Point
, gfx::Point
>::ConvertFrom(const gfx::Point
& input
,
12 Point::Builder
point(buf
);
13 point
.set_x(input
.x());
14 point
.set_y(input
.y());
15 return point
.Finish();
19 gfx::Point TypeConverter
<Point
, gfx::Point
>::ConvertTo(const Point
& input
) {
20 return gfx::Point(input
.x(), input
.y());
24 Size TypeConverter
<Size
, gfx::Size
>::ConvertFrom(const gfx::Size
& input
,
26 Size::Builder
size(buf
);
27 size
.set_width(input
.width());
28 size
.set_height(input
.height());
33 gfx::Size TypeConverter
<Size
, gfx::Size
>::ConvertTo(const Size
& input
) {
34 return gfx::Size(input
.width(), input
.height());
38 Rect TypeConverter
<Rect
, gfx::Rect
>::ConvertFrom(const gfx::Rect
& input
,
40 Rect::Builder
rect(buf
);
41 rect
.set_position(input
.origin());
42 rect
.set_size(input
.size());
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());