guestrendering/guestopenvgu/src/openvgu.cpp
branchbug235_bringup_0
changeset 15 86401090b67f
child 24 a3f46bb01be2
equal deleted inserted replaced
14:acbd4400e82b 15:86401090b67f
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation of OpenVGU stub functions
       
    15 
       
    16 #include "vghwutils.h"
       
    17 
       
    18 #define __VG_OPENVG_H_
       
    19 #include <VG/1.1/openvg.h>
       
    20 
       
    21 #include "openvgrfc.h"
       
    22 
       
    23 class RemoteFunctionCall;
       
    24 
       
    25 // tracing
       
    26 #ifdef _DEBUG
       
    27 	#include <e32debug.h>
       
    28     #define OPENVGU_TRACE(fmt, args...) RDebug::Printf(fmt, ##args)
       
    29 #else
       
    30     #define OPENVGU_TRACE(fmt, args...)
       
    31 #endif
       
    32 
       
    33 
       
    34 extern "C" {
       
    35 /*
       
    36  Note: Comments at the start of each Open VG api are adapted from the Open VG 1.1 specification.
       
    37  The text has been chosen/adapted to give a helpful overview of the function, and the errors
       
    38  that it may generate.  For more details and diagrams see the full Open VG specification.
       
    39  */
       
    40 
       
    41 
       
    42 /*
       
    43  Append a line segment to a path.
       
    44 
       
    45  ERRORS
       
    46    VGU_BAD_HANDLE_ERROR
       
    47    – if path is not a valid path handle, or is not shared with the current context
       
    48    VGU_PATH_CAPABILITY_ERROR
       
    49    – if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path
       
    50  */
       
    51 EXPORT_C VGUErrorCode
       
    52      vguLine(VGPath path,
       
    53         VGfloat x0, VGfloat y0,
       
    54         VGfloat x1, VGfloat y1)
       
    55     {
       
    56 	OPENVGU_TRACE("vguLine path=%d x0=0x%x, y0=0x%x, x1=0x%x, y1=0x%x", path, x0, y0, x1, y1);
       
    57 
       
    58 	MVgContext* vgContext = CVghwUtils::VgContext();
       
    59 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
    60 	if (vgContext)
       
    61 		{
       
    62 		RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
    63 		vguApiData.Init(OpenVgRFC::EvguLine);
       
    64 		vguApiData.AppendParam(path);
       
    65 		vguApiData.AppendParam(x0);
       
    66 		vguApiData.AppendParam(y0);
       
    67 		vguApiData.AppendParam(x1);
       
    68 		vguApiData.AppendParam(y1);
       
    69 		// TODO return type specific functions for VGU operations
       
    70 		vgContext->ExecuteVgCommand(vguApiData);
       
    71 		error = (VGUErrorCode)vguApiData.ReturnValue();
       
    72 		}
       
    73 	return error;
       
    74     }
       
    75 
       
    76 /*
       
    77  Append a polyline (connected sequence of line segments) or polygon to a path.
       
    78 
       
    79  ERRORS
       
    80    VGU_BAD_HANDLE_ERROR
       
    81    – if path is not a valid path handle, or is not shared with the current context
       
    82    VGU_PATH_CAPABILITY_ERROR
       
    83    – if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path
       
    84    VGU_ILLEGAL_ARGUMENT_ERROR
       
    85    – if points is NULL
       
    86    – if points is not properly aligned
       
    87    – if count is less than or equal to 0
       
    88  */
       
    89 EXPORT_C VGUErrorCode
       
    90      vguPolygon(VGPath path,
       
    91         const VGfloat * points,
       
    92         VGint count,
       
    93         VGboolean closed)
       
    94     {
       
    95 	OPENVGU_TRACE("vguPolygon path=%d, points=0x%x, count=%d, closed=%d", path, points, count, closed);
       
    96 
       
    97 	MVgContext* vgContext = CVghwUtils::VgContext();
       
    98 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
    99 	if (vgContext)
       
   100 		{
       
   101 		if ( (points == NULL) || (count <= 0) || (3ul & (unsigned)points) )
       
   102 			{
       
   103 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   104 			}
       
   105 		else
       
   106 			{
       
   107 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   108 			vguApiData.Init(OpenVgRFC::EvguPolygon);
       
   109 			vguApiData.AppendParam(path);
       
   110 			vguApiData.AppendParam(count);
       
   111 			vguApiData.AppendParam(closed);
       
   112 			vguApiData.AppendVector(points, count * 2);
       
   113 
       
   114 			vgContext->ExecuteVgCommand(vguApiData);
       
   115 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   116 			}
       
   117 		}
       
   118 	return error;
       
   119     }
       
   120 
       
   121 /*
       
   122  Append an axis-aligned rectangle with its lower-left corner at (x, y) and
       
   123  a given width and height to a path.
       
   124 
       
   125  ERRORS
       
   126    VGU_BAD_HANDLE_ERROR
       
   127    – if path is not a valid path handle, or is not shared with the current context
       
   128    VGU_PATH_CAPABILITY_ERROR
       
   129    – if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path
       
   130    VGU_ILLEGAL_ARGUMENT_ERROR
       
   131    – if width or height are less than or equal to 0
       
   132  */
       
   133 EXPORT_C VGUErrorCode
       
   134      vguRect(VGPath path,
       
   135         VGfloat x, VGfloat y,
       
   136         VGfloat width, VGfloat height)
       
   137     {
       
   138 	OPENVGU_TRACE("vguRect path=%d, x=0x%x, y=0x%x, width=0x%x, height=0x%x", path, x, y, width, height);
       
   139 
       
   140 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   141 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   142 	if (vgContext)
       
   143 		{
       
   144 		if ( (width <= 0) || (height <= 0) )
       
   145 			{
       
   146 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   147 			}
       
   148 		else
       
   149 			{
       
   150 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   151 			vguApiData.Init(OpenVgRFC::EvguRect);
       
   152 			vguApiData.AppendParam(path);
       
   153 			vguApiData.AppendParam(x);
       
   154 			vguApiData.AppendParam(y);
       
   155 			vguApiData.AppendParam(width);
       
   156 			vguApiData.AppendParam(height);
       
   157 
       
   158 			vgContext->ExecuteVgCommand(vguApiData);
       
   159 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   160 			}
       
   161 		}
       
   162 	return error;
       
   163     }
       
   164 
       
   165 /*
       
   166  Append an axis-aligned round-cornered rectangle with the lower-left corner of
       
   167  its rectangular bounding box at (x, y) and a given width, height, arcWidth,
       
   168  and arcHeight to a path.
       
   169 
       
   170  ERRORS
       
   171    VGU_BAD_HANDLE_ERROR
       
   172    – if path is not a valid path handle, or is not shared with the current context
       
   173    VGU_PATH_CAPABILITY_ERROR
       
   174    – if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path
       
   175    VGU_ILLEGAL_ARGUMENT_ERROR
       
   176    – if width or height is less than or equal to 0
       
   177  */
       
   178 EXPORT_C VGUErrorCode
       
   179      vguRoundRect(VGPath path,
       
   180         VGfloat x, VGfloat y,
       
   181         VGfloat width,
       
   182         VGfloat height,
       
   183         VGfloat arcWidth,
       
   184         VGfloat arcHeight)
       
   185     {
       
   186 	OPENVGU_TRACE("vguRoundRect path=%d, x=0x%x, y=0x%x, width=0x%x, height=0x%x, arcWidth=0x%x, arcHeight=0x%x",
       
   187 			path, x, y, width, height, arcWidth, arcHeight);
       
   188 
       
   189 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   190 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   191 	if (vgContext)
       
   192 		{
       
   193 		if ( (width <= 0) || (height <= 0) )
       
   194 			{
       
   195 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   196 			}
       
   197 		else
       
   198 			{
       
   199 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   200 			vguApiData.Init(OpenVgRFC::EvguRoundRect);
       
   201 			vguApiData.AppendParam(path);
       
   202 			vguApiData.AppendParam(x);
       
   203 			vguApiData.AppendParam(y);
       
   204 			vguApiData.AppendParam(width);
       
   205 			vguApiData.AppendParam(height);
       
   206 			vguApiData.AppendParam(arcWidth);
       
   207 			vguApiData.AppendParam(arcHeight);
       
   208 
       
   209 			vgContext->ExecuteVgCommand(vguApiData);
       
   210 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   211 			}
       
   212 		}
       
   213 	return error;
       
   214     }
       
   215 
       
   216 /*
       
   217  Append an axis-aligned ellipse to a path. The center of the ellipse is given by
       
   218  (cx, cy) and the dimensions of the axis-aligned rectangle enclosing the ellipse are
       
   219  given by width and height. The ellipse begins at (cx + width/2, cy) and is stroked
       
   220  as two equal counter-clockwise arcs.
       
   221 
       
   222  ERRORS
       
   223    VGU_BAD_HANDLE_ERROR
       
   224    – if path is not a valid path handle, or is not shared with the current context
       
   225    VGU_PATH_CAPABILITY_ERROR
       
   226    – if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path
       
   227    VGU_ILLEGAL_ARGUMENT_ERROR
       
   228    – if width or height is less than or equal to 0
       
   229  */
       
   230 EXPORT_C VGUErrorCode
       
   231      vguEllipse(VGPath path,
       
   232         VGfloat cx, VGfloat cy,
       
   233         VGfloat width,
       
   234         VGfloat height)
       
   235     {
       
   236 	OPENVGU_TRACE("vguEllipse path=%d, cx=0x%x, cy=0x%x, width=0x%x, height=0x%x", path, cx, cy, width, height);
       
   237 
       
   238 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   239 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   240 	if (vgContext)
       
   241 		{
       
   242 		if ( (width <= 0) || (height <= 0) )
       
   243 			{
       
   244 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   245 			}
       
   246 		else
       
   247 			{
       
   248 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   249 			vguApiData.Init(OpenVgRFC::EvguEllipse);
       
   250 			vguApiData.AppendParam(path);
       
   251 			vguApiData.AppendParam(cx);
       
   252 			vguApiData.AppendParam(cy);
       
   253 			vguApiData.AppendParam(width);
       
   254 			vguApiData.AppendParam(height);
       
   255 
       
   256 			vgContext->ExecuteVgCommand(vguApiData);
       
   257 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   258 			}
       
   259 		}
       
   260 	return error;
       
   261     }
       
   262 
       
   263 /*
       
   264  Append an elliptical arc to a path, possibly along with one or two line segments,
       
   265  according to the arcType parameter. The startAngle and angleExtent parameters are
       
   266  given in degrees, proceeding counter-clockwise from the positive X axis. The arc
       
   267  is defined on the unit circle, then scaled by the width and height of the ellipse.
       
   268 
       
   269  ERRORS
       
   270    VGU_BAD_HANDLE_ERROR
       
   271    – if path is not a valid path handle, or is not shared with the current context
       
   272    VGU_PATH_CAPABILITY_ERROR
       
   273    – if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path
       
   274    VGU_ILLEGAL_ARGUMENT_ERROR
       
   275    – if width or height is less than or equal to 0
       
   276    – if arcType is not one of the values from the VGUArcType enumeration
       
   277  */
       
   278 EXPORT_C VGUErrorCode
       
   279      vguArc(VGPath path,
       
   280         VGfloat x, VGfloat y,
       
   281         VGfloat width, VGfloat height,
       
   282         VGfloat startAngle,
       
   283         VGfloat angleExtent,
       
   284         VGUArcType arcType)
       
   285     {
       
   286 	OPENVGU_TRACE("vguArc path=%d, x=0x%x, y=0x%x, width=0x%x, height=0x%x, startAngle=0x%x, angleExtent=0x%x, arcType=%d",
       
   287 			path, x, y, width, height, startAngle, angleExtent, arcType);
       
   288 
       
   289 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   290 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   291 	if (vgContext)
       
   292 		{
       
   293 		const unsigned int n_posinf = 0x7f800000u;
       
   294 		const unsigned int n_neginf = 0xff800000u;
       
   295 		VGfloat posinf = *(VGfloat*)&n_posinf;
       
   296 		VGfloat neginf = *(VGfloat*)&n_neginf;
       
   297 
       
   298 		if ( (width <= 0) || (height <= 0) || ( (arcType != VGU_ARC_OPEN) && (arcType == VGU_ARC_CHORD) && (arcType == VGU_ARC_PIE) ) )
       
   299 			{
       
   300 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   301 			}
       
   302 		// Tony TODO review NaN detection; not convinced that this works
       
   303 		else if ( ((x + x - x) != x) || ((y + y - y) != y) ) /* NaN's */
       
   304 			{
       
   305 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   306 			}
       
   307 		else if ( ((startAngle + startAngle - startAngle) != startAngle) || ((angleExtent + angleExtent - angleExtent) != angleExtent) )
       
   308 			{
       
   309 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   310 			}
       
   311 		else if ( (startAngle <= neginf) || (startAngle >= posinf) )
       
   312 			{
       
   313 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   314 			}
       
   315 		else if ( (angleExtent <= neginf) || (angleExtent >= posinf) )
       
   316 			{
       
   317 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   318 			}
       
   319 		else if ( (x <= neginf) || (x >= posinf) ) /*Infinity x */
       
   320 			{
       
   321 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   322 			}
       
   323 		else if ( (y <= neginf) || (y >= posinf) ) /*Infinity x */
       
   324 			{
       
   325 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   326 			}
       
   327 		else
       
   328 			{
       
   329 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   330 			vguApiData.Init(OpenVgRFC::EvguArc);
       
   331 			vguApiData.AppendParam(path);
       
   332 			vguApiData.AppendParam(x);
       
   333 			vguApiData.AppendParam(y);
       
   334 			vguApiData.AppendParam(width);
       
   335 			vguApiData.AppendParam(height);
       
   336 			vguApiData.AppendParam(startAngle);
       
   337 			vguApiData.AppendParam(angleExtent);
       
   338 			vguApiData.AppendParam(arcType);
       
   339 
       
   340 			vgContext->ExecuteVgCommand(vguApiData);
       
   341 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   342 			}
       
   343 		}
       
   344 	return error;
       
   345     }
       
   346 
       
   347 /*
       
   348  Sets the entries of matrix to a projective transformation that maps the point
       
   349  (sx0, sy0) to (0, 0); (sx1, sy1) to (1, 0); (sx2, sy2) to (0, 1); and (sx3, sy3)
       
   350  to (1, 1). If no non-degenerate matrix satisfies the constraints,
       
   351  VGU_BAD_WARP_ERROR is returned and matrix is unchanged.
       
   352 
       
   353  ERRORS
       
   354    VGU_ILLEGAL_ARGUMENT_ERROR
       
   355    – if matrix is NULL
       
   356    – if matrix is not properly aligned
       
   357    VGU_BAD_WARP_ERROR
       
   358    – if no non-degenerate transformation satisfies the constraints
       
   359  */
       
   360 EXPORT_C VGUErrorCode
       
   361     vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
       
   362         VGfloat sx1, VGfloat sy1,
       
   363         VGfloat sx2, VGfloat sy2,
       
   364         VGfloat sx3, VGfloat sy3,
       
   365         VGfloat * matrix)
       
   366     {
       
   367 	OPENVGU_TRACE("vguComputeWarpQuadToSquare sx0=0x%x, sy0=0x%x, sx1=0x%x, sy1=0x%x, sx2=0x%x, sy2=0x%x, sx3=0x%x, sy3=0x%x, matrix=0x%x",
       
   368 			sx0, sy0, sx1, sy1, sx2, sy2, sx3, sy3, matrix);
       
   369 
       
   370 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   371 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   372 	if (vgContext)
       
   373 		{
       
   374 		if ( (matrix == NULL) || (3ul & (unsigned)matrix))
       
   375 			{
       
   376 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   377 			}
       
   378 		else
       
   379 			{
       
   380 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData( rfcdata );
       
   381 			vguApiData.Init(OpenVgRFC::EvguComputeWarpQuadToSquare);
       
   382 			vguApiData.AppendParam(sx0);
       
   383 			vguApiData.AppendParam(sy0);
       
   384 			vguApiData.AppendParam(sx1);
       
   385 			vguApiData.AppendParam(sy1);
       
   386 			vguApiData.AppendParam(sx2);
       
   387 			vguApiData.AppendParam(sy2);
       
   388 			vguApiData.AppendParam(sx3);
       
   389 			vguApiData.AppendParam(sy3);
       
   390 			vguApiData.AppendVector(matrix, 9, RemoteFunctionCallData::EOut);
       
   391 
       
   392 			vgContext->ExecuteVgCommand(vguApiData);
       
   393 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   394 			}
       
   395 		}
       
   396 	return error;
       
   397     }
       
   398 
       
   399 /*
       
   400  Sets the entries of matrix to a projective transformation that maps the point
       
   401  (0, 0) to (dx0, dy0); (1, 0) to (dx1, dy1); (0, 1) to (dx2, dy2); and (1, 1) to
       
   402  (dx3, dy3). If no non-degenerate matrix satisfies the constraints, VGU_BAD_WARP_ERROR
       
   403  is returned and matrix is unchanged.
       
   404 
       
   405  ERRORS
       
   406    VGU_ILLEGAL_ARGUMENT_ERROR
       
   407    – if matrix is NULL
       
   408    – if matrix is not properly aligned
       
   409    VGU_BAD_WARP_ERROR
       
   410    – if no non-degenerate transformation satisfies the constraints
       
   411  */
       
   412 EXPORT_C VGUErrorCode
       
   413     vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
       
   414         VGfloat dx1, VGfloat dy1,
       
   415         VGfloat dx2, VGfloat dy2,
       
   416         VGfloat dx3, VGfloat dy3,
       
   417         VGfloat * matrix)
       
   418     {
       
   419 	OPENVGU_TRACE("vguComputeWarpSquareToQuad dx0=0x%x, dy0=0x%x, dx1=0x%x, dy1=0x%x, dx2=0x%x, dy2=0x%x, dx3=0x%x, dy3=0x%x, matrix=0x%x",
       
   420 			dx0, dy0, dx1, dy1, dx2, dy2, dx3, dy3, matrix);
       
   421 
       
   422 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   423 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   424 	if (vgContext)
       
   425 		{
       
   426 		if ( (matrix == NULL) || (3ul & (unsigned)matrix))
       
   427 			{
       
   428 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   429 			}
       
   430 		else
       
   431 			{
       
   432 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   433 			vguApiData.Init(OpenVgRFC::EvguComputeWarpSquareToQuad);
       
   434 			vguApiData.AppendParam(dx0);
       
   435 			vguApiData.AppendParam(dy0);
       
   436 			vguApiData.AppendParam(dx1);
       
   437 			vguApiData.AppendParam(dy1);
       
   438 			vguApiData.AppendParam(dx2);
       
   439 			vguApiData.AppendParam(dy2);
       
   440 			vguApiData.AppendParam(dx3);
       
   441 			vguApiData.AppendParam(dy3);
       
   442 			vguApiData.AppendVector(matrix, 9, RemoteFunctionCallData::EOut);
       
   443 
       
   444 			vgContext->ExecuteVgCommand(vguApiData);
       
   445 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   446 			}
       
   447 		}
       
   448     return error;
       
   449     }
       
   450 
       
   451 /*
       
   452  Sets the entries of matrix to a projective transformation that maps the point
       
   453  (sx0, sy0) to (dx0, dy0); (sx1, sy1) to (dx1, dy1); (sx2, sy2) to (dx2, dy2);
       
   454  and (sx3, sy3) to (dx3, dy3). If no non-degenerate matrix satisfies the constraints,
       
   455  VGU_BAD_WARP_ERROR is returned and matrix is unchanged.
       
   456 
       
   457  ERRORS
       
   458    VGU_ILLEGAL_ARGUMENT_ERROR
       
   459    – if matrix is NULL
       
   460    – if matrix is not properly aligned
       
   461    VGU_BAD_WARP_ERROR
       
   462    – if no non-degenerate transformation satisfies the constraints
       
   463  */
       
   464 EXPORT_C VGUErrorCode
       
   465     vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
       
   466         VGfloat dx1, VGfloat dy1,
       
   467         VGfloat dx2, VGfloat dy2,
       
   468         VGfloat dx3, VGfloat dy3,
       
   469         VGfloat sx0, VGfloat sy0,
       
   470         VGfloat sx1, VGfloat sy1,
       
   471         VGfloat sx2, VGfloat sy2,
       
   472         VGfloat sx3, VGfloat sy3,
       
   473         VGfloat * matrix)
       
   474     {
       
   475 	OPENVGU_TRACE("vguComputeWarpQuadToQuad");
       
   476 	MVgContext* vgContext = CVghwUtils::VgContext();
       
   477 
       
   478 	VGUErrorCode error = VGU_OUT_OF_MEMORY_ERROR;  // nearest VGU has to an Invalid Context error
       
   479 	if (vgContext)
       
   480 		{
       
   481 		if ( (matrix == NULL) || (3ul & (unsigned)matrix))
       
   482 			{
       
   483 			error = VGU_ILLEGAL_ARGUMENT_ERROR;
       
   484 			}
       
   485 		else
       
   486 			{
       
   487 			RemoteFunctionCallData rfcdata; OpenVgRFC vguApiData(rfcdata);
       
   488 			vguApiData.Init(OpenVgRFC::EvguComputeWarpQuadToQuad);
       
   489 			vguApiData.AppendParam(dx0);
       
   490 			vguApiData.AppendParam(dy0);
       
   491 			vguApiData.AppendParam(dx1);
       
   492 			vguApiData.AppendParam(dy1);
       
   493 			vguApiData.AppendParam(dx2);
       
   494 			vguApiData.AppendParam(dy2);
       
   495 			vguApiData.AppendParam(dx3);
       
   496 			vguApiData.AppendParam(dy3);
       
   497 			vguApiData.AppendParam(sx0);
       
   498 			vguApiData.AppendParam(sy0);
       
   499 			vguApiData.AppendParam(sx1);
       
   500 			vguApiData.AppendParam(sy1);
       
   501 			vguApiData.AppendParam(sx2);
       
   502 			vguApiData.AppendParam(sy2);
       
   503 			vguApiData.AppendParam(sx3);
       
   504 			vguApiData.AppendParam(sy3);
       
   505 			vguApiData.AppendVector(matrix, 9, RemoteFunctionCallData::EOut);
       
   506 
       
   507 			vgContext->ExecuteVgCommand(vguApiData);
       
   508 			error = (VGUErrorCode)vguApiData.ReturnValue();
       
   509 			}
       
   510 		}
       
   511 	return error;
       
   512     }
       
   513 
       
   514 } /* extern "C" */