Roll src/third_party/WebKit 06cb9e9:a978ee5 (svn 202558:202559)
[chromium-blink-merge.git] / ppapi / c / pp_point.h
blob39dcda99309048b0eabcebcc91de54517b5ada34
1 /* Copyright (c) 2012 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 */
6 /* From pp_point.idl modified Wed Oct 5 14:06:02 2011. */
8 #ifndef PPAPI_C_PP_POINT_H_
9 #define PPAPI_C_PP_POINT_H_
11 #include "ppapi/c/pp_macros.h"
12 #include "ppapi/c/pp_stdint.h"
14 /**
15 * @file
16 * This file defines the API to create a 2 dimensional point.
17 * 0,0 is the upper-left starting coordinate.
21 /**
22 * @addtogroup Structs
23 * @{
25 /**
26 * The PP_Point structure defines the integer x and y coordinates of a point.
28 struct PP_Point {
29 /**
30 * This value represents the horizontal coordinate of a point, starting with 0
31 * as the left-most coordinate.
33 int32_t x;
34 /**
35 * This value represents the vertical coordinate of a point, starting with 0
36 * as the top-most coordinate.
38 int32_t y;
40 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Point, 8);
42 /**
43 * The PP_FloatPoint structure defines the floating-point x and y coordinates
44 * of a point.
46 struct PP_FloatPoint {
47 float x;
48 float y;
50 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FloatPoint, 8);
51 /**
52 * @}
55 /**
56 * @addtogroup Functions
57 * @{
60 /**
61 * PP_MakePoint() creates a <code>PP_Point</code> given the x and y coordinates
62 * as int32_t values.
64 * @param[in] x An int32_t value representing a horizontal coordinate of a
65 * point, starting with 0 as the left-most coordinate.
66 * @param[in] y An int32_t value representing a vertical coordinate of a point,
67 * starting with 0 as the top-most coordinate.
69 * @return A <code>PP_Point</code> structure.
71 PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) {
72 struct PP_Point ret;
73 ret.x = x;
74 ret.y = y;
75 return ret;
78 PP_INLINE struct PP_FloatPoint PP_MakeFloatPoint(float x, float y) {
79 struct PP_FloatPoint ret;
80 ret.x = x;
81 ret.y = y;
82 return ret;
84 /**
85 * @}
88 #endif /* PPAPI_C_PP_POINT_H_ */