[email protected] | 25651387 | 2012-01-05 15:41:52 | [diff] [blame] | 1 | /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 6ea6954 | 2010-12-20 18:15:59 | [diff] [blame] | 2 | * Use of this source code is governed by a BSD-style license that can be |
3 | * found in the LICENSE file. | ||||
4 | */ | ||||
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 5 | |
[email protected] | 25651387 | 2012-01-05 15:41:52 | [diff] [blame] | 6 | /* From pp_point.idl modified Wed Oct 5 14:06:02 2011. */ |
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 7 | |
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 8 | #ifndef PPAPI_C_PP_POINT_H_ |
9 | #define PPAPI_C_PP_POINT_H_ | ||||
10 | |||||
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 11 | #include "ppapi/c/pp_macros.h" |
12 | #include "ppapi/c/pp_stdint.h" | ||||
13 | |||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 14 | /** |
15 | * @file | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 16 | * This file defines the API to create a 2 dimensional point. |
17 | * 0,0 is the upper-left starting coordinate. | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 18 | */ |
19 | |||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 20 | |
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 21 | /** |
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 22 | * @addtogroup Structs |
23 | * @{ | ||||
24 | */ | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 25 | /** |
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 26 | * The PP_Point structure defines the integer x and y coordinates of a point. |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 27 | */ |
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 28 | struct PP_Point { |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 29 | /** |
30 | * This value represents the horizontal coordinate of a point, starting with 0 | ||||
31 | * as the left-most coordinate. | ||||
32 | */ | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 33 | int32_t x; |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 34 | /** |
35 | * This value represents the vertical coordinate of a point, starting with 0 | ||||
36 | * as the top-most coordinate. | ||||
37 | */ | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 38 | int32_t y; |
39 | }; | ||||
[email protected] | 1ad2a1db | 2010-12-13 20:04:31 | [diff] [blame] | 40 | PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Point, 8); |
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 41 | |
42 | /** | ||||
43 | * The PP_FloatPoint structure defines the floating-point x and y coordinates | ||||
44 | * of a point. | ||||
45 | */ | ||||
46 | struct PP_FloatPoint { | ||||
47 | float x; | ||||
48 | float y; | ||||
49 | }; | ||||
50 | PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FloatPoint, 8); | ||||
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 51 | /** |
52 | * @} | ||||
53 | */ | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 54 | |
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 55 | /** |
56 | * @addtogroup Functions | ||||
57 | * @{ | ||||
58 | */ | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 59 | |
60 | /** | ||||
[email protected] | c549595 | 2011-06-30 22:57:17 | [diff] [blame] | 61 | * PP_MakePoint() creates a <code>PP_Point</code> given the x and y coordinates |
62 | * as int32_t values. | ||||
[email protected] | b6cf768 | 2011-08-12 15:59:49 | [diff] [blame] | 63 | * |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 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. | ||||
[email protected] | b6cf768 | 2011-08-12 15:59:49 | [diff] [blame] | 68 | * |
[email protected] | c549595 | 2011-06-30 22:57:17 | [diff] [blame] | 69 | * @return A <code>PP_Point</code> structure. |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 70 | */ |
[email protected] | 6f2e391 | 2010-11-05 14:45:44 | [diff] [blame] | 71 | PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) { |
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 72 | struct PP_Point ret; |
73 | ret.x = x; | ||||
74 | ret.y = y; | ||||
75 | return ret; | ||||
76 | } | ||||
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 77 | |
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; | ||||
83 | } | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 84 | /** |
85 | * @} | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 86 | */ |
87 | |||||
[email protected] | 6ea6954 | 2010-12-20 18:15:59 | [diff] [blame] | 88 | #endif /* PPAPI_C_PP_POINT_H_ */ |
89 |