[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_rect.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_RECT_H_ |
9 | #define PPAPI_C_PP_RECT_H_ | ||||
10 | |||||
[email protected] | 6f2e391 | 2010-11-05 14:45:44 | [diff] [blame] | 11 | #include "ppapi/c/pp_macros.h" |
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 12 | #include "ppapi/c/pp_point.h" |
13 | #include "ppapi/c/pp_size.h" | ||||
14 | #include "ppapi/c/pp_stdint.h" | ||||
15 | |||||
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 16 | /** |
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 17 | * @file |
18 | * This file defines the APIs for creating a 2 dimensional rectangle. | ||||
19 | */ | ||||
20 | |||||
21 | |||||
22 | /** | ||||
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 23 | * @addtogroup Structs |
24 | * @{ | ||||
25 | */ | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 26 | /** |
[email protected] | c549595 | 2011-06-30 22:57:17 | [diff] [blame] | 27 | * The <code>PP_Rect</code> struct contains the size and location of a 2D |
28 | * rectangle. | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 29 | */ |
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 30 | struct PP_Rect { |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 31 | /** |
32 | * This value represents the x and y coordinates of the upper-left corner of | ||||
33 | * the rectangle. | ||||
34 | */ | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 35 | struct PP_Point point; |
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 36 | /** This value represents the width and height of the rectangle. */ |
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 37 | struct PP_Size size; |
38 | }; | ||||
[email protected] | 1ad2a1db | 2010-12-13 20:04:31 | [diff] [blame] | 39 | PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Rect, 16); |
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 40 | /** |
41 | * @} | ||||
42 | */ | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 43 | |
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 44 | |
[email protected] | 040d5e8 | 2011-01-28 15:38:38 | [diff] [blame] | 45 | /** |
46 | * @addtogroup Functions | ||||
47 | * @{ | ||||
48 | */ | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 49 | |
50 | /** | ||||
[email protected] | c549595 | 2011-06-30 22:57:17 | [diff] [blame] | 51 | * PP_MakeRectFromXYWH() creates a <code>PP_Rect</code> given x and y |
52 | * coordinates and width and height dimensions as int32_t values. | ||||
53 | * | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 54 | * @param[in] x An int32_t value representing a horizontal coordinate of a |
55 | * point, starting with 0 as the left-most coordinate. | ||||
56 | * @param[in] y An int32_t value representing a vertical coordinate of a point, | ||||
57 | * starting with 0 as the top-most coordinate. | ||||
58 | * @param[in] w An int32_t value representing a width. | ||||
59 | * @param[in] h An int32_t value representing a height. | ||||
[email protected] | c549595 | 2011-06-30 22:57:17 | [diff] [blame] | 60 | * |
61 | * @return A <code>PP_Rect</code> structure. | ||||
[email protected] | 590872fa | 2011-02-03 22:47:09 | [diff] [blame] | 62 | */ |
[email protected] | 6f2e391 | 2010-11-05 14:45:44 | [diff] [blame] | 63 | PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y, |
64 | int32_t w, int32_t h) { | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 65 | struct PP_Rect ret; |
66 | ret.point.x = x; | ||||
67 | ret.point.y = y; | ||||
68 | ret.size.width = w; | ||||
69 | ret.size.height = h; | ||||
70 | return ret; | ||||
71 | } | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 72 | /** |
73 | * @} | ||||
[email protected] | 1758e88 | 2010-11-01 16:16:50 | [diff] [blame] | 74 | */ |
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 75 | |
[email protected] | 6ea6954 | 2010-12-20 18:15:59 | [diff] [blame] | 76 | #endif /* PPAPI_C_PP_RECT_H_ */ |
77 |