New avatar menu: Add supervised user disclaimer ("Usage and history of this user...
[chromium-blink-merge.git] / mojo / geometry / geometry_type_converters.cc
blobb01d249b27fbdd84fad2bf72c1f9dca835b06e31
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"
7 namespace mojo {
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();
18 // static
19 gfx::Point TypeConverter<Point, gfx::Point>::ConvertTo(const Point& input) {
20 return gfx::Point(input.x(), input.y());
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();
32 // static
33 gfx::Size TypeConverter<Size, gfx::Size>::ConvertTo(const Size& input) {
34 return gfx::Size(input.width(), input.height());
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();
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());
52 } // namespace mojo