egl/sfopenvg/riVGU.cpp
author Jose Thachil<jose.thachil@cell-telecom.com>
Wed, 12 May 2010 11:20:41 +0100
branchEGL_MERGE
changeset 57 2bf8a359aa2f
permissions -rw-r--r--
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg Subject to some fixes in uiresources and uiaccelerator, this version removes the EGL 1 panics. A quick attempt to use the compositor renderstage wasn't successful, but not apparently due to EGL issues. There are a lot of RDebug::Printf statements still in this code, which will be removed in the next commit.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     1
/*------------------------------------------------------------------------
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     2
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     3
 * VGU library for OpenVG 1.1 Reference Implementation
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     4
 * ---------------------------------------------------
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     5
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     6
 * Copyright (c) 2007 The Khronos Group Inc.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     7
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     8
 * Permission is hereby granted, free of charge, to any person obtaining a
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     9
 * copy of this software and /or associated documentation files
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    10
 * (the "Materials "), to deal in the Materials without restriction,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    11
 * including without limitation the rights to use, copy, modify, merge,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    12
 * publish, distribute, sublicense, and/or sell copies of the Materials,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    13
 * and to permit persons to whom the Materials are furnished to do so,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    14
 * subject to the following conditions: 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    15
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    16
 * The above copyright notice and this permission notice shall be included 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    17
 * in all copies or substantial portions of the Materials. 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    18
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    19
 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    20
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    21
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    22
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    23
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    24
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    25
 * THE USE OR OTHER DEALINGS IN THE MATERIALS.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    26
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    27
 *//**
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    28
 * \file
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    29
 * \brief	Implementation of the VGU utility library for OpenVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    30
 *//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    31
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    32
#include "vgu.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    33
#include "openvg.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    34
#include "riMath.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    35
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    36
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    37
#include "vguinternal.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    38
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    39
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    40
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    41
#include "openvginternal.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    42
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    43
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    44
using namespace OpenVGRI;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    45
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    46
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    47
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    48
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    49
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    50
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    51
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    52
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    53
static void append(VGPath path, int numSegments, const VGubyte* segments, int numCoordinates, const VGfloat* coordinates)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    54
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    55
	RI_ASSERT(numCoordinates <= 26);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    56
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    58
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    59
	VGPathDatatype datatype = (VGPathDatatype)do_vgGetParameteri(path, VG_PATH_DATATYPE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    60
	VGfloat scale = do_vgGetParameterf(path, VG_PATH_SCALE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    61
	VGfloat bias = do_vgGetParameterf(path, VG_PATH_BIAS);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    62
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    63
	VGPathDatatype datatype = (VGPathDatatype)vgGetParameteri(path, VG_PATH_DATATYPE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    64
	VGfloat scale = vgGetParameterf(path, VG_PATH_SCALE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    65
	VGfloat bias = vgGetParameterf(path, VG_PATH_BIAS);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    66
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    67
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    68
	switch(datatype)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    69
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    70
	case VG_PATH_DATATYPE_S_8:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    71
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    72
		RIint8 data[26];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    73
		for(int i=0;i<numCoordinates;i++)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    74
			data[i] = (RIint8)floor((coordinates[i] - bias) / scale + 0.5f);	//add 0.5 for correct rounding
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    75
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    76
		do_vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    77
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    78
		vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    79
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    80
		break;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    81
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    82
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    83
	case VG_PATH_DATATYPE_S_16:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    84
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    85
		RIint16 data[26];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    86
		for(int i=0;i<numCoordinates;i++)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    87
			data[i] = (RIint16)floor((coordinates[i] - bias) / scale + 0.5f);	//add 0.5 for correct rounding
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    88
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    89
		do_vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    90
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    91
		vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    92
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    93
		break;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    94
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    95
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    96
	case VG_PATH_DATATYPE_S_32:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    97
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    98
		RIint32 data[26];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    99
		for(int i=0;i<numCoordinates;i++)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   100
			data[i] = (RIint32)floor((coordinates[i] - bias) / scale + 0.5f);	//add 0.5 for correct rounding
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   101
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   102
		do_vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   103
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   104
		vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   105
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   106
		break;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   107
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   108
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   109
	default:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   110
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   111
		RI_ASSERT(datatype == VG_PATH_DATATYPE_F);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   112
		RIfloat32 data[26];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   113
		for(int i=0;i<numCoordinates;i++)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   114
			data[i] = (RIfloat32)((coordinates[i] - bias) / scale);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   115
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   116
		do_vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   117
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   118
		vgAppendPathData(path, numSegments, segments, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   119
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   120
		break;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   121
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   122
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   123
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   124
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   125
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   126
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   127
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   128
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   129
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   130
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   131
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   132
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   133
VGUErrorCode RI_APIENTRY do_vguLine(VGPath path, VGfloat x0, VGfloat y0, VGfloat x1, VGfloat y1)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   134
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   135
VGUErrorCode RI_APIENTRY vguLine(VGPath path, VGfloat x0, VGfloat y0, VGfloat x1, VGfloat y1)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   136
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   137
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   138
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   139
		VGErrorCode error = do_vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   140
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   141
		VGErrorCode error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   142
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   143
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   144
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   145
	static const VGubyte segments[2] = {VG_MOVE_TO | VG_ABSOLUTE, VG_LINE_TO | VG_ABSOLUTE};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   146
	const VGfloat data[4] = {x0, y0, x1, y1};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   147
	append(path, 2, segments, 4, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   148
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   149
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   150
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   151
		error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   152
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   153
		error = vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   154
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   155
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   156
	if(error == VG_BAD_HANDLE_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   157
		return VGU_BAD_HANDLE_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   158
	else if(error == VG_PATH_CAPABILITY_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   159
		return VGU_PATH_CAPABILITY_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   160
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   161
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   162
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   163
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   164
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   165
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   166
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   167
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   168
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   169
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   170
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   171
VGUErrorCode RI_APIENTRY do_vguPolygon(VGPath path, const VGfloat * points, VGint count, VGboolean closed)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   172
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   173
VGUErrorCode RI_APIENTRY vguPolygon(VGPath path, const VGfloat * points, VGint count, VGboolean closed)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   174
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   175
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   176
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   177
		VGErrorCode error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   178
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   179
		VGErrorCode error = vgGetError();	//clear the error state	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   180
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   181
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   182
	if(!points || (((RIuintptr)points) & 3) || count <= 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   183
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   184
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   185
	VGubyte segments[1] = {VG_MOVE_TO | VG_ABSOLUTE};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   186
	VGfloat data[2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   187
	for(int i=0;i<count;i++)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   188
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   189
		data[0] = points[i*2+0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   190
		data[1] = points[i*2+1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   191
		append(path, 1, segments, 2, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   192
		segments[0] = VG_LINE_TO | VG_ABSOLUTE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   193
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   194
	if(closed)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   195
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   196
		segments[0] = VG_CLOSE_PATH;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   197
		append(path, 1, segments, 0, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   198
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   199
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   200
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   201
		error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   202
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   203
		error = vgGetError();	//clear the error state	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   204
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   205
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   206
	if(error == VG_BAD_HANDLE_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   207
		return VGU_BAD_HANDLE_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   208
	else if(error == VG_PATH_CAPABILITY_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   209
		return VGU_PATH_CAPABILITY_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   210
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   211
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   212
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   213
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   214
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   215
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   216
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   217
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   218
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   219
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   220
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   221
VGUErrorCode RI_APIENTRY do_vguRect(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   222
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   223
VGUErrorCode RI_APIENTRY vguRect(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   224
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   225
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   226
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   227
		VGErrorCode error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   228
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   229
		VGErrorCode error = vgGetError();	//clear the error state	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   230
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   231
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   232
	if(width <= 0 || height <= 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   233
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   234
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   235
	static const VGubyte segments[5] = {VG_MOVE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   236
										VG_HLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   237
										VG_VLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   238
										VG_HLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   239
										VG_CLOSE_PATH};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   240
	const VGfloat data[5] = {x, y, x + width, y + height, x};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   241
	append(path, 5, segments, 5, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   242
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   243
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   244
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   245
		error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   246
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   247
		error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   248
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   249
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   250
	if(error == VG_BAD_HANDLE_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   251
		return VGU_BAD_HANDLE_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   252
	else if(error == VG_PATH_CAPABILITY_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   253
		return VGU_PATH_CAPABILITY_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   254
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   255
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   256
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   257
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   258
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   259
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   260
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   261
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   262
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   263
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   264
VGUErrorCode RI_APIENTRY do_vguRoundRect(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat arcWidth, VGfloat arcHeight)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   265
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   266
VGUErrorCode RI_APIENTRY vguRoundRect(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat arcWidth, VGfloat arcHeight)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   267
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   268
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   269
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   270
		VGErrorCode error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   271
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   272
		VGErrorCode error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   273
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   274
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   275
	if(width <= 0 || height <= 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   276
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   277
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   278
	arcWidth = RI_CLAMP(arcWidth, 0.0f, width);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   279
	arcHeight = RI_CLAMP(arcHeight, 0.0f, height);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   280
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   281
	static const VGubyte segments[10] = {VG_MOVE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   282
										 VG_HLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   283
										 VG_SCCWARC_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   284
										 VG_VLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   285
										 VG_SCCWARC_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   286
										 VG_HLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   287
										 VG_SCCWARC_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   288
										 VG_VLINE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   289
										 VG_SCCWARC_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   290
										 VG_CLOSE_PATH};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   291
	const VGfloat data[26] = {x + arcWidth/2, y,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   292
							  x + width - arcWidth/2,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   293
							  arcWidth/2, arcHeight/2, 0, x + width, y + arcHeight/2,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   294
							  y + height - arcHeight/2,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   295
							  arcWidth/2, arcHeight/2, 0, x + width - arcWidth/2, y + height,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   296
							  x + arcWidth/2,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   297
							  arcWidth/2, arcHeight/2, 0, x, y + height - arcHeight/2,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   298
							  y + arcHeight/2,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   299
							  arcWidth/2, arcHeight/2, 0, x + arcWidth/2, y};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   300
	append(path, 10, segments, 26, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   301
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   302
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   303
		do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   304
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   305
		error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   306
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   307
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   308
	if(error == VG_BAD_HANDLE_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   309
		return VGU_BAD_HANDLE_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   310
	else if(error == VG_PATH_CAPABILITY_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   311
		return VGU_PATH_CAPABILITY_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   312
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   313
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   314
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   315
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   316
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   317
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   318
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   319
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   320
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   321
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   322
VGUErrorCode RI_APIENTRY do_vguEllipse(VGPath path, VGfloat cx, VGfloat cy, VGfloat width, VGfloat height)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   323
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   324
VGUErrorCode RI_APIENTRY vguEllipse(VGPath path, VGfloat cx, VGfloat cy, VGfloat width, VGfloat height)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   325
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   326
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   327
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   328
		VGErrorCode error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   329
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   330
		VGErrorCode error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   331
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   332
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   333
	if(width <= 0 || height <= 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   334
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   335
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   336
	static const VGubyte segments[4] = {VG_MOVE_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   337
										VG_SCCWARC_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   338
										VG_SCCWARC_TO | VG_ABSOLUTE,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   339
										VG_CLOSE_PATH};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   340
	const VGfloat data[12] = {cx + width/2, cy,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   341
							  width/2, height/2, 0, cx - width/2, cy,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   342
							  width/2, height/2, 0, cx + width/2, cy};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   343
	append(path, 4, segments, 12, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   344
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   345
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   346
		error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   347
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   348
		error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   349
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   350
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   351
	if(error == VG_BAD_HANDLE_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   352
		return VGU_BAD_HANDLE_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   353
	else if(error == VG_PATH_CAPABILITY_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   354
		return VGU_PATH_CAPABILITY_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   355
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   356
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   357
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   358
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   359
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   360
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   361
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   362
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   363
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   364
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   365
VGUErrorCode RI_APIENTRY do_vguArc(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat startAngle, VGfloat angleExtent, VGUArcType arcType)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   366
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   367
VGUErrorCode RI_APIENTRY vguArc(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat startAngle, VGfloat angleExtent, VGUArcType arcType)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   368
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   369
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   370
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   371
		VGErrorCode error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   372
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   373
		VGErrorCode error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   374
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   375
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   376
	if((arcType != VGU_ARC_OPEN && arcType != VGU_ARC_CHORD && arcType != VGU_ARC_PIE) || width <= 0.0f || height <= 0.0f)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   377
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   378
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   379
	startAngle = RI_DEG_TO_RAD(startAngle);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   380
	angleExtent = RI_DEG_TO_RAD(angleExtent);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   381
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   382
	VGfloat w = width/2.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   383
	VGfloat h = height/2.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   384
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   385
	VGubyte segments[1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   386
	VGfloat data[5];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   387
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   388
	segments[0] = VG_MOVE_TO | VG_ABSOLUTE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   389
	data[0] = x + w * (VGfloat)cos(startAngle);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   390
	data[1] = y + h * (VGfloat)sin(startAngle);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   391
	append(path, 1, segments, 2, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   392
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   393
	data[0] = w;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   394
	data[1] = h;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   395
	data[2] = 0.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   396
	VGfloat endAngle = startAngle + angleExtent;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   397
	if(angleExtent >= 0.0f)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   398
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   399
		segments[0] = VG_SCCWARC_TO | VG_ABSOLUTE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   400
		for(VGfloat a = startAngle + PI;a < endAngle; a += PI)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   401
		{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   402
			data[3] = x + w * (VGfloat)cos(a);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   403
			data[4] = y + h * (VGfloat)sin(a);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   404
			append(path, 1, segments, 5, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   405
		}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   406
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   407
	else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   408
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   409
		segments[0] = VG_SCWARC_TO | VG_ABSOLUTE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   410
		for(VGfloat a = startAngle - PI;a > endAngle; a -= PI)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   411
		{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   412
			data[3] = x + w * (VGfloat)cos(a);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   413
			data[4] = y + h * (VGfloat)sin(a);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   414
			append(path, 1, segments, 5, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   415
		}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   416
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   417
	data[3] = x + w * (VGfloat)cos(endAngle);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   418
	data[4] = y + h * (VGfloat)sin(endAngle);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   419
	append(path, 1, segments, 5, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   420
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   421
	if(arcType == VGU_ARC_CHORD)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   422
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   423
		segments[0] = VG_CLOSE_PATH;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   424
		append(path, 1, segments, 0, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   425
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   426
	else if(arcType == VGU_ARC_PIE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   427
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   428
		segments[0] = VG_LINE_TO | VG_ABSOLUTE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   429
		data[0] = x;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   430
		data[1] = y;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   431
		append(path, 1, segments, 2, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   432
		segments[0] = VG_CLOSE_PATH;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   433
		append(path, 1, segments, 0, data);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   434
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   435
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   436
	#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   437
		error = do_vgGetError();	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   438
	#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   439
		error = vgGetError();	//clear the error state
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   440
	#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   441
		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   442
	if(error == VG_BAD_HANDLE_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   443
		return VGU_BAD_HANDLE_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   444
	else if(error == VG_PATH_CAPABILITY_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   445
		return VGU_PATH_CAPABILITY_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   446
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   447
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   448
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   449
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   450
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   451
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   452
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   453
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   454
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   455
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   456
VGUErrorCode RI_APIENTRY do_vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, VGfloat * matrix)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   457
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   458
VGUErrorCode RI_APIENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, VGfloat * matrix)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   459
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   460
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   461
	if(!matrix || ((RIuintptr)matrix) & 3)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   462
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   463
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   464
	VGfloat mat[9];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   465
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   466
	VGUErrorCode ret = do_vguComputeWarpSquareToQuad(sx0, sy0, sx1, sy1, sx2, sy2, sx3, sy3, mat);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   467
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   468
	VGUErrorCode ret = vguComputeWarpSquareToQuad(sx0, sy0, sx1, sy1, sx2, sy2, sx3, sy3, mat);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   469
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   470
	if(ret == VGU_BAD_WARP_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   471
		return VGU_BAD_WARP_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   472
	Matrix3x3 m(mat[0], mat[3], mat[6],
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   473
				mat[1], mat[4], mat[7],
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   474
				mat[2], mat[5], mat[8]);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   475
	bool nonsingular = m.invert();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   476
	if(!nonsingular)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   477
		return VGU_BAD_WARP_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   478
	matrix[0] = m[0][0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   479
	matrix[1] = m[1][0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   480
	matrix[2] = m[2][0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   481
	matrix[3] = m[0][1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   482
	matrix[4] = m[1][1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   483
	matrix[5] = m[2][1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   484
	matrix[6] = m[0][2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   485
	matrix[7] = m[1][2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   486
	matrix[8] = m[2][2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   487
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   488
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   489
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   490
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   491
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   492
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   493
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   494
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   495
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   496
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   497
VGUErrorCode RI_APIENTRY do_vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, VGfloat * matrix)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   498
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   499
VGUErrorCode RI_APIENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, VGfloat * matrix)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   500
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   501
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   502
	if(!matrix || ((RIuintptr)matrix) & 3)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   503
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   504
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   505
	//from Heckbert:Fundamentals of Texture Mapping and Image Warping
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   506
	//Note that his mapping of vertices is different from OpenVG's
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   507
	//(0,0) => (dx0,dy0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   508
	//(1,0) => (dx1,dy1)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   509
	//(0,1) => (dx2,dy2)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   510
	//(1,1) => (dx3,dy3)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   511
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   512
	VGfloat diffx1 = dx1 - dx3;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   513
	VGfloat diffy1 = dy1 - dy3;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   514
	VGfloat diffx2 = dx2 - dx3;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   515
	VGfloat diffy2 = dy2 - dy3;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   516
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   517
	VGfloat det = diffx1*diffy2 - diffx2*diffy1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   518
	if(det == 0.0f)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   519
		return VGU_BAD_WARP_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   520
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   521
	VGfloat sumx = dx0 - dx1 + dx3 - dx2;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   522
	VGfloat sumy = dy0 - dy1 + dy3 - dy2;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   523
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   524
	if(sumx == 0.0f && sumy == 0.0f)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   525
	{	//affine mapping
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   526
		matrix[0] = dx1 - dx0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   527
		matrix[1] = dy1 - dy0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   528
		matrix[2] = 0.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   529
		matrix[3] = dx3 - dx1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   530
		matrix[4] = dy3 - dy1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   531
		matrix[5] = 0.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   532
		matrix[6] = dx0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   533
		matrix[7] = dy0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   534
		matrix[8] = 1.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   535
		return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   536
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   537
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   538
	VGfloat oodet = 1.0f / det;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   539
	VGfloat g = (sumx*diffy2 - diffx2*sumy) * oodet;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   540
	VGfloat h = (diffx1*sumy - sumx*diffy1) * oodet;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   541
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   542
	matrix[0] = dx1-dx0+g*dx1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   543
	matrix[1] = dy1-dy0+g*dy1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   544
	matrix[2] = g;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   545
	matrix[3] = dx2-dx0+h*dx2;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   546
	matrix[4] = dy2-dy0+h*dy2;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   547
	matrix[5] = h;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   548
	matrix[6] = dx0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   549
	matrix[7] = dy0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   550
	matrix[8] = 1.0f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   551
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   552
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   553
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   554
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   555
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   556
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   557
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   558
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   559
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   560
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   561
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   562
VGUErrorCode RI_APIENTRY do_vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, VGfloat * matrix)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   563
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   564
VGUErrorCode RI_APIENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, VGfloat * matrix)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   565
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   566
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   567
	if(!matrix || ((RIuintptr)matrix) & 3)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   568
		return VGU_ILLEGAL_ARGUMENT_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   569
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   570
	VGfloat qtos[9];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   571
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   572
	VGUErrorCode ret1 = do_vguComputeWarpQuadToSquare(sx0, sy0, sx1, sy1, sx2, sy2, sx3, sy3, qtos);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   573
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   574
	VGUErrorCode ret1 = vguComputeWarpQuadToSquare(sx0, sy0, sx1, sy1, sx2, sy2, sx3, sy3, qtos);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   575
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   576
	if(ret1 == VGU_BAD_WARP_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   577
		return VGU_BAD_WARP_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   578
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   579
	VGfloat stoq[9];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   580
#ifdef BUILD_WITH_PRIVATE_VGU
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   581
	VGUErrorCode ret2 = do_vguComputeWarpSquareToQuad(dx0, dy0, dx1, dy1, dx2, dy2, dx3, dy3, stoq);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   582
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   583
	VGUErrorCode ret2 = vguComputeWarpSquareToQuad(dx0, dy0, dx1, dy1, dx2, dy2, dx3, dy3, stoq);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   584
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   585
	if(ret2 == VGU_BAD_WARP_ERROR)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   586
		return VGU_BAD_WARP_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   587
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   588
	Matrix3x3 m1(qtos[0], qtos[3], qtos[6],
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   589
				 qtos[1], qtos[4], qtos[7],
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   590
				 qtos[2], qtos[5], qtos[8]);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   591
	Matrix3x3 m2(stoq[0], stoq[3], stoq[6],
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   592
				 stoq[1], stoq[4], stoq[7],
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   593
				 stoq[2], stoq[5], stoq[8]);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   594
	Matrix3x3 r = m2 * m1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   595
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   596
	matrix[0] = r[0][0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   597
	matrix[1] = r[1][0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   598
	matrix[2] = r[2][0];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   599
	matrix[3] = r[0][1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   600
	matrix[4] = r[1][1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   601
	matrix[5] = r[2][1];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   602
	matrix[6] = r[0][2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   603
	matrix[7] = r[1][2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   604
	matrix[8] = r[2][2];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   605
	return VGU_NO_ERROR;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   606
}