os/graphics/graphicscomposition/openwfcompositionengine/common/include/owftypes.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /* Copyright (c) 2009 The Khronos Group Inc.
     2  * Portions copyright (c) 2009-2010  Nokia Corporation and/or its subsidiary(-ies)
     3  *
     4  * Permission is hereby granted, free of charge, to any person obtaining a
     5  * copy of this software and/or associated documentation files (the
     6  * "Materials"), to deal in the Materials without restriction, including
     7  * without limitation the rights to use, copy, modify, merge, publish,
     8  * distribute, sublicense, and/or sell copies of the Materials, and to
     9  * permit persons to whom the Materials are furnished to do so, subject to
    10  * the following conditions:
    11  *
    12  * The above copyright notice and this permission notice shall be included
    13  * in all copies or substantial portions of the Materials.
    14  *
    15  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    21  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    22  */
    23 
    24 #ifndef _OWFTYPES_H_
    25 #define _OWFTYPES_H_
    26 
    27 #include "KHR/khrplatform.h"
    28 
    29 #ifdef __cplusplus
    30 extern "C" {
    31 #endif
    32 
    33 typedef khronos_int8_t      OWFint8;
    34 typedef khronos_int16_t     OWFint16;
    35 typedef khronos_int32_t     OWFint32;
    36 typedef khronos_int32_t     OWFint;
    37 typedef khronos_uint8_t     OWFuint8;
    38 typedef khronos_uint16_t    OWFuint16;
    39 typedef khronos_uint32_t    OWFuint32;
    40 typedef khronos_uint32_t    OWFuint;
    41 typedef khronos_float_t     OWFfloat;
    42 
    43 typedef khronos_utime_nanoseconds_t OWFtime;
    44 
    45 typedef OWFuint32 OWFHandle;
    46 
    47 #define OWF_FOREVER (0xFFFFFFFFFFFFFFFFull)
    48 #define OWF_INVALID_HANDLE ((OWFHandle)0)
    49 
    50 
    51 /* Used for Function Prototypes */
    52 /*! \brief OWF_API_CALL definition can be used to restrict
    53  *  visibility of symbols
    54  */
    55 
    56 #ifndef OWF_API_CALL
    57 #define OWF_API_CALL
    58 #define OWF_PUBLIC
    59 #endif
    60 #ifndef OWF_APIENTRY
    61 #define OWF_APIENTRY
    62 #endif
    63 #ifndef OWF_APIEXIT
    64 #define OWF_APIEXIT
    65 #endif
    66 /* supported external image formats */
    67 typedef enum {
    68     OWF_IMAGE_NOT_SUPPORTED = 0,
    69     OWF_IMAGE_ARGB8888      = 0x8888,
    70     OWF_IMAGE_XRGB8888      = 0xf888,
    71     OWF_IMAGE_RGB888        = 0x888,
    72     OWF_IMAGE_RGB565        = 0x565,
    73     OWF_IMAGE_L32           = 0xA32,
    74     OWF_IMAGE_L16           = 0xA16,
    75     OWF_IMAGE_L8            = 0xA8,
    76     OWF_IMAGE_L1            = 0xA1,
    77     OWF_IMAGE_ARGB_INTERNAL = 0x666 /* OWFpixel rep */
    78 } OWF_PIXEL_FORMAT;
    79 
    80 typedef enum {
    81     OWF_FALSE               = KHR_BOOLEAN_FALSE,
    82     OWF_TRUE                = KHR_BOOLEAN_TRUE
    83 } OWFboolean;
    84 
    85 typedef struct {
    86     OWF_PIXEL_FORMAT        pixelFormat;
    87     OWFboolean              linear;
    88     OWFboolean              premultiplied;
    89     OWFint                  rowPadding; /* row alignment, in bytes */
    90 } OWF_IMAGE_FORMAT;
    91 
    92 typedef struct {
    93     OWFint                  x;
    94     OWFint                  y;
    95     OWFint                  width;
    96     OWFint                  height;
    97 } OWF_RECTANGLE;
    98 
    99 
   100 #define MIN(a,b)            ((a)<(b)?(a):(b))
   101 #define MAX(a,b)            ((a)>(b)?(a):(b))
   102 #define CLAMP(x,a,b)        MAX(a,MIN(x,b))
   103 #define INRANGE(x,a,b)      ((x) >= (a) && (x) <= (b))
   104 
   105 typedef void*               OWF_MUTEX;
   106 typedef void*               OWF_SEMAPHORE;
   107 
   108 typedef struct OWF_NODE_
   109 {
   110     void*                   data;
   111     struct OWF_NODE_*       next;
   112 } OWF_NODE;
   113 
   114 typedef OWFint (*NODECMPFUNC)(void*, void*);
   115 typedef OWFint (*NODEITERFUNC)(void*, void*);
   116 
   117 typedef OWFHandle           OWFNativeStreamType;
   118 typedef OWFint              OWFNativeStreamBuffer;
   119 
   120 /*!
   121  *  Events emitted by native streams.
   122  */
   123 
   124 typedef struct{
   125     TInt32      length;
   126     TInt32      event;
   127 } OWF_DEFAULT_EVENT_PARAM;
   128 
   129 #define ALPHA_MASK          0xFF000000
   130 #define RED_MASK            0xFF0000
   131 #define GREEN_MASK          0xFF00
   132 #define BLUE_MASK           0xFF
   133 
   134 /*! Native stream callback function type */
   135 typedef void (*OWFStreamCallback)( OWFNativeStreamType,
   136                                    OWFint,
   137                                    void*,
   138                                    void*);
   139 
   140 typedef struct
   141 {
   142     OWFStreamCallback       callback;
   143     void*                   data;
   144 } OWFStreamCallbackData;
   145 
   146 #define OWF_SUPPORTED_DEVICE_ID 1
   147 #define OWF_RESERVED_BAD_SCREEN_NUMBER (-1)  
   148 
   149 #ifdef __cplusplus
   150 }
   151 #endif
   152 
   153 #endif /* _OWFTYPES_H_ */