content/gpu: Ownership and lifetime cleanup for CommandBufferProxyImpl.
[chromium-blink-merge.git] / content / renderer / pepper / gfx_conversion.h
blob1fe529be63a260eabe31ee852de6b7f4e89e1a71
1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_PEPPER_GFX_CONVERSION_H_
6 #define CONTENT_RENDERER_PEPPER_GFX_CONVERSION_H_
8 #include "ppapi/c/pp_point.h"
9 #include "ppapi/c/pp_rect.h"
10 #include "ppapi/c/pp_size.h"
11 #include "ui/gfx/geometry/point.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/rect_f.h"
14 #include "ui/gfx/geometry/size.h"
16 // Conversions for graphics types between our gfx library and PPAPI.
17 // The style of naming is to match the PP_Bool conversions.
19 namespace content {
21 inline gfx::Point PP_ToGfxPoint(const PP_Point& p) {
22 return gfx::Point(p.x, p.y);
25 inline PP_Point PP_FromGfxPoint(const gfx::Point& p) {
26 return PP_MakePoint(p.x(), p.y());
29 inline gfx::Rect PP_ToGfxRect(const PP_Rect& r) {
30 return gfx::Rect(r.point.x, r.point.y, r.size.width, r.size.height);
33 inline gfx::RectF PP_ToGfxRectF(const PP_FloatRect& r) {
34 return gfx::RectF(r.point.x, r.point.y, r.size.width, r.size.height);
37 inline PP_Rect PP_FromGfxRect(const gfx::Rect& r) {
38 return PP_MakeRectFromXYWH(r.x(), r.y(), r.width(), r.height());
41 inline gfx::Size PP_ToGfxSize(const PP_Size& s) {
42 return gfx::Size(s.width, s.height);
45 inline PP_Size PP_FromGfxSize(const gfx::Size& s) {
46 return PP_MakeSize(s.width(), s.height());
49 } // namespace content
51 #endif // CONTENT_RENDERER_PEPPER_GFX_CONVERSION_H_