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 */ 5 6 /* From pp_rect.idl modified Wed Oct 5 14:06:02 2011. */ 7 8 #ifndef PPAPI_C_PP_RECT_H_ 9 #define PPAPI_C_PP_RECT_H_ 10 11 #include "ppapi/c/pp_macros.h" 12 #include "ppapi/c/pp_point.h" 13 #include "ppapi/c/pp_size.h" 14 #include "ppapi/c/pp_stdint.h" 15 16 /** 17 * @file 18 * This file defines the APIs for creating a 2 dimensional rectangle. 19 */ 20 21 22 /** 23 * @addtogroup Structs 24 * @{ 25 */ 26 /** 27 * The <code>PP_Rect</code> struct contains the size and location of a 2D 28 * rectangle. 29 */ 30 struct PP_Rect { 31 /** 32 * This value represents the x and y coordinates of the upper-left corner of 33 * the rectangle. 34 */ 35 struct PP_Point point; 36 /** This value represents the width and height of the rectangle. */ 37 struct PP_Size size; 38 }; 39 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Rect, 16); 40 /** 41 * @} 42 */ 43 44 45 /** 46 * @addtogroup Functions 47 * @{ 48 */ 49 50 /** 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 * 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. 60 * 61 * @return A <code>PP_Rect</code> structure. 62 */ 63 PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y, 64 int32_t w, int32_t h) { 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 } 72 /** 73 * @} 74 */ 75 76 #endif /* PPAPI_C_PP_RECT_H_ */ 77 78