Home | History | Annotate | Download | only in api
      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 /**
      7  * This file defines the API to create a 2 dimensional point.
      8  * 0,0 is the upper-left starting coordinate.
      9  */
     10 
     11 /**
     12  * The PP_Point structure defines the integer x and y coordinates of a point.
     13  */
     14 [assert_size(8), returnByValue]
     15 struct PP_Point {
     16   /**
     17    * This value represents the horizontal coordinate of a point, starting with 0
     18    * as the left-most coordinate.
     19    */
     20   int32_t x;
     21 
     22   /**
     23    * This value represents the vertical coordinate of a point, starting with 0
     24    * as the top-most coordinate.
     25    */
     26   int32_t y;
     27 };
     28 
     29 /**
     30  * The PP_FloatPoint structure defines the floating-point x and y coordinates
     31  * of a point.
     32  */
     33 [assert_size(8), returnByValue]
     34 struct PP_FloatPoint {
     35   float_t x;
     36   float_t y;
     37 };
     38 
     39 #inline c
     40 /**
     41  * @addtogroup Functions
     42  * @{
     43  */
     44 
     45 /**
     46  * PP_MakePoint() creates a <code>PP_Point</code> given the x and y coordinates
     47  * as int32_t values.
     48  *
     49  * @param[in] x An int32_t value representing a horizontal coordinate of a
     50  * point, starting with 0 as the left-most coordinate.
     51  * @param[in] y An int32_t value representing a vertical coordinate of a point,
     52  * starting with 0 as the top-most coordinate.
     53  *
     54  * @return A <code>PP_Point</code> structure.
     55  */
     56 PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) {
     57   struct PP_Point ret;
     58   ret.x = x;
     59   ret.y = y;
     60   return ret;
     61 }
     62 
     63 PP_INLINE struct PP_FloatPoint PP_MakeFloatPoint(float x, float y) {
     64   struct PP_FloatPoint ret;
     65   ret.x = x;
     66   ret.y = y;
     67   return ret;
     68 }
     69 /**
     70  * @}
     71  */
     72 
     73 #endinl
     74 
     75