Incorporated most of Emilo's changes. His VG changes lead to a panic from window server. It may be a circular deadlockproblem where Wserv is a client of EGL which is a client of Wserv, thus circular. Need to look at it further. I also fixed the arrangement of def files, and didn't take the VG mmp file changes, as I don't think they are appropriate to a stand alone real EGL implmentation. Still need to pull in Emilo's graphicscomposition changes.
--- a/egl/eglrefimpl/bwins/lib_ref_eglu.def Fri Jul 02 12:05:03 2010 +0100
+++ b/egl/eglrefimpl/bwins/lib_ref_eglu.def Fri Jul 02 18:48:10 2010 +0100
@@ -248,136 +248,136 @@
Reserved247 @ 247 NONAME ABSENT
Reserved248 @ 248 NONAME ABSENT
Reserved249 @ 249 NONAME ABSENT
- vgAppendPath @ 250 NONAME
- vgAppendPathData @ 251 NONAME
- vgChildImage @ 252 NONAME
- vgClear @ 253 NONAME
- vgClearGlyph @ 254 NONAME
- vgClearImage @ 255 NONAME
- vgClearPath @ 256 NONAME
- vgColorMatrix @ 257 NONAME
- vgConvolve @ 258 NONAME
- vgCopyImage @ 259 NONAME
- vgCopyMask @ 260 NONAME
- vgCopyPixels @ 261 NONAME
- vgCreateFont @ 262 NONAME
- vgCreateImage @ 263 NONAME
- vgCreateMaskLayer @ 264 NONAME
- vgCreatePaint @ 265 NONAME
- vgCreatePath @ 266 NONAME
- vgDestroyFont @ 267 NONAME
- vgDestroyImage @ 268 NONAME
- vgDestroyMaskLayer @ 269 NONAME
- vgDestroyPaint @ 270 NONAME
- vgDestroyPath @ 271 NONAME
- vgDrawGlyph @ 272 NONAME
- vgDrawGlyphs @ 273 NONAME
- vgDrawImage @ 274 NONAME
- vgDrawPath @ 275 NONAME
- vgFillMaskLayer @ 276 NONAME
- vgFinish @ 277 NONAME
- vgFlush @ 278 NONAME
- vgGaussianBlur @ 279 NONAME
- vgGetColor @ 280 NONAME
- vgGetError @ 281 NONAME
- vgGetImageSubData @ 282 NONAME
- vgGetMatrix @ 283 NONAME
- vgGetPaint @ 284 NONAME
- vgGetParameterVectorSize @ 285 NONAME
- vgGetParameterf @ 286 NONAME
- vgGetParameterfv @ 287 NONAME
- vgGetParameteri @ 288 NONAME
- vgGetParameteriv @ 289 NONAME
- vgGetParent @ 290 NONAME
- vgGetPathCapabilities @ 291 NONAME
- vgGetPixels @ 292 NONAME
- vgGetString @ 293 NONAME
- vgGetVectorSize @ 294 NONAME
- vgGetf @ 295 NONAME
- vgGetfv @ 296 NONAME
- vgGeti @ 297 NONAME
- vgGetiv @ 298 NONAME
- vgHardwareQuery @ 299 NONAME
- vgImageSubData @ 300 NONAME
- vgInterpolatePath @ 301 NONAME
- vgLoadIdentity @ 302 NONAME
- vgLoadMatrix @ 303 NONAME
- vgLookup @ 304 NONAME
- vgLookupSingle @ 305 NONAME
- vgMask @ 306 NONAME
- vgModifyPathCoords @ 307 NONAME
- vgMultMatrix @ 308 NONAME
- vgPaintPattern @ 309 NONAME
- vgPathBounds @ 310 NONAME
- vgPathLength @ 311 NONAME
- vgPathTransformedBounds @ 312 NONAME
- vgPointAlongPath @ 313 NONAME
- vgReadPixels @ 314 NONAME
- vgRemovePathCapabilities @ 315 NONAME
- vgRenderToMask @ 316 NONAME
- vgRotate @ 317 NONAME
- vgScale @ 318 NONAME
- vgSeparableConvolve @ 319 NONAME
- vgSetColor @ 320 NONAME
- vgSetGlyphToImage @ 321 NONAME
- vgSetGlyphToPath @ 322 NONAME
- vgSetPaint @ 323 NONAME
- vgSetParameterf @ 324 NONAME
- vgSetParameterfv @ 325 NONAME
- vgSetParameteri @ 326 NONAME
- vgSetParameteriv @ 327 NONAME
- vgSetPixels @ 328 NONAME
- vgSetf @ 329 NONAME
- vgSetfv @ 330 NONAME
- vgSeti @ 331 NONAME
- vgSetiv @ 332 NONAME
- vgShear @ 333 NONAME
- vgTransformPath @ 334 NONAME
- vgTranslate @ 335 NONAME
- vgWritePixels @ 336 NONAME
- vguArc @ 337 NONAME
- vguComputeWarpQuadToQuad @ 338 NONAME
- vguComputeWarpQuadToSquare @ 339 NONAME
- vguComputeWarpSquareToQuad @ 340 NONAME
- vguEllipse @ 341 NONAME
- vguLine @ 342 NONAME
- vguPolygon @ 343 NONAME
- vguRect @ 344 NONAME
- vguRoundRect @ 345 NONAME
- ?do_eglInitialize@@YAHHPAH0@Z @ 346 NONAME ; int do_eglInitialize(int, int *, int *)
- ?do_eglWaitNative@@YAHH@Z @ 347 NONAME ; int do_eglWaitNative(int)
- ?do_eglWaitGL@@YAHXZ @ 348 NONAME ; int do_eglWaitGL(void)
- ?do_eglSwapBuffers@@YAHHH@Z @ 349 NONAME ; int do_eglSwapBuffers(int, int)
- ?do_eglCreatePixmapSurface@@YAHHHPAXPBH@Z @ 350 NONAME ; int do_eglCreatePixmapSurface(int, int, void *, int const *)
- ?do_eglCreatePbufferFromClientBuffer@@YAHHHHHPBH@Z @ 351 NONAME ; int do_eglCreatePbufferFromClientBuffer(int, int, int, int, int const *)
- ?do_eglCreateWindowSurface@@YAHHHPAXPBH@Z @ 352 NONAME ; int do_eglCreateWindowSurface(int, int, void *, int const *)
- ?do_eglQueryContext@@YAHHHHPAH@Z @ 353 NONAME ; int do_eglQueryContext(int, int, int, int *)
- ?do_eglCreateContext@@YAHHHHPBH@Z @ 354 NONAME ; int do_eglCreateContext(int, int, int, int const *)
- ?do_eglGetCurrentContext@@YAHXZ @ 355 NONAME ; int do_eglGetCurrentContext(void)
- ?do_eglGetDisplay@@YAHH@Z @ 356 NONAME ; int do_eglGetDisplay(int)
- ?do_eglDestroyContext@@YAHHH@Z @ 357 NONAME ; int do_eglDestroyContext(int, int)
- ?do_eglReleaseTexImage@@YAHHHH@Z @ 358 NONAME ; int do_eglReleaseTexImage(int, int, int)
- ?do_eglQueryAPI@@YAHXZ @ 359 NONAME ; int do_eglQueryAPI(void)
- ?do_eglChooseConfig@@YAHHPBHPAHH1@Z @ 360 NONAME ; int do_eglChooseConfig(int, int const *, int *, int, int *)
- ?do_eglMakeCurrent@@YAHHHHH@Z @ 361 NONAME ; int do_eglMakeCurrent(int, int, int, int)
- ?do_eglQuerySurface@@YAHHHHPAH@Z @ 362 NONAME ; int do_eglQuerySurface(int, int, int, int *)
- ?do_eglCreatePbufferSurface@@YAHHHPBH@Z @ 363 NONAME ; int do_eglCreatePbufferSurface(int, int, int const *)
- ?do_eglGetConfigAttrib@@YAHHHHPAH@Z @ 364 NONAME ; int do_eglGetConfigAttrib(int, int, int, int *)
- ?do_eglSurfaceAttrib@@YAHHHHH@Z @ 365 NONAME ; int do_eglSurfaceAttrib(int, int, int, int)
- ?do_eglGetProcAddress@@YAP6AXZZPBD@Z @ 366 NONAME ; void (*)(...) do_eglGetProcAddress(char const *)
- ?do_eglDestroySurface@@YAHHH@Z @ 367 NONAME ; int do_eglDestroySurface(int, int)
- ?do_eglGetCurrentSurface@@YAHH@Z @ 368 NONAME ; int do_eglGetCurrentSurface(int)
- ?do_eglBindTexImage@@YAHHHH@Z @ 369 NONAME ; int do_eglBindTexImage(int, int, int)
- ?do_eglCopyBuffers@@YAHHHPAX@Z @ 370 NONAME ; int do_eglCopyBuffers(int, int, void *)
- ?do_eglSwapInterval@@YAHHH@Z @ 371 NONAME ; int do_eglSwapInterval(int, int)
- ?do_eglBindAPI@@YAHH@Z @ 372 NONAME ; int do_eglBindAPI(int)
- ?do_eglGetCurrentDisplay@@YAHXZ @ 373 NONAME ; int do_eglGetCurrentDisplay(void)
- ?do_eglWaitClient@@YAHXZ @ 374 NONAME ; int do_eglWaitClient(void)
- ?do_eglQueryString@@YAPBDHH@Z @ 375 NONAME ; char const * do_eglQueryString(int, int)
- ?do_eglGetError@@YAHXZ @ 376 NONAME ; int do_eglGetError(void)
- ?do_eglTerminate@@YAHH@Z @ 377 NONAME ; int do_eglTerminate(int)
- ?do_eglReleaseThread@@YAHXZ @ 378 NONAME ; int do_eglReleaseThread(void)
- ?do_eglGetConfigs@@YAHHPAHH0@Z @ 379 NONAME ; int do_eglGetConfigs(int, int *, int, int *)
+ Reserved250 @ 250 NONAME ABSENT
+ Reserved251 @ 251 NONAME ABSENT
+ Reserved252 @ 252 NONAME ABSENT
+ Reserved253 @ 253 NONAME ABSENT
+ Reserved254 @ 254 NONAME ABSENT
+ Reserved255 @ 255 NONAME ABSENT
+ Reserved256 @ 256 NONAME ABSENT
+ Reserved257 @ 257 NONAME ABSENT
+ Reserved258 @ 258 NONAME ABSENT
+ Reserved259 @ 259 NONAME ABSENT
+ Reserved260 @ 260 NONAME ABSENT
+ Reserved261 @ 261 NONAME ABSENT
+ Reserved262 @ 262 NONAME ABSENT
+ Reserved263 @ 263 NONAME ABSENT
+ Reserved264 @ 264 NONAME ABSENT
+ Reserved265 @ 265 NONAME ABSENT
+ Reserved266 @ 266 NONAME ABSENT
+ Reserved267 @ 267 NONAME ABSENT
+ Reserved268 @ 268 NONAME ABSENT
+ Reserved269 @ 269 NONAME ABSENT
+ Reserved270 @ 270 NONAME ABSENT
+ Reserved271 @ 271 NONAME ABSENT
+ Reserved272 @ 272 NONAME ABSENT
+ Reserved273 @ 273 NONAME ABSENT
+ Reserved274 @ 274 NONAME ABSENT
+ Reserved275 @ 275 NONAME ABSENT
+ Reserved276 @ 276 NONAME ABSENT
+ Reserved277 @ 277 NONAME ABSENT
+ Reserved278 @ 278 NONAME ABSENT
+ Reserved279 @ 279 NONAME ABSENT
+ Reserved280 @ 280 NONAME ABSENT
+ Reserved281 @ 281 NONAME ABSENT
+ Reserved282 @ 282 NONAME ABSENT
+ Reserved283 @ 283 NONAME ABSENT
+ Reserved284 @ 284 NONAME ABSENT
+ Reserved285 @ 285 NONAME ABSENT
+ Reserved286 @ 286 NONAME ABSENT
+ Reserved287 @ 287 NONAME ABSENT
+ Reserved288 @ 288 NONAME ABSENT
+ Reserved289 @ 289 NONAME ABSENT
+ Reserved290 @ 290 NONAME ABSENT
+ Reserved291 @ 291 NONAME ABSENT
+ Reserved292 @ 292 NONAME ABSENT
+ Reserved293 @ 293 NONAME ABSENT
+ Reserved294 @ 294 NONAME ABSENT
+ Reserved295 @ 295 NONAME ABSENT
+ Reserved296 @ 296 NONAME ABSENT
+ Reserved297 @ 297 NONAME ABSENT
+ Reserved298 @ 298 NONAME ABSENT
+ Reserved299 @ 299 NONAME ABSENT
+ Reserved300 @ 300 NONAME ABSENT
+ Reserved301 @ 301 NONAME ABSENT
+ Reserved302 @ 302 NONAME ABSENT
+ Reserved303 @ 303 NONAME ABSENT
+ Reserved304 @ 304 NONAME ABSENT
+ Reserved305 @ 305 NONAME ABSENT
+ Reserved306 @ 306 NONAME ABSENT
+ Reserved307 @ 307 NONAME ABSENT
+ Reserved308 @ 308 NONAME ABSENT
+ Reserved309 @ 309 NONAME ABSENT
+ Reserved310 @ 310 NONAME ABSENT
+ Reserved311 @ 311 NONAME ABSENT
+ Reserved312 @ 312 NONAME ABSENT
+ Reserved313 @ 313 NONAME ABSENT
+ Reserved314 @ 314 NONAME ABSENT
+ Reserved315 @ 315 NONAME ABSENT
+ Reserved316 @ 316 NONAME ABSENT
+ Reserved317 @ 317 NONAME ABSENT
+ Reserved318 @ 318 NONAME ABSENT
+ Reserved319 @ 319 NONAME ABSENT
+ Reserved320 @ 320 NONAME ABSENT
+ Reserved321 @ 321 NONAME ABSENT
+ Reserved322 @ 322 NONAME ABSENT
+ Reserved323 @ 323 NONAME ABSENT
+ Reserved324 @ 324 NONAME ABSENT
+ Reserved325 @ 325 NONAME ABSENT
+ Reserved326 @ 326 NONAME ABSENT
+ Reserved327 @ 327 NONAME ABSENT
+ Reserved328 @ 328 NONAME ABSENT
+ Reserved329 @ 329 NONAME ABSENT
+ Reserved330 @ 330 NONAME ABSENT
+ Reserved331 @ 331 NONAME ABSENT
+ Reserved332 @ 332 NONAME ABSENT
+ Reserved333 @ 333 NONAME ABSENT
+ Reserved334 @ 334 NONAME ABSENT
+ Reserved335 @ 335 NONAME ABSENT
+ Reserved336 @ 336 NONAME ABSENT
+ Reserved337 @ 337 NONAME ABSENT
+ Reserved338 @ 338 NONAME ABSENT
+ Reserved339 @ 339 NONAME ABSENT
+ Reserved340 @ 340 NONAME ABSENT
+ Reserved341 @ 341 NONAME ABSENT
+ Reserved342 @ 342 NONAME ABSENT
+ Reserved343 @ 343 NONAME ABSENT
+ Reserved344 @ 344 NONAME ABSENT
+ Reserved345 @ 345 NONAME ABSENT
+ Reserved346 @ 346 NONAME ABSENT
+ Reserved347 @ 347 NONAME ABSENT
+ Reserved348 @ 348 NONAME ABSENT
+ Reserved349 @ 349 NONAME ABSENT
+ Reserved350 @ 350 NONAME ABSENT
+ Reserved351 @ 351 NONAME ABSENT
+ Reserved352 @ 352 NONAME ABSENT
+ Reserved353 @ 353 NONAME ABSENT
+ Reserved354 @ 354 NONAME ABSENT
+ Reserved355 @ 355 NONAME ABSENT
+ Reserved356 @ 356 NONAME ABSENT
+ Reserved357 @ 357 NONAME ABSENT
+ Reserved358 @ 358 NONAME ABSENT
+ Reserved359 @ 359 NONAME ABSENT
+ Reserved360 @ 360 NONAME ABSENT
+ Reserved361 @ 361 NONAME ABSENT
+ Reserved362 @ 362 NONAME ABSENT
+ Reserved363 @ 363 NONAME ABSENT
+ Reserved364 @ 364 NONAME ABSENT
+ Reserved365 @ 365 NONAME ABSENT
+ Reserved366 @ 366 NONAME ABSENT
+ Reserved367 @ 367 NONAME ABSENT
+ Reserved368 @ 368 NONAME ABSENT
+ Reserved369 @ 369 NONAME ABSENT
+ Reserved370 @ 370 NONAME ABSENT
+ Reserved371 @ 371 NONAME ABSENT
+ Reserved372 @ 372 NONAME ABSENT
+ Reserved373 @ 373 NONAME ABSENT
+ Reserved374 @ 374 NONAME ABSENT
+ Reserved375 @ 375 NONAME ABSENT
+ Reserved376 @ 376 NONAME ABSENT
+ Reserved377 @ 377 NONAME ABSENT
+ Reserved378 @ 378 NONAME ABSENT
+ Reserved379 @ 379 NONAME ABSENT
Reserved380 @ 380 NONAME ABSENT
Reserved381 @ 381 NONAME ABSENT
Reserved382 @ 382 NONAME ABSENT
--- a/egl/eglrefimpl/group/eglref.mmp Fri Jul 02 12:05:03 2010 +0100
+++ b/egl/eglrefimpl/group/eglref.mmp Fri Jul 02 18:48:10 2010 +0100
@@ -36,9 +36,6 @@
USERINCLUDE ../inc
-userinclude ../../sfopenvg // Local include files
-userinclude ../../sfopenvg/include // Local include files
-
SOURCEPATH ../src
SOURCE entrypoints.cpp
@@ -47,26 +44,7 @@
SOURCE display.cpp
SOURCE syncobj.cpp
-
-sourcepath ../../sfopenvg // Relative path to source files
-
-source riApi.cpp
-source riContext.cpp
-source riFont.cpp
-source riImage.cpp
-source riMath.cpp
-source riMiniEGL.cpp
-source riPath.cpp
-source riPixelPipe.cpp
-source riRasterizer.cpp
-source riVGU.cpp
-
-//for EGL
-SOURCEPATH ../../sfopenvg/symbian
-SOURCE riEGLOS.cpp
-
-LIBRARY euser.lib
-
+library euser.lib
library fbscli.lib // For CFbsBitmap, etc
library bitgdi.lib // For CFbsBitmapDevice, CFbsBitGc, etc
library ws32.lib // For RWindow, Direct Screen Access, etc
@@ -74,6 +52,7 @@
library libc.lib // standard lib
library libm.lib // standard lib
library edllstub.lib
+library sflibopenvgrefimpl.lib
#ifdef WINS
LIBRARY ewsd.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/eglinternal.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Symbian Foundation Ltd
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation Ltd - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Declaration of EGL like interface . Basically every EGL API names but prefixed with do_ e.g. do_eglInitialize
+*/
+
+#ifndef EGLINTERNAL_H
+#define EGLINTERNAL_H
+
+#include <egl.h>
+
+
+/*
+ * defines set of internal egl functiosn that are 1:1 with the published egl functions.
+ * E.g. eglInitialize -> do_eglInitialize
+ *
+ * These do_XXX fucntions are called from the libegl.dll (which is a shim) to be processed here
+ */
+
+IMPORT_C EGLint do_eglGetError(void);
+IMPORT_C EGLDisplay do_eglGetDisplay(EGLNativeDisplayType display_id);
+IMPORT_C EGLBoolean do_eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+IMPORT_C EGLBoolean do_eglTerminate(EGLDisplay dpy);
+IMPORT_C const char* do_eglQueryString(EGLDisplay dpy, EGLint name);
+IMPORT_C EGLBoolean do_eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,EGLint config_size, EGLint *num_config);
+IMPORT_C EGLBoolean do_eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,EGLConfig *configs, EGLint config_size,EGLint *num_config);
+IMPORT_C EGLBoolean do_eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,EGLint attribute, EGLint *value);
+IMPORT_C EGLSurface do_eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,EGLNativeWindowType win,const EGLint *attrib_list);
+IMPORT_C EGLSurface do_eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,const EGLint *attrib_list);
+IMPORT_C EGLSurface do_eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,EGLNativePixmapType pixmap,const EGLint *attrib_list);
+IMPORT_C EGLBoolean do_eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+IMPORT_C EGLBoolean do_eglQuerySurface(EGLDisplay dpy, EGLSurface surface,EGLint attribute, EGLint *value);
+IMPORT_C EGLBoolean do_eglBindAPI(EGLenum api);
+IMPORT_C EGLenum do_eglQueryAPI(void);
+IMPORT_C EGLBoolean do_eglWaitClient(void);
+IMPORT_C EGLBoolean do_eglReleaseThread(void);
+IMPORT_C EGLSurface do_eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,EGLConfig config, const EGLint *attrib_list);
+IMPORT_C EGLBoolean do_eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,EGLint attribute, EGLint value);
+IMPORT_C EGLBoolean do_eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+IMPORT_C EGLBoolean do_eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+IMPORT_C EGLBoolean do_eglSwapInterval(EGLDisplay dpy, EGLint interval);
+IMPORT_C EGLContext do_eglCreateContext(EGLDisplay dpy, EGLConfig config,EGLContext share_context,const EGLint *attrib_list);
+IMPORT_C EGLBoolean do_eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+IMPORT_C EGLBoolean do_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,EGLSurface read, EGLContext ctx);
+IMPORT_C EGLContext do_eglGetCurrentContext(void);
+IMPORT_C EGLSurface do_eglGetCurrentSurface(EGLint readdraw);
+IMPORT_C EGLDisplay do_eglGetCurrentDisplay(void);
+IMPORT_C EGLBoolean do_eglQueryContext(EGLDisplay dpy, EGLContext ctx,EGLint attribute, EGLint *value);
+IMPORT_C EGLBoolean do_eglWaitGL(void);
+IMPORT_C EGLBoolean do_eglWaitNative(EGLint engine);
+IMPORT_C EGLBoolean do_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+IMPORT_C EGLBoolean do_eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,EGLNativePixmapType target);
+IMPORT_C void (* EGLAPIENTRY do_eglGetProcAddress (const char *procname))(...);
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/openvginternal.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2009 Symbian Foundation Ltd
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation Ltd - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Implementation of a OpenVG like interface. Basically every OpenVG API names but prefixed with do_ e.g. do_vgSetf
+*/
+
+#ifndef OPENVGINTERNAL_H
+#define OPENVGINTERNAL_H
+
+#include <openvg.h>
+
+/*
+ * defines set of internal vgu functions that are 1:1 with the published openvg functions.
+ * E.g. vgSetf -> do_vgSetf
+ *
+ * These do_XXX fucntions are called from the libopenvg.dll (which is a shim) to be processed here
+ */
+
+IMPORT_C VGErrorCode do_vgGetError(void);
+IMPORT_C void do_vgFlush(void);
+IMPORT_C void do_vgFinish(void);
+IMPORT_C void do_vgSetf(VGParamType type, VGfloat value);
+IMPORT_C void do_vgSeti(VGParamType type, VGint value);
+IMPORT_C void do_vgSetfv(VGParamType type, VGint count ,const VGfloat* values);
+IMPORT_C void do_vgSetiv(VGParamType type, VGint count ,const VGint* values);
+IMPORT_C VGfloat do_vgGetf(VGParamType type);
+IMPORT_C VGint do_vgGeti(VGParamType type);
+IMPORT_C VGint do_vgGetVectorSize(VGParamType type);
+IMPORT_C void do_vgGetfv(VGParamType type, VGint count ,VGfloat* values);
+IMPORT_C void do_vgGetiv(VGParamType type, VGint count ,VGint* values);
+IMPORT_C void do_vgSetParameterf(VGHandle object ,VGint paramType ,VGfloat value);
+IMPORT_C void do_vgSetParameteri(VGHandle object ,VGint paramType ,VGint value);
+IMPORT_C void do_vgSetParameterfv(VGHandle object ,VGint paramType ,VGint count ,const VGfloat* values);
+IMPORT_C void do_vgSetParameteriv(VGHandle object ,VGint paramType ,VGint count ,const VGint* values);
+IMPORT_C VGfloat do_vgGetParameterf(VGHandle object ,VGint paramType);
+IMPORT_C VGint do_vgGetParameteri(VGHandle object ,VGint paramType);
+IMPORT_C VGint do_vgGetParameterVectorSize(VGHandle object ,VGint paramType);
+IMPORT_C void do_vgGetParameterfv(VGHandle object ,VGint paramType ,VGint count ,VGfloat* values);
+IMPORT_C void do_vgGetParameteriv(VGHandle object ,VGint paramType ,VGint count ,VGint* values);
+IMPORT_C void do_vgLoadIdentity(void);
+IMPORT_C void do_vgLoadMatrix(const VGfloat* m);
+IMPORT_C void do_vgGetMatrix(VGfloat* m);
+IMPORT_C void do_vgMultMatrix(const VGfloat* m);
+IMPORT_C void do_vgTranslate(VGfloat tx, VGfloat ty);
+IMPORT_C void do_vgScale(VGfloat sx, VGfloat sy);
+IMPORT_C void do_vgShear(VGfloat shx, VGfloat shy);
+IMPORT_C void do_vgRotate(VGfloat angle);
+IMPORT_C void do_vgMask(VGHandle mask, VGMaskOperation operation ,VGint x, VGint y ,VGint width, VGint height);
+IMPORT_C void do_vgRenderToMask(VGPath path ,VGbitfield paintModes ,VGMaskOperation operation);
+IMPORT_C VGMaskLayer do_vgCreateMaskLayer(VGint width, VGint height);
+IMPORT_C void do_vgDestroyMaskLayer(VGMaskLayer maskLayer);
+IMPORT_C void do_vgFillMaskLayer(VGMaskLayer maskLayer ,VGint x, VGint y ,VGint width, VGint height ,VGfloat value);
+IMPORT_C void do_vgCopyMask(VGMaskLayer maskLayer ,VGint sx, VGint sy ,VGint dx, VGint dy ,VGint width, VGint height);
+IMPORT_C void do_vgClear(VGint x, VGint y ,VGint width, VGint height);
+IMPORT_C VGPath do_vgCreatePath(VGint pathFormat ,VGPathDatatype datatype ,VGfloat scale, VGfloat bias ,VGint segmentCapacityHint ,VGint coordCapacityHint ,VGbitfield capabilities);
+IMPORT_C void do_vgClearPath(VGPath path, VGbitfield capabilities);
+IMPORT_C void do_vgDestroyPath(VGPath path);
+IMPORT_C void do_vgRemovePathCapabilities(VGPath path ,VGbitfield capabilities);
+IMPORT_C VGbitfield do_vgGetPathCapabilities(VGPath path);
+IMPORT_C void do_vgAppendPath(VGPath dstPath, VGPath srcPath);
+IMPORT_C void do_vgAppendPathData(VGPath dstPath ,VGint numSegments ,const VGubyte* pathSegments ,const void* pathData);
+IMPORT_C void do_vgModifyPathCoords(VGPath dstPath ,VGint startIndex ,VGint numSegments ,const void* pathData);
+IMPORT_C void do_vgTransformPath(VGPath dstPath, VGPath srcPath);
+IMPORT_C VGboolean do_vgInterpolatePath(VGPath dstPath ,VGPath startPath ,VGPath endPath ,VGfloat amount);
+IMPORT_C VGfloat do_vgPathLength(VGPath path ,VGint startSegment ,VGint numSegments);
+IMPORT_C void do_vgPointAlongPath(VGPath path ,VGint startSegment ,VGint numSegments ,VGfloat distance ,VGfloat* x, VGfloat* y ,VGfloat* tangentX ,VGfloat* tangentY);
+IMPORT_C void do_vgPathBounds(VGPath path ,VGfloat* minX ,VGfloat* minY ,VGfloat* width ,VGfloat* height);
+IMPORT_C void do_vgPathTransformedBounds(VGPath path ,VGfloat* minX ,VGfloat* minY ,VGfloat* width ,VGfloat* height);
+IMPORT_C void do_vgDrawPath(VGPath path, VGbitfield paintModes);
+IMPORT_C VGPaint do_vgCreatePaint(void);
+IMPORT_C void do_vgDestroyPaint(VGPaint paint);
+IMPORT_C void do_vgSetPaint(VGPaint paint, VGbitfield paintModes);
+IMPORT_C VGPaint do_vgGetPaint(VGPaintMode paintMode);
+IMPORT_C void do_vgSetColor(VGPaint paint, VGuint rgba);
+IMPORT_C VGuint do_vgGetColor(VGPaint paint);
+IMPORT_C void do_vgPaintPattern(VGPaint paint, VGImage pattern);
+IMPORT_C VGImage do_vgCreateImage(VGImageFormat format ,VGint width, VGint height ,VGbitfield allowedQuality);
+IMPORT_C void do_vgDestroyImage(VGImage image);
+IMPORT_C void do_vgClearImage(VGImage image ,VGint x, VGint y ,VGint width, VGint height);
+IMPORT_C void do_vgImageSubData(VGImage image ,const void* data ,VGint dataStride ,VGImageFormat dataFormat ,VGint x, VGint y ,VGint width, VGint height);
+IMPORT_C void do_vgGetImageSubData(VGImage image ,void* data ,VGint dataStride ,VGImageFormat dataFormat ,VGint x, VGint y ,VGint width, VGint height);
+IMPORT_C VGImage do_vgChildImage(VGImage parent ,VGint x, VGint y ,VGint width, VGint height);
+IMPORT_C VGImage do_vgGetParent(VGImage image);
+IMPORT_C void do_vgCopyImage(VGImage dst, VGint dx, VGint dy ,VGImage src, VGint sx, VGint sy ,VGint width, VGint height ,VGboolean dither);
+IMPORT_C void do_vgDrawImage(VGImage image);
+IMPORT_C void do_vgSetPixels(VGint dx, VGint dy ,VGImage src, VGint sx, VGint sy ,VGint width, VGint height);
+IMPORT_C void do_vgWritePixels(const void* data, VGint dataStride ,VGImageFormat dataFormat ,VGint dx, VGint dy ,VGint width, VGint height);
+IMPORT_C void do_vgGetPixels(VGImage dst, VGint dx, VGint dy ,VGint sx, VGint sy ,VGint width, VGint height);
+IMPORT_C void do_vgReadPixels(void* data, VGint dataStride ,VGImageFormat dataFormat ,VGint sx, VGint sy ,VGint width, VGint height);
+IMPORT_C void do_vgCopyPixels(VGint dx, VGint dy ,VGint sx, VGint sy ,VGint width, VGint height);
+IMPORT_C VGFont do_vgCreateFont(VGint glyphCapacityHint);
+IMPORT_C void do_vgDestroyFont(VGFont font);
+IMPORT_C void do_vgSetGlyphToPath(VGFont font ,VGuint glyphIndex ,VGPath path ,VGboolean isHinted ,const VGfloat glyphOrigin [2] ,const VGfloat escapement[2]);
+IMPORT_C void do_vgSetGlyphToImage(VGFont font ,VGuint glyphIndex ,VGImage image ,const VGfloat glyphOrigin [2] ,const VGfloat escapement[2]);
+IMPORT_C void do_vgClearGlyph(VGFont font ,VGuint glyphIndex);
+IMPORT_C void do_vgDrawGlyph(VGFont font ,VGuint glyphIndex ,VGbitfield paintModes ,VGboolean allowAutoHinting);
+IMPORT_C void do_vgDrawGlyphs(VGFont font ,VGint glyphCount ,const VGuint* glyphIndices ,const VGfloat* adjustments_x ,const VGfloat* adjustments_y ,VGbitfield paintModes ,VGboolean allowAutoHinting);
+IMPORT_C void do_vgColorMatrix(VGImage dst, VGImage src ,const VGfloat* matrix);
+IMPORT_C void do_vgConvolve(VGImage dst, VGImage src ,VGint kernelWidth, VGint kernelHeight ,VGint shiftX, VGint shiftY ,const VGshort* kernel ,VGfloat scale ,VGfloat bias ,VGTilingMode tilingMode);
+IMPORT_C void do_vgSeparableConvolve(VGImage dst, VGImage src ,VGint kernelWidth ,VGint kernelHeight ,VGint shiftX, VGint shiftY ,const VGshort* kernelX ,const VGshort* kernelY ,VGfloat scale ,VGfloat bias ,VGTilingMode tilingMode);
+IMPORT_C void do_vgGaussianBlur(VGImage dst, VGImage src ,VGfloat stdDeviationX ,VGfloat stdDeviationY ,VGTilingMode tilingMode);
+IMPORT_C void do_vgLookup(VGImage dst, VGImage src ,const VGubyte* redLUT ,const VGubyte* greenLUT ,const VGubyte* blueLUT ,const VGubyte* alphaLUT ,VGboolean outputLinear ,VGboolean outputPremultiplied);
+IMPORT_C void do_vgLookupSingle(VGImage dst, VGImage src ,const VGuint* lookupTable ,VGImageChannel sourceChannel ,VGboolean outputLinear ,VGboolean outputPremultiplied);
+IMPORT_C VGHardwareQueryResult do_vgHardwareQuery(VGHardwareQueryType key ,VGint setting);
+IMPORT_C const VGubyte * do_vgGetString(VGStringID name);
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riArray.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,211 @@
+#ifndef __RIARRAY_H
+#define __RIARRAY_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Array class.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef __RIDEFS_H
+#include "riDefs.h"
+#endif
+
+#include <string.h> //for memcpy
+
+namespace OpenVGRI
+{
+
+//=======================================================================
+
+/*-------------------------------------------------------------------*//*!
+* \brief An array class similar to std::vector.
+* \param
+* \return
+* \note Follows std::vector's naming convention (except resizeAndReallocate).
+*//*-------------------------------------------------------------------*/
+
+template <class Item> class Array
+{
+public:
+ Array() : m_array(NULL), m_size(0), m_allocated(0) {} //throws bad_alloc
+ ~Array()
+ {
+ RI_DELETE_ARRAY(m_array);
+ }
+
+ void swap(Array& s)
+ {
+ Item* tarray = m_array;
+ m_array = s.m_array;
+ s.m_array = tarray;
+
+ int tsize = m_size;
+ m_size = s.m_size;
+ s.m_size = tsize;
+
+ int tallocated = m_allocated;
+ m_allocated = s.m_allocated;
+ s.m_allocated = tallocated;
+ }
+
+ //if more room is needed, reallocate, otherwise return
+ void reserve( int items ) //throws bad_alloc
+ {
+ RI_ASSERT( items >= 0 );
+ if( items <= m_allocated )
+ return; //if there is room already, return
+
+ RI_ASSERT( items > m_allocated );
+
+ Item* newa = RI_NEW_ARRAY(Item, items); //throws bad_alloc if runs out of memory
+ for(int i=0;i<m_size;i++)
+ newa[i] = m_array[i];
+ RI_DELETE_ARRAY(m_array);
+ m_array = newa;
+ m_allocated = items;
+ //doesn't change size
+ }
+
+ //reserve and change size
+ void resize( int items ) //throws bad_alloc
+ {
+ reserve( items ); //throws bad_alloc if runs out of memory
+ m_size = items;
+ }
+
+ //resize and allocate exactly the correct amount of memory
+ void resizeAndReallocate( int items ) //throws bad_alloc
+ {
+ RI_ASSERT( items >= 0 );
+ if( items == m_allocated )
+ {
+ m_size = items;
+ return;
+ }
+
+ if( items == 0 )
+ {
+ RI_DELETE_ARRAY(m_array);
+ m_size = 0;
+ m_allocated = 0;
+ return;
+ }
+
+ Item* newa = RI_NEW_ARRAY(Item, items); //throws bad_alloc if runs out of memory
+ int copySize = (m_size < items) ? m_size : items; //min(m_size,items)
+ for(int i=0;i<copySize;i++)
+ newa[i] = m_array[i];
+ RI_DELETE_ARRAY(m_array);
+ m_array = newa;
+ m_allocated = items;
+ m_size = items; //changes also size
+ }
+ void clear()
+ {
+ m_size = 0;
+ }
+
+ //sort array (needs operator< defined for Item. Define it with < for increasing order and > for decreasing.)
+ void sort()
+ {
+ if(m_size <= 1)
+ return;
+ quicksort(0, m_size - 1);
+ }
+
+ //remove the first occurrence of an item from the array
+ bool remove(const Item& item)
+ {
+ int i=0;
+ for(;i<m_size;i++)
+ {
+ if(m_array[i] == item)
+ break;
+ }
+ if(i >= m_size)
+ return false; //not found
+ for(;i<m_size-1;i++)
+ {
+ m_array[i] = m_array[i+1];
+ }
+ m_size--;
+ return true;
+ }
+
+ RI_INLINE void push_back( const Item& item ) //throws bad_alloc
+ {
+ if( m_size >= m_allocated )
+ reserve( (!m_allocated) ? 8 : m_allocated * 2 ); //by default, reserve 8. throws bad_alloc if runs out of memory
+ m_array[m_size++] = item;
+ }
+ RI_INLINE int size() const { return m_size; }
+ RI_INLINE Item& operator[](int i) { RI_ASSERT(i >= 0 && i < m_size); return m_array[i]; }
+ RI_INLINE const Item& operator[](int i) const { RI_ASSERT(i >= 0 && i < m_size); return m_array[i]; }
+
+private:
+ Array(const Array& s); //!< Not allowed.
+ void operator=(const Array& s); //!< Not allowed.
+
+ void quicksort(int left, int right)
+ {
+ int i = left, j = right;
+ Item x = m_array[(left+right)>>1];
+
+ do
+ {
+ while (m_array[i] < x)
+ i++;
+ while (x < m_array[j])
+ j--;
+ if (i<=j)
+ {
+ Item tmp = m_array[i];
+ m_array[i] = m_array[j];
+ m_array[j] = tmp;
+ i++;
+ j--;
+ }
+ } while (i<=j);
+
+ if(left < j) quicksort(left, j);
+ if(i < right) quicksort(i, right);
+ }
+
+
+ Item* m_array;
+ int m_size;
+ int m_allocated;
+};
+
+//=======================================================================
+
+} //namespace OpenVGRI
+
+#endif /* __RIARRAY_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riContext.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,277 @@
+#ifndef __RICONTEXT_H
+#define __RICONTEXT_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief VGContext class. Used for storing OpenVG state.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef OPENVG_H
+#include "openvg.h"
+#endif
+
+#ifndef __RIDEFS_H
+#include "riDefs.h"
+#endif
+
+#ifndef __RIMATH_H
+#include "riMath.h"
+#endif
+
+#ifndef __RIIMAGE_H
+#include "riImage.h"
+#endif
+
+#ifndef __RIPATH_H
+#include "riPath.h"
+#endif
+
+#ifndef __RIFONT_H
+#include "riFont.h"
+#endif
+
+#ifndef __RIARRAY_H
+#include "riArray.h"
+#endif
+
+//==============================================================================================
+
+namespace OpenVGRI
+{
+
+class VGContext;
+
+/*-------------------------------------------------------------------*//*!
+* \brief A list of resources (Images, Paths, or Paints) shared by a
+* set of contexts.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+template <class Resource> class ResourceManager
+{
+public:
+ ResourceManager() :
+ m_referenceCount(0),
+ m_resources()
+ {
+ }
+
+ ~ResourceManager()
+ {
+ RI_ASSERT(m_referenceCount == 0);
+ RI_ASSERT(m_resources.size() == 0);
+ }
+
+ void addReference()
+ {
+ m_referenceCount++;
+ }
+
+ int removeReference()
+ {
+ m_referenceCount--;
+ RI_ASSERT(m_referenceCount >= 0);
+ return m_referenceCount;
+ }
+
+ void addResource(Resource* resource, VGContext* context)
+ {
+ Entry r;
+ r.resource = resource;
+ r.context = context;
+ m_resources.push_back(r); //throws bad_alloc
+ resource->addReference();
+ }
+
+ void removeResource(Resource* resource)
+ {
+ if(!resource->removeReference())
+ RI_DELETE(resource);
+
+ int i=0;
+ bool found = false;
+ for(;i<m_resources.size();i++)
+ {
+ if(m_resources[i].resource == resource)
+ {
+ found = true;
+ break;
+ }
+ }
+ RI_ASSERT(found);
+
+ for(;i<m_resources.size()-1;i++)
+ {
+ m_resources[i] = m_resources[i+1];
+ }
+ m_resources.resize(m_resources.size()-1);
+ }
+
+ bool isValid(Resource* resource)
+ {
+ for(int i=0;i<m_resources.size();i++)
+ {
+ if(m_resources[i].resource == resource)
+ return true;
+ }
+ return false;
+ }
+
+ Resource* getFirstResource(VGContext* context)
+ {
+ for(int i=0;i<m_resources.size();i++)
+ {
+ if(m_resources[i].context == context)
+ return m_resources[i].resource;
+ }
+ return NULL;
+ }
+
+private:
+ ResourceManager(const ResourceManager&);
+ ResourceManager operator=(const ResourceManager&);
+
+ struct Entry
+ {
+ Resource* resource;
+ VGContext* context;
+ };
+
+ int m_referenceCount;
+ Array<Entry> m_resources;
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class VGContext
+{
+public:
+ VGContext(VGContext* shareContext); //throws bad_alloc
+ ~VGContext();
+
+ void setDefaultDrawable(Drawable* drawable); //called from EGL
+ Drawable* getCurrentDrawable() { return m_eglDrawable; }
+
+ bool isValidImage(VGImage image);
+ bool isValidPath(VGPath path);
+ bool isValidPaint(VGPaint paint);
+ bool isValidFont(VGFont font);
+ bool isValidMaskLayer(VGMaskLayer layer);
+
+ void releasePaint(VGbitfield paintModes);
+
+ void setError(VGErrorCode error) { if(m_error == VG_NO_ERROR) m_error = error; }
+
+ // Mode settings
+ VGMatrixMode m_matrixMode;
+ VGFillRule m_fillRule;
+ VGImageQuality m_imageQuality;
+ VGRenderingQuality m_renderingQuality;
+ VGBlendMode m_blendMode;
+ VGImageMode m_imageMode;
+
+ // Scissor rectangles
+ Array<Rectangle> m_scissor;
+
+ // Stroke parameters
+ RIfloat m_strokeLineWidth;
+ RIfloat m_inputStrokeLineWidth;
+ VGCapStyle m_strokeCapStyle;
+ VGJoinStyle m_strokeJoinStyle;
+ RIfloat m_strokeMiterLimit;
+ RIfloat m_inputStrokeMiterLimit;
+ Array<RIfloat> m_strokeDashPattern;
+ Array<RIfloat> m_inputStrokeDashPattern;
+ RIfloat m_strokeDashPhase;
+ RIfloat m_inputStrokeDashPhase;
+ VGboolean m_strokeDashPhaseReset;
+
+ // Edge fill color for vgConvolve and pattern paint
+ Color m_tileFillColor;
+ Color m_inputTileFillColor;
+
+ // Color for vgClear
+ Color m_clearColor;
+ Color m_inputClearColor;
+
+ Vector2 m_glyphOrigin;
+ Vector2 m_inputGlyphOrigin;
+
+ VGboolean m_masking;
+ VGboolean m_scissoring;
+
+ VGPixelLayout m_pixelLayout;
+
+ VGboolean m_filterFormatLinear;
+ VGboolean m_filterFormatPremultiplied;
+ VGbitfield m_filterChannelMask;
+
+ // Matrices
+ Matrix3x3 m_pathUserToSurface;
+ Matrix3x3 m_imageUserToSurface;
+ Matrix3x3 m_glyphUserToSurface;
+ Matrix3x3 m_fillPaintToUser;
+ Matrix3x3 m_strokePaintToUser;
+
+ VGPaint m_fillPaint;
+ VGPaint m_strokePaint;
+
+ VGboolean m_colorTransform;
+ RIfloat m_colorTransformValues[8];
+ RIfloat m_inputColorTransformValues[8];
+
+ VGErrorCode m_error;
+
+ ResourceManager<Image>* m_imageManager;
+ ResourceManager<Path>* m_pathManager;
+ ResourceManager<Paint>* m_paintManager;
+ ResourceManager<Font>* m_fontManager;
+ ResourceManager<Surface>* m_maskLayerManager;
+private:
+ Drawable* m_eglDrawable;
+
+ VGContext(const VGContext&); //!< Not allowed.
+ void operator=(const VGContext&); //!< Not allowed.
+};
+
+//==============================================================================================
+
+} //namespace OpenVGRI
+
+//==============================================================================================
+
+#endif /* __RICONTEXT_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riDefs.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,155 @@
+#ifndef __RIDEFS_H
+#define __RIDEFS_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Platform- and compiler-dependent type and macro definitions.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#include <float.h>
+#include <math.h>
+#include <assert.h>
+#include <new> //for bad_alloc
+#include <egl.h>
+
+#ifdef USE_NEW_ELEAVE
+//this is sometimes useful to include so that alloc fails ca be caught.
+//I have found intermittent OOM (-4) problems when rasterizing the tiger image
+#include <e32std.h>
+#endif
+
+namespace OpenVGRI
+{
+
+//make for-clause scope c++ standard compliant on msvc
+#if defined (_MSC_VER)
+# if !defined (for)
+ __forceinline bool getFalse (void) { return false; }
+# define for if(getFalse()); else for
+# endif // for
+
+#pragma warning(disable:4710) //disable function not inlined warning
+#pragma warning(disable:4714) //disable function not __forceinlined warning
+#endif // _MSC_VER
+
+//=======================================================================
+
+typedef int RIint32;
+typedef unsigned int RIuint32;
+typedef short RIint16;
+typedef unsigned short RIuint16;
+typedef signed char RIint8;
+typedef unsigned char RIuint8;
+typedef float RIfloat32;
+//TODO add compile-time assertions to guarantee the sizes
+
+#if defined (_MSC_VER) // MSVC WIN32
+# define RI_INLINE __forceinline
+#elif defined __APPLE__ || defined (__GNUC__) || defined (__GCC32__) || (__SYMBIAN32__)
+# define RI_INLINE inline
+#endif
+
+/*!< Unsigned int that can hold a pointer to any type */
+/*!< Signed int that can hold a pointer to any type */
+#if defined (_MSC_VER) && (_MSC_VER >= 1300)
+typedef uintptr_t RIuintptr;
+typedef intptr_t RIintptr;
+#else
+typedef unsigned long RIuintptr;
+typedef signed long RIintptr;
+#endif
+
+#define RI_UINT32_MAX (0xffffffffu)
+#define RI_INT32_MAX (0x7fffffff)
+#define RI_INT32_MIN (-0x7fffffff-1)
+
+/* maximum mantissa is 23 */
+#define RI_MANTISSA_BITS 23
+
+/* maximum exponent is 8 */
+#define RI_EXPONENT_BITS 8
+
+typedef union
+{
+ RIfloat32 f;
+ RIuint32 i;
+} RIfloatInt;
+
+RI_INLINE float getFloatMax()
+{
+ RIfloatInt v;
+ v.i = (((1<<(RI_EXPONENT_BITS-1))-1+127) << 23) | (((1<<RI_MANTISSA_BITS)-1) << (23-RI_MANTISSA_BITS));
+ return v.f;
+}
+#define RI_FLOAT_MAX getFloatMax()
+
+#define RI_MAX_IMAGE_WIDTH 16384
+#define RI_MAX_IMAGE_HEIGHT 16384
+#define RI_MAX_IMAGE_PIXELS (RI_MAX_IMAGE_WIDTH*RI_MAX_IMAGE_HEIGHT)
+#define RI_MAX_IMAGE_BYTES (4*RI_MAX_IMAGE_WIDTH*RI_MAX_IMAGE_HEIGHT)
+#define RI_MAX_DASH_COUNT 256
+#define RI_MAX_COLOR_RAMP_STOPS 256
+#define RI_MAX_KERNEL_SIZE 256
+#define RI_MAX_SEPARABLE_KERNEL_SIZE 256
+#define RI_MAX_GAUSSIAN_STD_DEVIATION 16.0f
+#define RI_MAX_SCISSOR_RECTANGLES 256
+#define RI_MAX_EDGES 262144
+#define RI_MAX_SAMPLES 32
+#define RI_NUM_TESSELLATED_SEGMENTS 256
+
+#define RI_DEBUG
+
+#ifdef RI_DEBUG
+# define RI_ASSERT assert
+#else
+# define RI_ASSERT
+#endif
+
+#define RI_UNREF(X) ((void)(X))
+#define RI_APIENTRY EXPORT_C
+
+#ifdef USE_NEW_ELEAVE
+#define RI_NEW(TYPE, PARAMS) (new(ELeave) TYPE PARAMS)
+#define RI_NEW_ARRAY(TYPE, ITEMS) (new(ELeave) TYPE[ITEMS])
+#else
+#define RI_NEW(TYPE, PARAMS) (new TYPE PARAMS)
+#define RI_NEW_ARRAY(TYPE, ITEMS) (new TYPE[ITEMS])
+#endif
+#define RI_DELETE(PARAMS) (delete (PARAMS))
+#define RI_DELETE_ARRAY(PARAMS) (delete[] (PARAMS))
+
+bool isValidImageFormat(int format);
+bool isValidImageFormat(EGLNativePixmapType f);
+
+//=======================================================================
+
+} //namespace OpenVGRI
+
+#endif /* __RIDEFS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riFont.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,116 @@
+#ifndef __RIFONT_H
+#define __RIFONT_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief VGContext class. Used for storing OpenVG state.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _OPENVG_H
+#include "openvg.h"
+#endif
+
+#ifndef __RIMATH_H
+#include "riMath.h"
+#endif
+
+#ifndef __RIARRAY_H
+#include "riArray.h"
+#endif
+
+#ifndef __RIPATH_H
+#include "riPath.h"
+#endif
+
+#ifndef __RIIMAGE_H
+#include "riImage.h"
+#endif
+
+//==============================================================================================
+
+namespace OpenVGRI
+{
+
+/*-------------------------------------------------------------------*//*!
+* \brief Storage and operations for VGFont.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Font
+{
+public:
+ struct Glyph
+ {
+ enum State
+ {
+ GLYPH_UNINITIALIZED = 0,
+ GLYPH_PATH = 1,
+ GLYPH_IMAGE = 2
+ };
+ Glyph() { m_state = GLYPH_UNINITIALIZED; m_path = m_image = VG_INVALID_HANDLE; m_isHinted = false; m_origin.set(0.0f, 0.0f); m_escapement.set(0.0f, 0.0f); }
+ unsigned int m_index;
+ State m_state;
+ VGPath m_path;
+ VGImage m_image;
+ bool m_isHinted;
+ Vector2 m_origin;
+ Vector2 m_escapement;
+ };
+
+ Font(int capacityHint); //throws bad_alloc
+ ~Font();
+
+ int getNumGlyphs() const { int n=0; for(int i=0;i<m_glyphs.size();i++) { if(m_glyphs[i].m_state != Glyph::GLYPH_UNINITIALIZED) n++; } return n; }
+ void addReference() { m_referenceCount++; }
+ int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+
+ void setGlyphToPath(unsigned int index, VGPath path, bool isHinted, const Vector2& origin, const Vector2& escapement); //throws bad_alloc
+ void setGlyphToImage(unsigned int index, VGImage image, const Vector2& origin, const Vector2& escapement); //throws bad_alloc
+ Glyph* findGlyph(unsigned int index);
+ void clearGlyph(Glyph* g);
+private:
+ Font(const Font&); //!< Not allowed.
+ void operator=(const Font&); //!< Not allowed.
+
+ Glyph* newGlyph(); //throws bad_alloc
+
+ int m_referenceCount;
+ Array<Glyph> m_glyphs;
+};
+
+//=======================================================================
+
+} //namespace OpenVGRI
+
+//=======================================================================
+
+#endif /* __RIFONT_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riImage.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,379 @@
+#ifndef __RIIMAGE_H
+#define __RIIMAGE_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Color and Image classes.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef OPENVG_H
+#include "openvg.h"
+#endif
+
+#ifndef __RIMATH_H
+#include "riMath.h"
+#endif
+
+#ifndef __RIARRAY_H
+#include "riArray.h"
+#endif
+
+//==============================================================================================
+
+namespace OpenVGRI
+{
+
+/*-------------------------------------------------------------------*//*!
+* \brief A class representing rectangles.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Rectangle
+{
+public:
+ Rectangle() : x(0), y(0), width(0), height(0) {}
+ Rectangle(int rx, int ry, int rw, int rh) : x(rx), y(ry), width(rw), height(rh) {}
+ void intersect(const Rectangle& r)
+ {
+ if(width >= 0 && r.width >= 0 && height >= 0 && r.height >= 0)
+ {
+ int x1 = RI_INT_MIN(RI_INT_ADDSATURATE(x, width), RI_INT_ADDSATURATE(r.x, r.width));
+ x = RI_INT_MAX(x, r.x);
+ width = RI_INT_MAX(x1 - x, 0);
+
+ int y1 = RI_INT_MIN(RI_INT_ADDSATURATE(y, height), RI_INT_ADDSATURATE(r.y, r.height));
+ y = RI_INT_MAX(y, r.y);
+ height = RI_INT_MAX(y1 - y, 0);
+ }
+ else
+ {
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
+ }
+ }
+
+ int x;
+ int y;
+ int width;
+ int height;
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief A class representing color for processing and converting it
+* to and from various surface formats.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Color
+{
+public:
+ enum InternalFormat
+ {
+ lRGBA = 0,
+ sRGBA = 1,
+ lRGBA_PRE = 2,
+ sRGBA_PRE = 3,
+ lLA = 4,
+ sLA = 5,
+ lLA_PRE = 6,
+ sLA_PRE = 7
+ };
+ enum FormatBits
+ {
+ NONLINEAR = (1<<0),
+ PREMULTIPLIED = (1<<1),
+ LUMINANCE = (1<<2)
+ };
+ class Descriptor
+ {
+ public:
+ bool isNonlinear() const { return (internalFormat & NONLINEAR) ? true : false; }
+ bool isPremultiplied() const { return (internalFormat & PREMULTIPLIED) ? true : false; }
+ bool isLuminance() const { return (internalFormat & LUMINANCE) ? true : false; }
+ bool isAlphaOnly() const { return (alphaBits && (redBits+greenBits+blueBits+luminanceBits) == 0) ? true : false; }
+
+ int redBits;
+ int redShift;
+ int greenBits;
+ int greenShift;
+ int blueBits;
+ int blueShift;
+ int alphaBits;
+ int alphaShift;
+ int luminanceBits;
+ int luminanceShift;
+ VGImageFormat format;
+ InternalFormat internalFormat;
+ int bitsPerPixel;
+ };
+
+ RI_INLINE Color() : r(0.0f), g(0.0f), b(0.0f), a(0.0f), m_format(lRGBA) {}
+ RI_INLINE Color(RIfloat cl, RIfloat ca, InternalFormat cs) : r(cl), g(cl), b(cl), a(ca), m_format(cs) { RI_ASSERT(cs == lLA || cs == sLA || cs == lLA_PRE || cs == sLA_PRE); }
+ RI_INLINE Color(RIfloat cr, RIfloat cg, RIfloat cb, RIfloat ca, InternalFormat cs) : r(cr), g(cg), b(cb), a(ca), m_format(cs) { RI_ASSERT(cs == lRGBA || cs == sRGBA || cs == lRGBA_PRE || cs == sRGBA_PRE || cs == lLA || cs == sLA || cs == lLA_PRE || cs == sLA_PRE); }
+ RI_INLINE Color(const Color& c) : r(c.r), g(c.g), b(c.b), a(c.a), m_format(c.m_format) {}
+ RI_INLINE Color& operator=(const Color&c) { r = c.r; g = c.g; b = c.b; a = c.a; m_format = c.m_format; return *this; }
+ RI_INLINE void operator*=(RIfloat f) { r *= f; g *= f; b *= f; a*= f; }
+ RI_INLINE void operator+=(const Color& c1) { RI_ASSERT(m_format == c1.getInternalFormat()); r += c1.r; g += c1.g; b += c1.b; a += c1.a; }
+ RI_INLINE void operator-=(const Color& c1) { RI_ASSERT(m_format == c1.getInternalFormat()); r -= c1.r; g -= c1.g; b -= c1.b; a -= c1.a; }
+
+ void set(RIfloat cl, RIfloat ca, InternalFormat cs) { RI_ASSERT(cs == lLA || cs == sLA || cs == lLA_PRE || cs == sLA_PRE); r = cl; g = cl; b = cl; a = ca; m_format = cs; }
+ void set(RIfloat cr, RIfloat cg, RIfloat cb, RIfloat ca, InternalFormat cs) { RI_ASSERT(cs == lRGBA || cs == sRGBA || cs == lRGBA_PRE || cs == sRGBA_PRE); r = cr; g = cg; b = cb; a = ca; m_format = cs; }
+ void unpack(unsigned int inputData, const Descriptor& inputDesc);
+ unsigned int pack(const Descriptor& outputDesc) const;
+ RI_INLINE InternalFormat getInternalFormat() const { return m_format; }
+
+ //clamps nonpremultiplied colors and alpha to [0,1] range, and premultiplied alpha to [0,1], colors to [0,a]
+ void clamp() { a = RI_CLAMP(a,0.0f,1.0f); RIfloat u = (m_format & PREMULTIPLIED) ? a : (RIfloat)1.0f; r = RI_CLAMP(r,0.0f,u); g = RI_CLAMP(g,0.0f,u); b = RI_CLAMP(b,0.0f,u); }
+ void convert(InternalFormat outputFormat);
+ void premultiply() { if(!(m_format & PREMULTIPLIED)) { r *= a; g *= a; b *= a; m_format = (InternalFormat)(m_format | PREMULTIPLIED); } }
+ void unpremultiply() { if(m_format & PREMULTIPLIED) { RIfloat ooa = (a != 0.0f) ? 1.0f/a : (RIfloat)0.0f; r *= ooa; g *= ooa; b *= ooa; m_format = (InternalFormat)(m_format & ~PREMULTIPLIED); } }
+ void luminanceToRGB() { if(m_format & LUMINANCE) { RI_ASSERT(r == g && g == b); m_format = (InternalFormat)(m_format & ~LUMINANCE); } }
+
+ bool isNonlinear() const { return (m_format & NONLINEAR) ? true : false; }
+ bool isPremultiplied() const { return (m_format & PREMULTIPLIED) ? true : false; }
+ bool isLuminance() const { return (m_format & LUMINANCE) ? true : false; }
+
+ RI_INLINE void assertConsistency() const;
+
+ static Descriptor formatToDescriptor(VGImageFormat format);
+ static bool isValidDescriptor(const Descriptor& desc);
+
+ RIfloat r;
+ RIfloat g;
+ RIfloat b;
+ RIfloat a;
+private:
+ InternalFormat m_format;
+};
+
+RI_INLINE Color operator*(const Color& c, RIfloat f) { return Color(c.r*f, c.g*f, c.b*f, c.a*f, c.getInternalFormat()); }
+RI_INLINE Color operator*(RIfloat f, const Color& c) { return Color(c.r*f, c.g*f, c.b*f, c.a*f, c.getInternalFormat()); }
+RI_INLINE Color operator+(const Color& c0, const Color& c1) { RI_ASSERT(c0.getInternalFormat() == c1.getInternalFormat()); return Color(c0.r+c1.r, c0.g+c1.g, c0.b+c1.b, c0.a+c1.a, c0.getInternalFormat()); }
+RI_INLINE Color operator-(const Color& c0, const Color& c1) { RI_ASSERT(c0.getInternalFormat() == c1.getInternalFormat()); return Color(c0.r-c1.r, c0.g-c1.g, c0.b-c1.b, c0.a-c1.a, c0.getInternalFormat()); }
+RI_INLINE void Color::assertConsistency() const
+{
+ RI_ASSERT(r >= 0.0f && r <= 1.0f);
+ RI_ASSERT(g >= 0.0f && g <= 1.0f);
+ RI_ASSERT(b >= 0.0f && b <= 1.0f);
+ RI_ASSERT(a >= 0.0f && a <= 1.0f);
+ RI_ASSERT(!isPremultiplied() || (r <= a && g <= a && b <= a)); //premultiplied colors must have color channels less than or equal to alpha
+ RI_ASSERT((isLuminance() && r == g && r == b) || !isLuminance()); //if luminance, r=g=b
+}
+
+//==============================================================================================
+
+/*-------------------------------------------------------------------*//*!
+* \brief Storage and operations for VGImage.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Surface;
+class Image
+{
+public:
+ Image(const Color::Descriptor& desc, int width, int height, VGbitfield allowedQuality); //throws bad_alloc
+ //use data from a memory buffer. NOTE: data is not copied, so it is user's responsibility to make sure the data remains valid while the Image is in use.
+ Image(const Color::Descriptor& desc, int width, int height, int stride, RIuint8* data); //throws bad_alloc
+ //child image constructor
+ Image(Image* parent, int x, int y, int width, int height); //throws bad_alloc
+ ~Image();
+
+ const Color::Descriptor& getDescriptor() const { return m_desc; }
+ int getWidth() const { return m_width; }
+ int getHeight() const { return m_height; }
+ int getStride() const { return m_stride; }
+ Image* getParent() const { return m_parent; }
+ VGbitfield getAllowedQuality() const { return m_allowedQuality; }
+ void addInUse() { m_inUse++; }
+ void removeInUse() { RI_ASSERT(m_inUse > 0); m_inUse--; }
+ int isInUse() const { return m_inUse; }
+ RIuint8* getData() const { return m_data; }
+ void addReference() { m_referenceCount++; }
+ int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+ bool overlaps(const Image* src) const;
+
+ void clear(const Color& clearColor, int x, int y, int w, int h);
+ void blit(const Image& src, int sx, int sy, int dx, int dy, int w, int h, bool dither); //throws bad_alloc
+ void blit(const Surface* src, int sx, int sy, int dx, int dy, int w, int h); //throws bad_alloc
+
+ Color readPixel(int x, int y) const;
+ void writePixel(int x, int y, const Color& c);
+ void writeFilteredPixel(int x, int y, const Color& c, VGbitfield channelMask);
+
+ RIfloat readMaskPixel(int x, int y) const; //can read any image format
+ void writeMaskPixel(int x, int y, RIfloat m); //can write only to VG_A_x
+
+ Color resample(RIfloat x, RIfloat y, const Matrix3x3& surfaceToImage, VGImageQuality quality, VGTilingMode tilingMode, const Color& tileFillColor); //throws bad_alloc
+ void makeMipMaps(); //throws bad_alloc
+
+ void colorMatrix(const Image& src, const RIfloat* matrix, bool filterFormatLinear, bool filterFormatPremultiplied, VGbitfield channelMask);
+ void convolve(const Image& src, int kernelWidth, int kernelHeight, int shiftX, int shiftY, const RIint16* kernel, RIfloat scale, RIfloat bias, VGTilingMode tilingMode, const Color& edgeFillColor, bool filterFormatLinear, bool filterFormatPremultiplied, VGbitfield channelMask);
+ void separableConvolve(const Image& src, int kernelWidth, int kernelHeight, int shiftX, int shiftY, const RIint16* kernelX, const RIint16* kernelY, RIfloat scale, RIfloat bias, VGTilingMode tilingMode, const Color& edgeFillColor, bool filterFormatLinear, bool filterFormatPremultiplied, VGbitfield channelMask);
+ void gaussianBlur(const Image& src, RIfloat stdDeviationX, RIfloat stdDeviationY, VGTilingMode tilingMode, const Color& edgeFillColor, bool filterFormatLinear, bool filterFormatPremultiplied, VGbitfield channelMask);
+ void lookup(const Image& src, const RIuint8 * redLUT, const RIuint8 * greenLUT, const RIuint8 * blueLUT, const RIuint8 * alphaLUT, bool outputLinear, bool outputPremultiplied, bool filterFormatLinear, bool filterFormatPremultiplied, VGbitfield channelMask);
+ void lookupSingle(const Image& src, const RIuint32 * lookupTable, VGImageChannel sourceChannel, bool outputLinear, bool outputPremultiplied, bool filterFormatLinear, bool filterFormatPremultiplied, VGbitfield channelMask);
+private:
+ Image(const Image&); //!< Not allowed.
+ void operator=(const Image&); //!< Not allowed.
+
+ Color readTexel(int u, int v, int level, VGTilingMode tilingMode, const Color& tileFillColor) const;
+
+ Color::Descriptor m_desc;
+ int m_width;
+ int m_height;
+ VGbitfield m_allowedQuality;
+ int m_inUse;
+ int m_stride;
+ RIuint8* m_data;
+ int m_referenceCount;
+ bool m_ownsData;
+ Image* m_parent;
+ int m_storageOffsetX;
+ int m_storageOffsetY;
+
+ bool m_mipmapsValid;
+ Array<Image*> m_mipmaps;
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief Surface class abstracting multisampled rendering surface.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Surface
+{
+public:
+ Surface(const Color::Descriptor& desc, int width, int height, int numSamples); //throws bad_alloc
+ Surface(Image* image); //throws bad_alloc
+ Surface(const Color::Descriptor& desc, int width, int height, int stride, RIuint8* data); //throws bad_alloc
+ ~Surface();
+
+ RI_INLINE const Color::Descriptor& getDescriptor() const { return m_image->getDescriptor(); }
+ RI_INLINE int getWidth() const { return m_width; }
+ RI_INLINE int getHeight() const { return m_height; }
+ RI_INLINE int getNumSamples() const { return m_numSamples; }
+ RI_INLINE void addReference() { m_referenceCount++; }
+ RI_INLINE int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+ RI_INLINE int isInUse() const { return m_image->isInUse(); }
+ RI_INLINE bool isInUse(Image* image) const { return image == m_image ? true : false; }
+
+ void clear(const Color& clearColor, int x, int y, int w, int h);
+ void clear(const Color& clearColor, int x, int y, int w, int h, const Array<Rectangle>& scissors);
+ void blit(const Image& src, int sx, int sy, int dx, int dy, int w, int h); //throws bad_alloc
+ void blit(const Image& src, int sx, int sy, int dx, int dy, int w, int h, const Array<Rectangle>& scissors); //throws bad_alloc
+ void blit(const Surface* src, int sx, int sy, int dx, int dy, int w, int h); //throws bad_alloc
+ void blit(const Surface* src, int sx, int sy, int dx, int dy, int w, int h, const Array<Rectangle>& scissors); //throws bad_alloc
+ void mask(const Image* src, VGMaskOperation operation, int x, int y, int w, int h);
+ void mask(const Surface* src, VGMaskOperation operation, int x, int y, int w, int h);
+
+ RI_INLINE Color readSample(int x, int y, int sample) const { return m_image->readPixel(x*m_numSamples+sample, y); }
+ RI_INLINE void writeSample(int x, int y, int sample, const Color& c) { m_image->writePixel(x*m_numSamples+sample, y, c); }
+
+ RIfloat readMaskCoverage(int x, int y) const;
+ void writeMaskCoverage(int x, int y, RIfloat m);
+ unsigned int readMaskMSAA(int x, int y) const;
+ void writeMaskMSAA(int x, int y, unsigned int m);
+
+ Color FSAAResolve(int x, int y) const; //for fb=>img: vgGetPixels, vgReadPixels
+private:
+ Surface(const Surface&); //!< Not allowed.
+ void operator=(const Surface&); //!< Not allowed.
+
+ struct ScissorEdge
+ {
+ ScissorEdge() : x(0), miny(0), maxy(0), direction(0) {}
+ bool operator<(const ScissorEdge& e) const { return x < e.x; }
+ int x;
+ int miny;
+ int maxy;
+ int direction; //1 start, -1 end
+ };
+
+ int m_width;
+ int m_height;
+ int m_numSamples;
+ int m_referenceCount;
+ Image* m_image;
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief Drawable class for encapsulating color and mask buffers.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Drawable
+{
+public:
+ Drawable(const Color::Descriptor& desc, int width, int height, int numSamples, int maskBits); //throws bad_alloc
+ Drawable(Image* image, int maskBits); //throws bad_alloc
+ Drawable(const Color::Descriptor& desc, int width, int height, int stride, RIuint8* data, int maskBits); //throws bad_alloc
+ ~Drawable();
+
+ RI_INLINE const Color::Descriptor& getDescriptor() const { return m_color->getDescriptor(); }
+ RI_INLINE int getNumMaskBits() const { if(!m_mask) return 0; return m_mask->getDescriptor().alphaBits; }
+ RI_INLINE int getWidth() const { return m_color->getWidth(); }
+ RI_INLINE int getHeight() const { return m_color->getHeight(); }
+ RI_INLINE int getNumSamples() const { return m_color->getNumSamples(); }
+ RI_INLINE void addReference() { m_referenceCount++; }
+ RI_INLINE int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+ RI_INLINE int isInUse() const { return m_color->isInUse() || (m_mask && m_mask->isInUse()); }
+ RI_INLINE bool isInUse(Image* image) const { return m_color->isInUse(image) || (m_mask && m_mask->isInUse(image)); }
+ RI_INLINE Surface* getColorBuffer() const { return m_color; }
+ RI_INLINE Surface* getMaskBuffer() const { return m_mask; }
+
+ void resize(int newWidth, int newHeight); //throws bad_alloc
+private:
+ Drawable(const Drawable&); //!< Not allowed.
+ void operator=(const Drawable&); //!< Not allowed.
+
+ int m_referenceCount;
+ Surface* m_color;
+ Surface* m_mask;
+};
+
+//==============================================================================================
+
+} //namespace OpenVGRI
+
+//==============================================================================================
+
+#endif /* __RIIMAGE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riMath.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,382 @@
+#ifndef __RIMATH_H
+#define __RIMATH_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Math functions, Vector and Matrix classes.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef __RIDEFS_H
+#include "riDefs.h"
+#endif
+
+#include <math.h>
+
+namespace OpenVGRI
+{
+
+/*-------------------------------------------------------------------*//*!
+* \brief
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+RI_INLINE int RI_ISNAN(float a)
+{
+ RIfloatInt p;
+ p.f = a;
+ unsigned int exponent = (p.i>>23) & 0xff;
+ unsigned int mantissa = p.i & 0x7fffff;
+ if(exponent == 255 && mantissa)
+ return 1;
+ return 0;
+}
+
+#if (RI_MANTISSA_BITS > 23)
+#error RI_MANTISSA_BITS is greater than 23
+#elif (RI_EXPONENT_BITS > 8)
+#error RI_EXPONENT_BITS is greater than 8
+#elif (RI_MANTISSA_BITS != 23) || (RI_EXPONENT_BITS != 8)
+
+class RIfloat
+{
+public:
+ RIfloat() : v(0.0f) { removeBits(); }
+ RIfloat(float a) : v(a) { removeBits(); }
+ RIfloat(double a) : v((float)a) { removeBits(); }
+ RIfloat(int a) : v((float)a) { removeBits(); }
+ RIfloat(unsigned int a) : v((float)a) { removeBits(); }
+ RIfloat& operator=(const RIfloat &a) { v = a.v; removeBits(); return *this; }
+ RIfloat& operator+=(const RIfloat &a){ v += a.v; removeBits(); return *this; }
+ RIfloat& operator-=(const RIfloat &a){ v -= a.v; removeBits(); return *this; }
+ RIfloat& operator*=(const RIfloat &a){ v *= a.v; removeBits(); return *this; }
+ RIfloat& operator/=(const RIfloat &a){ v /= a.v; removeBits(); return *this; }
+ RIfloat operator-() const { return -v; }
+ operator float() const { return v; }
+ operator double() const { return (double)v; }
+ operator int() const { return (int)v; }
+
+ friend RIfloat operator+(const RIfloat &a, const RIfloat &b);
+ friend RIfloat operator+(float a, const RIfloat &b);
+ friend RIfloat operator+(const RIfloat &a, float b);
+ friend RIfloat operator-(const RIfloat &a, const RIfloat &b);
+ friend RIfloat operator-(float a, const RIfloat &b);
+ friend RIfloat operator-(const RIfloat &a, float b);
+ friend RIfloat operator*(const RIfloat &a, const RIfloat &b);
+ friend RIfloat operator*(float a, const RIfloat &b);
+ friend RIfloat operator*(const RIfloat &a, float b);
+ friend RIfloat operator/(const RIfloat &a, const RIfloat &b);
+ friend RIfloat operator/(float a, const RIfloat &b);
+ friend RIfloat operator/(const RIfloat &a, float b);
+
+ friend bool operator<(const RIfloat &a, const RIfloat &b);
+ friend bool operator<(float a, const RIfloat &b);
+ friend bool operator<(const RIfloat &a, float b);
+ friend bool operator>(const RIfloat &a, const RIfloat &b);
+ friend bool operator>(float a, const RIfloat &b);
+ friend bool operator>(const RIfloat &a, float b);
+ friend bool operator<=(const RIfloat &a, const RIfloat &b);
+ friend bool operator<=(float a, const RIfloat &b);
+ friend bool operator<=(const RIfloat &a, float b);
+ friend bool operator>=(const RIfloat &a, const RIfloat &b);
+ friend bool operator>=(float a, const RIfloat &b);
+ friend bool operator>=(const RIfloat &a, float b);
+ friend bool operator==(const RIfloat &a, const RIfloat &b);
+ friend bool operator==(float a, const RIfloat &b);
+ friend bool operator==(const RIfloat &a, float b);
+ friend bool operator!=(const RIfloat &a, const RIfloat &b);
+ friend bool operator!=(float a, const RIfloat &b);
+ friend bool operator!=(const RIfloat &a, float b);
+private:
+ void removeBits()
+ {
+ RIfloatInt p;
+ p.f = v;
+ unsigned int exponent = (p.i>>23) & 0xff;
+ if(exponent == 0 || exponent == 255)
+ return; //zero, denormal, infinite, or NaN
+
+ p.i &= ~((1<<(23-RI_MANTISSA_BITS))-1);
+
+#if (RI_EXPONENT_BITS != 8)
+ if (exponent > 127 + (1 << (RI_EXPONENT_BITS-1)))
+ exponent = 127 + (1 << (RI_EXPONENT_BITS-1));
+
+ if (exponent < 127 + 1 - (1 << (RI_EXPONENT_BITS-1)))
+ exponent = 127 + 1 - (1 << (RI_EXPONENT_BITS-1));
+
+ p.i &= ~(0xff<<23);
+ p.i |= exponent<<23;
+#endif
+ v = p.f;
+ }
+
+ float v;
+};
+
+RI_INLINE RIfloat operator+(const RIfloat &a, const RIfloat &b) { return RIfloat(a.v+b.v); }
+RI_INLINE RIfloat operator+(float a, const RIfloat &b) { return RIfloat(a+b.v); }
+RI_INLINE RIfloat operator+(const RIfloat &a, float b) { return RIfloat(a.v+b); }
+RI_INLINE RIfloat operator-(const RIfloat &a, const RIfloat &b) { return RIfloat(a.v-b.v); }
+RI_INLINE RIfloat operator-(float a, const RIfloat &b) { return RIfloat(a-b.v); }
+RI_INLINE RIfloat operator-(const RIfloat &a, float b) { return RIfloat(a.v-b); }
+RI_INLINE RIfloat operator*(const RIfloat &a, const RIfloat &b) { return RIfloat(a.v*b.v); }
+RI_INLINE RIfloat operator*(float a, const RIfloat &b) { return RIfloat(a*b.v); }
+RI_INLINE RIfloat operator*(const RIfloat &a, float b) { return RIfloat(a.v*b); }
+RI_INLINE RIfloat operator/(const RIfloat &a, const RIfloat &b) { return RIfloat(a.v/b.v); }
+RI_INLINE RIfloat operator/(float a, const RIfloat &b) { return RIfloat(a/b.v); }
+RI_INLINE RIfloat operator/(const RIfloat &a, float b) { return RIfloat(a.v/b); }
+
+RI_INLINE bool operator<(const RIfloat &a, const RIfloat &b) { return a.v < b.v ? true : false; }
+RI_INLINE bool operator<(float a, const RIfloat &b) { return a < b.v ? true : false; }
+RI_INLINE bool operator<(const RIfloat &a, float b) { return a.v < b ? true : false; }
+RI_INLINE bool operator>(const RIfloat &a, const RIfloat &b) { return a.v > b.v ? true : false; }
+RI_INLINE bool operator>(float a, const RIfloat &b) { return a > b.v ? true : false; }
+RI_INLINE bool operator>(const RIfloat &a, float b) { return a.v > b ? true : false; }
+RI_INLINE bool operator<=(const RIfloat &a, const RIfloat &b) { return a.v <= b.v ? true : false; }
+RI_INLINE bool operator<=(float a, const RIfloat &b) { return a <= b.v ? true : false; }
+RI_INLINE bool operator<=(const RIfloat &a, float b) { return a.v <= b ? true : false; }
+RI_INLINE bool operator>=(const RIfloat &a, const RIfloat &b) { return a.v >= b.v ? true : false; }
+RI_INLINE bool operator>=(float a, const RIfloat &b) { return a >= b.v ? true : false; }
+RI_INLINE bool operator>=(const RIfloat &a, float b) { return a.v >= b ? true : false; }
+RI_INLINE bool operator==(const RIfloat &a, const RIfloat &b) { return a.v == b.v ? true : false; }
+RI_INLINE bool operator==(float a, const RIfloat &b) { return a == b.v ? true : false; }
+RI_INLINE bool operator==(const RIfloat &a, float b) { return a.v == b ? true : false; }
+RI_INLINE bool operator!=(const RIfloat &a, const RIfloat &b) { return a.v != b.v ? true : false; }
+RI_INLINE bool operator!=(float a, const RIfloat &b) { return a != b.v ? true : false; }
+RI_INLINE bool operator!=(const RIfloat &a, float b) { return a.v != b ? true : false; }
+
+#else
+typedef float RIfloat;
+#endif
+
+#define PI 3.141592654f
+
+RI_INLINE RIfloat RI_MAX(RIfloat a, RIfloat b) { return (a > b) ? a : b; }
+RI_INLINE RIfloat RI_MIN(RIfloat a, RIfloat b) { return (a < b) ? a : b; }
+RI_INLINE RIfloat RI_CLAMP(RIfloat a, RIfloat l, RIfloat h) { if(RI_ISNAN(a)) return l; RI_ASSERT(l <= h); return (a < l) ? l : (a > h) ? h : a; }
+RI_INLINE void RI_SWAP(RIfloat &a, RIfloat &b) { RIfloat tmp = a; a = b; b = tmp; }
+RI_INLINE RIfloat RI_ABS(RIfloat a) { return (a < 0.0f) ? -a : a; }
+RI_INLINE RIfloat RI_SQR(RIfloat a) { return a * a; }
+RI_INLINE RIfloat RI_DEG_TO_RAD(RIfloat a) { return a * PI / 180.0f; }
+RI_INLINE RIfloat RI_RAD_TO_DEG(RIfloat a) { return a * 180.0f/ PI; }
+RI_INLINE RIfloat RI_MOD(RIfloat a, RIfloat b) { if(RI_ISNAN(a) || RI_ISNAN(b)) return 0.0f; RI_ASSERT(b >= 0.0f); if(b == 0.0f) return 0.0f; RIfloat f = (RIfloat)fmod(a, b); if(f < 0.0f) f += b; RI_ASSERT(f >= 0.0f && f <= b); return f; }
+
+RI_INLINE int RI_INT_MAX(int a, int b) { return (a > b) ? a : b; }
+RI_INLINE int RI_INT_MIN(int a, int b) { return (a < b) ? a : b; }
+RI_INLINE void RI_INT_SWAP(int &a, int &b) { int tmp = a; a = b; b = tmp; }
+RI_INLINE int RI_INT_MOD(int a, int b) { RI_ASSERT(b >= 0); if(!b) return 0; int i = a % b; if(i < 0) i += b; RI_ASSERT(i >= 0 && i < b); return i; }
+RI_INLINE int RI_INT_ADDSATURATE(int a, int b) { RI_ASSERT(b >= 0); int r = a + b; return (r >= a) ? r : RI_INT32_MAX; }
+
+class Matrix3x3;
+class Vector2;
+class Vector3;
+
+//==============================================================================================
+
+//MatrixRxC, R = number of rows, C = number of columns
+//indexing: matrix[row][column]
+//Matrix3x3 inline functions cannot be inside the class because Vector3 is not defined yet when Matrix3x3 is defined
+
+class Matrix3x3
+{
+public:
+ RI_INLINE Matrix3x3 (); //initialized to identity
+ RI_INLINE Matrix3x3 ( const Matrix3x3& m );
+ RI_INLINE Matrix3x3 ( RIfloat m00, RIfloat m01, RIfloat m02, RIfloat m10, RIfloat m11, RIfloat m12, RIfloat m20, RIfloat m21, RIfloat m22 );
+ RI_INLINE ~Matrix3x3 ();
+ RI_INLINE Matrix3x3& operator= ( const Matrix3x3& m );
+ RI_INLINE Vector3& operator[] ( int i ); //returns a row vector
+ RI_INLINE const Vector3& operator[] ( int i ) const;
+ RI_INLINE void set ( RIfloat m00, RIfloat m01, RIfloat m02, RIfloat m10, RIfloat m11, RIfloat m12, RIfloat m20, RIfloat m21, RIfloat m22 );
+ RI_INLINE const Vector3 getRow ( int i ) const;
+ RI_INLINE const Vector3 getColumn ( int i ) const;
+ RI_INLINE void setRow ( int i, const Vector3& v );
+ RI_INLINE void setColumn ( int i, const Vector3& v );
+ RI_INLINE void operator*= ( const Matrix3x3& m );
+ RI_INLINE void operator*= ( RIfloat f );
+ RI_INLINE void operator+= ( const Matrix3x3& m );
+ RI_INLINE void operator-= ( const Matrix3x3& m );
+ RI_INLINE const Matrix3x3 operator- () const;
+ RI_INLINE void identity ();
+ RI_INLINE void transpose ();
+ bool invert (); //if the matrix is singular, returns false and leaves it unmodified
+ RI_INLINE RIfloat det () const;
+ RI_INLINE bool isAffine () const;
+
+private:
+ RIfloat matrix[3][3];
+};
+
+//==============================================================================================
+
+class Vector2
+{
+public:
+ RI_INLINE Vector2 () : x(0.0f), y(0.0f) {}
+ RI_INLINE Vector2 ( const Vector2& v ) : x(v.x), y(v.y) {}
+ RI_INLINE Vector2 ( RIfloat fx, RIfloat fy ) : x(fx), y(fy) {}
+ RI_INLINE ~Vector2 () {}
+ RI_INLINE Vector2& operator= ( const Vector2& v ) { x = v.x; y = v.y; return *this; }
+ RI_INLINE RIfloat& operator[] ( int i ) { RI_ASSERT(i>=0&&i<2); return (&x)[i]; }
+ RI_INLINE const RIfloat& operator[] ( int i ) const { RI_ASSERT(i>=0&&i<2); return (&x)[i]; }
+ RI_INLINE void set ( RIfloat fx, RIfloat fy ) { x = fx; y = fy; }
+ RI_INLINE void operator*= ( RIfloat f ) { x *= f; y *= f; }
+ RI_INLINE void operator+= ( const Vector2& v ) { x += v.x; y += v.y; }
+ RI_INLINE void operator-= ( const Vector2& v ) { x -= v.x; y -= v.y; }
+ RI_INLINE const Vector2 operator- () const { return Vector2(-x,-y); }
+ //if the vector is zero, returns false and leaves it unmodified
+ RI_INLINE bool normalize () { double l = (double)x*(double)x+(double)y*(double)y; if( l == 0.0 ) return false; l = 1.0 / sqrt(l); x = (RIfloat)((double)x * l); y = (RIfloat)((double)y * l); return true; }
+ RI_INLINE RIfloat length () const { return (RIfloat)sqrt((double)x*(double)x+(double)y*(double)y); }
+ RI_INLINE void scale ( const Vector2& v ) { x *= v.x; y *= v.y; } //component-wise scale
+ RI_INLINE void negate () { x = -x; y = -y; }
+
+ RIfloat x,y;
+};
+
+//==============================================================================================
+
+class Vector3
+{
+public:
+ RI_INLINE Vector3 () : x(0.0f), y(0.0f), z(0.0f) {}
+ RI_INLINE Vector3 ( const Vector3& v ) : x(v.x), y(v.y), z(v.z) {}
+ RI_INLINE Vector3 ( RIfloat fx, RIfloat fy, RIfloat fz ) : x(fx), y(fy), z(fz) {}
+ RI_INLINE ~Vector3 () {}
+ RI_INLINE Vector3& operator= ( const Vector3& v ) { x = v.x; y = v.y; z = v.z; return *this; }
+ RI_INLINE RIfloat& operator[] ( int i ) { RI_ASSERT(i>=0&&i<3); return (&x)[i]; }
+ RI_INLINE const RIfloat& operator[] ( int i ) const { RI_ASSERT(i>=0&&i<3); return (&x)[i]; }
+ RI_INLINE void set ( RIfloat fx, RIfloat fy, RIfloat fz ){ x = fx; y = fy; z = fz; }
+ RI_INLINE void operator*= ( RIfloat f ) { x *= f; y *= f; z *= f; }
+ RI_INLINE void operator+= ( const Vector3& v ) { x += v.x; y += v.y; z += v.z; }
+ RI_INLINE void operator-= ( const Vector3& v ) { x -= v.x; y -= v.y; z -= v.z; }
+ RI_INLINE const Vector3 operator- () const { return Vector3(-x,-y,-z); }
+ //if the vector is zero, returns false and leaves it unmodified
+ RI_INLINE bool normalize () { double l = (double)x*(double)x+(double)y*(double)y+(double)z*(double)z; if( l == 0.0 ) return false; l = 1.0 / sqrt(l); x = (RIfloat)((double)x * l); y = (RIfloat)((double)y * l); z = (RIfloat)((double)z * l); return true; }
+ RI_INLINE RIfloat length () const { return (RIfloat)sqrt((double)x*(double)x+(double)y*(double)y+(double)z*(double)z); }
+ RI_INLINE void scale ( const Vector3& v ) { x *= v.x; y *= v.y; z *= v.z; } //component-wise scale
+ RI_INLINE void negate () { x = -x; y = -y; z = -z; }
+
+ RIfloat x,y,z;
+};
+
+//==============================================================================================
+
+//Vector2 global functions
+RI_INLINE bool operator== ( const Vector2& v1, const Vector2& v2 ) { return (v1.x == v2.x) && (v1.y == v2.y); }
+RI_INLINE bool operator!= ( const Vector2& v1, const Vector2& v2 ) { return (v1.x != v2.x) || (v1.y != v2.y); }
+RI_INLINE bool isEqual ( const Vector2& v1, const Vector2& v2, RIfloat epsilon ) { return RI_SQR(v2.x-v1.x) + RI_SQR(v2.y-v1.y) <= epsilon*epsilon; }
+RI_INLINE bool isZero ( const Vector2& v ) { return (v.x == 0.0f) && (v.y == 0.0f); }
+RI_INLINE const Vector2 operator* ( RIfloat f, const Vector2& v ) { return Vector2(v.x*f,v.y*f); }
+RI_INLINE const Vector2 operator* ( const Vector2& v, RIfloat f ) { return Vector2(v.x*f,v.y*f); }
+RI_INLINE const Vector2 operator+ ( const Vector2& v1, const Vector2& v2 ) { return Vector2(v1.x+v2.x, v1.y+v2.y); }
+RI_INLINE const Vector2 operator- ( const Vector2& v1, const Vector2& v2 ) { return Vector2(v1.x-v2.x, v1.y-v2.y); }
+RI_INLINE RIfloat dot ( const Vector2& v1, const Vector2& v2 ) { return v1.x*v2.x+v1.y*v2.y; }
+//if v is a zero vector, returns a zero vector
+RI_INLINE const Vector2 normalize ( const Vector2& v ) { double l = (double)v.x*(double)v.x+(double)v.y*(double)v.y; if( l != 0.0 ) l = 1.0 / sqrt(l); return Vector2((RIfloat)((double)v.x * l), (RIfloat)((double)v.y * l)); }
+//if onThis is a zero vector, returns a zero vector
+RI_INLINE const Vector2 project ( const Vector2& v, const Vector2& onThis ) { RIfloat l = dot(onThis,onThis); if( l != 0.0f ) l = dot(v, onThis)/l; return onThis * l; }
+RI_INLINE const Vector2 lerp ( const Vector2& v1, const Vector2& v2, RIfloat ratio ) { return v1 + ratio * (v2 - v1); }
+RI_INLINE const Vector2 scale ( const Vector2& v1, const Vector2& v2 ) { return Vector2(v1.x*v2.x, v1.y*v2.y); }
+//matrix * column vector. The input vector2 is implicitly expanded to (x,y,1)
+RI_INLINE const Vector2 affineTransform( const Matrix3x3& m, const Vector2& v ) { RI_ASSERT(m.isAffine()); return Vector2(v.x * m[0][0] + v.y * m[0][1] + m[0][2], v.x * m[1][0] + v.y * m[1][1] + m[1][2]); }
+//matrix * column vector. The input vector2 is implicitly expanded to (x,y,0)
+RI_INLINE const Vector2 affineTangentTransform(const Matrix3x3& m, const Vector2& v) { RI_ASSERT(m.isAffine()); return Vector2(v.x * m[0][0] + v.y * m[0][1], v.x * m[1][0] + v.y * m[1][1]); }
+RI_INLINE const Vector2 perpendicularCW(const Vector2& v) { return Vector2(v.y, -v.x); }
+RI_INLINE const Vector2 perpendicularCCW(const Vector2& v) { return Vector2(-v.y, v.x); }
+RI_INLINE const Vector2 perpendicular(const Vector2& v, bool cw) { if(cw) return Vector2(v.y, -v.x); return Vector2(-v.y, v.x); }
+
+//==============================================================================================
+
+//Vector3 global functions
+RI_INLINE bool operator== ( const Vector3& v1, const Vector3& v2 ) { return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z); }
+RI_INLINE bool operator!= ( const Vector3& v1, const Vector3& v2 ) { return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z); }
+RI_INLINE bool isEqual ( const Vector3& v1, const Vector3& v2, RIfloat epsilon ) { return RI_SQR(v2.x-v1.x) + RI_SQR(v2.y-v1.y) + RI_SQR(v2.z-v1.z) <= epsilon*epsilon; }
+RI_INLINE const Vector3 operator* ( RIfloat f, const Vector3& v ) { return Vector3(v.x*f,v.y*f,v.z*f); }
+RI_INLINE const Vector3 operator* ( const Vector3& v, RIfloat f ) { return Vector3(v.x*f,v.y*f,v.z*f); }
+RI_INLINE const Vector3 operator+ ( const Vector3& v1, const Vector3& v2 ) { return Vector3(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z); }
+RI_INLINE const Vector3 operator- ( const Vector3& v1, const Vector3& v2 ) { return Vector3(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z); }
+RI_INLINE RIfloat dot ( const Vector3& v1, const Vector3& v2 ) { return v1.x*v2.x+v1.y*v2.y+v1.z*v2.z; }
+RI_INLINE const Vector3 cross ( const Vector3& v1, const Vector3& v2 ) { return Vector3( v1.y*v2.z-v1.z*v2.y, v1.z*v2.x-v1.x*v2.z, v1.x*v2.y-v1.y*v2.x ); }
+//if v is a zero vector, returns a zero vector
+RI_INLINE const Vector3 normalize ( const Vector3& v ) { double l = (double)v.x*(double)v.x+(double)v.y*(double)v.y+(double)v.z*(double)v.z; if( l != 0.0 ) l = 1.0 / sqrt(l); return Vector3((RIfloat)((double)v.x * l), (RIfloat)((double)v.y * l), (RIfloat)((double)v.z * l)); }
+RI_INLINE const Vector3 lerp ( const Vector3& v1, const Vector3& v2, RIfloat ratio ) { return v1 + ratio * (v2 - v1); }
+RI_INLINE const Vector3 scale ( const Vector3& v1, const Vector3& v2 ) { return Vector3(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z); }
+
+//==============================================================================================
+
+//matrix * column vector
+RI_INLINE const Vector3 operator* ( const Matrix3x3& m, const Vector3& v) { return Vector3( v.x*m[0][0]+v.y*m[0][1]+v.z*m[0][2], v.x*m[1][0]+v.y*m[1][1]+v.z*m[1][2], v.x*m[2][0]+v.y*m[2][1]+v.z*m[2][2] ); }
+
+//==============================================================================================
+
+//Matrix3x3 global functions
+RI_INLINE bool operator== ( const Matrix3x3& m1, const Matrix3x3& m2 ) { for(int i=0;i<3;i++) for(int j=0;j<3;j++) if( m1[i][j] != m2[i][j] ) return false; return true; }
+RI_INLINE bool operator!= ( const Matrix3x3& m1, const Matrix3x3& m2 ) { return !(m1 == m2); }
+RI_INLINE const Matrix3x3 operator* ( const Matrix3x3& m1, const Matrix3x3& m2 ) { Matrix3x3 t; for(int i=0;i<3;i++) for(int j=0;j<3;j++) t[i][j] = m1[i][0] * m2[0][j] + m1[i][1] * m2[1][j] + m1[i][2] * m2[2][j]; return t; }
+RI_INLINE const Matrix3x3 operator* ( RIfloat f, const Matrix3x3& m ) { Matrix3x3 t(m); t *= f; return t; }
+RI_INLINE const Matrix3x3 operator* ( const Matrix3x3& m, RIfloat f ) { Matrix3x3 t(m); t *= f; return t; }
+RI_INLINE const Matrix3x3 operator+ ( const Matrix3x3& m1, const Matrix3x3& m2 ) { Matrix3x3 t(m1); t += m2; return t; }
+RI_INLINE const Matrix3x3 operator- ( const Matrix3x3& m1, const Matrix3x3& m2 ) { Matrix3x3 t(m1); t -= m2; return t; }
+RI_INLINE const Matrix3x3 transpose ( const Matrix3x3& m ) { Matrix3x3 t(m); t.transpose(); return t; }
+// if the matrix is singular, returns it unmodified
+RI_INLINE const Matrix3x3 invert ( const Matrix3x3& m ) { Matrix3x3 t(m); t.invert(); return t; }
+
+//==============================================================================================
+
+//Matrix3x3 inline functions (cannot be inside the class because Vector3 is not defined yet when Matrix3x3 is defined)
+RI_INLINE Matrix3x3::Matrix3x3 () { identity(); }
+RI_INLINE Matrix3x3::Matrix3x3 ( const Matrix3x3& m ) { *this = m; }
+RI_INLINE Matrix3x3::Matrix3x3 ( RIfloat m00, RIfloat m01, RIfloat m02, RIfloat m10, RIfloat m11, RIfloat m12, RIfloat m20, RIfloat m21, RIfloat m22 ) { set(m00,m01,m02,m10,m11,m12,m20,m21,m22); }
+RI_INLINE Matrix3x3::~Matrix3x3 () {}
+RI_INLINE Matrix3x3& Matrix3x3::operator= ( const Matrix3x3& m ) { for(int i=0;i<3;i++) for(int j=0;j<3;j++) matrix[i][j] = m.matrix[i][j]; return *this; }
+RI_INLINE Vector3& Matrix3x3::operator[] ( int i ) { RI_ASSERT(i>=0&&i<3); return (Vector3&)matrix[i][0]; }
+RI_INLINE const Vector3& Matrix3x3::operator[] ( int i ) const { RI_ASSERT(i>=0&&i<3); return (const Vector3&)matrix[i][0]; }
+RI_INLINE void Matrix3x3::set ( RIfloat m00, RIfloat m01, RIfloat m02, RIfloat m10, RIfloat m11, RIfloat m12, RIfloat m20, RIfloat m21, RIfloat m22 ) { matrix[0][0] = m00; matrix[0][1] = m01; matrix[0][2] = m02; matrix[1][0] = m10; matrix[1][1] = m11; matrix[1][2] = m12; matrix[2][0] = m20; matrix[2][1] = m21; matrix[2][2] = m22; }
+RI_INLINE const Vector3 Matrix3x3::getRow ( int i ) const { RI_ASSERT(i>=0&&i<3); return Vector3(matrix[i][0], matrix[i][1], matrix[i][2]); }
+RI_INLINE const Vector3 Matrix3x3::getColumn ( int i ) const { RI_ASSERT(i>=0&&i<3); return Vector3(matrix[0][i], matrix[1][i], matrix[2][i]); }
+RI_INLINE void Matrix3x3::setRow ( int i, const Vector3& v ) { RI_ASSERT(i>=0&&i<3); matrix[i][0] = v.x; matrix[i][1] = v.y; matrix[i][2] = v.z; }
+RI_INLINE void Matrix3x3::setColumn ( int i, const Vector3& v ) { RI_ASSERT(i>=0&&i<3); matrix[0][i] = v.x; matrix[1][i] = v.y; matrix[2][i] = v.z; }
+RI_INLINE void Matrix3x3::operator*= ( const Matrix3x3& m ) { *this = *this * m; }
+RI_INLINE void Matrix3x3::operator*= ( RIfloat f ) { for(int i=0;i<3;i++) for(int j=0;j<3;j++) matrix[i][j] *= f; }
+RI_INLINE void Matrix3x3::operator+= ( const Matrix3x3& m ) { for(int i=0;i<3;i++) for(int j=0;j<3;j++) matrix[i][j] += m.matrix[i][j]; }
+RI_INLINE void Matrix3x3::operator-= ( const Matrix3x3& m ) { for(int i=0;i<3;i++) for(int j=0;j<3;j++) matrix[i][j] -= m.matrix[i][j]; }
+RI_INLINE const Matrix3x3 Matrix3x3::operator- () const { return Matrix3x3( -matrix[0][0],-matrix[0][1],-matrix[0][2], -matrix[1][0],-matrix[1][1],-matrix[1][2], -matrix[2][0],-matrix[2][1],-matrix[2][2]); }
+RI_INLINE void Matrix3x3::identity () { for(int i=0;i<3;i++) for(int j=0;j<3;j++) matrix[i][j] = (i == j) ? 1.0f : 0.0f; }
+RI_INLINE void Matrix3x3::transpose () { RI_SWAP(matrix[1][0], matrix[0][1]); RI_SWAP(matrix[2][0], matrix[0][2]); RI_SWAP(matrix[2][1], matrix[1][2]); }
+RI_INLINE RIfloat Matrix3x3::det () const { return matrix[0][0] * (matrix[1][1]*matrix[2][2] - matrix[2][1]*matrix[1][2]) + matrix[0][1] * (matrix[2][0]*matrix[1][2] - matrix[1][0]*matrix[2][2]) + matrix[0][2] * (matrix[1][0]*matrix[2][1] - matrix[2][0]*matrix[1][1]); }
+RI_INLINE bool Matrix3x3::isAffine () const { if(matrix[2][0] == 0.0f && matrix[2][1] == 0.0f && matrix[2][2] == 1.0f) return true; return false; }
+
+//==============================================================================================
+
+} //namespace OpenVGRI
+
+#endif /* __RIMATH_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riMiniEGL.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,233 @@
+#ifndef __RIMINIEGL_H
+#define __RIMINIEGL_H
+
+/*------------------------------------------------------------------------
+ *
+ * EGL 1.3
+ * -------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Simple implementation of EGL 1.3
+ * \note caveats:
+ - always renders into the backbuffer and blits it to window (no single buffered rendering)
+ - no native Windows or Mac OS X pixmap support
+ - no power management events
+ - no support for swap interval
+ * \todo what happens in egl functions when eglTerminate has been called but the context and surface are still in use?
+ * \todo OSDeinitMutex should be called in case getEGL fails.
+ *//*-------------------------------------------------------------------*/
+#include "egl.h"
+#include "riContext.h"
+
+//#ifdef BUILD_WITH_PRIVATE_EGL
+#include "eglinternal.h"
+//#endif
+
+//#ifdef BUILD_WITH_PRIVATE_OPENVG
+#include "openvginternal.h"
+//#endif
+
+//==============================================================================================
+
+namespace OpenVGRI
+{
+class RIEGLSurface;
+class RIEGLContext;
+class RIEGLThread;
+
+/*-------------------------------------------------------------------*//*!
+* \brief
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class RIEGLConfig
+{
+public:
+ RIEGLConfig() : m_desc(Color::formatToDescriptor(VG_sRGBA_8888)), m_configID(0) {}
+ ~RIEGLConfig() {}
+ void set(int r, int g, int b, int a, int l, int bpp, int samples, int maskBits, int ID)
+ {
+ m_desc.redBits = r;
+ m_desc.greenBits = g;
+ m_desc.blueBits = b;
+ m_desc.alphaBits = a;
+ m_desc.luminanceBits = l;
+ m_desc.alphaShift = 0;
+ m_desc.luminanceShift = 0;
+ m_desc.blueShift = b ? a : 0;
+ m_desc.greenShift = g ? a + b : 0;
+ m_desc.redShift = r ? a + b + g : 0;
+ m_desc.format = (VGImageFormat)-1;
+ m_desc.internalFormat = l ? Color::sLA : Color::sRGBA;
+ m_desc.bitsPerPixel = bpp;
+ RI_ASSERT(Color::isValidDescriptor(m_desc));
+ m_samples = samples;
+ m_maskBits = maskBits;
+ m_configID = ID;
+ m_config = (EGLConfig)ID;
+ }
+
+ Color::Descriptor configToDescriptor(bool sRGB, bool premultiplied) const
+ {
+ Color::Descriptor desc = m_desc;
+ unsigned int f = m_desc.luminanceBits ? Color::LUMINANCE : 0;
+ f |= sRGB ? Color::NONLINEAR : 0;
+ f |= premultiplied ? Color::PREMULTIPLIED : 0;
+ desc.internalFormat = (Color::InternalFormat)f;
+ return desc;
+ }
+
+ //EGL RED SIZE bits of Red in the color buffer
+ //EGL GREEN SIZE bits of Green in the color buffer
+ //EGL BLUE SIZE bits of Blue in the color buffer
+ //EGL ALPHA SIZE bits of Alpha in the color buffer
+ //EGL LUMINANCE SIZE bits of Luminance in the color buffer
+ Color::Descriptor m_desc;
+ int m_samples;
+ int m_maskBits;
+ EGLint m_configID; //EGL CONFIG ID unique EGLConfig identifier
+ EGLConfig m_config;
+ //EGL BUFFER SIZE depth of the color buffer (sum of channel bits)
+ //EGL ALPHA MASK SIZE number alpha mask bits (always 8)
+ //EGL BIND TO TEXTURE RGB boolean True if bindable to RGB textures. (always EGL_FALSE)
+ //EGL BIND TO TEXTURE RGBA boolean True if bindable to RGBA textures. (always EGL_FALSE)
+ //EGL COLOR BUFFER TYPE enum color buffer type (EGL_RGB_BUFFER, EGL_LUMINANCE_BUFFER)
+ //EGL CONFIG CAVEAT enum any caveats for the configuration (always EGL_NONE)
+ //EGL DEPTH SIZE integer bits of Z in the depth buffer (always 0)
+ //EGL LEVEL integer frame buffer level (always 0)
+ //EGL MAX PBUFFER WIDTH integer maximum width of pbuffer (always INT_MAX)
+ //EGL MAX PBUFFER HEIGHT integer maximum height of pbuffer (always INT_MAX)
+ //EGL MAX PBUFFER PIXELS integer maximum size of pbuffer (always INT_MAX)
+ //EGL MAX SWAP INTERVAL integer maximum swap interval (always 1)
+ //EGL MIN SWAP INTERVAL integer minimum swap interval (always 1)
+ //EGL NATIVE RENDERABLE boolean EGL TRUE if native rendering APIs can render to surface (always EGL_FALSE)
+ //EGL NATIVE VISUAL ID integer handle of corresponding native visual (always 0)
+ //EGL NATIVE VISUAL TYPE integer native visual type of the associated visual (always EGL_NONE)
+ //EGL RENDERABLE TYPE bitmask which client rendering APIs are supported. (always EGL_OPENVG_BIT)
+ //EGL SAMPLE BUFFERS integer number of multisample buffers (always 0)
+ //EGL SAMPLES integer number of samples per pixel (always 0)
+ //EGL STENCIL SIZE integer bits of Stencil in the stencil buffer (always 0)
+ //EGL SURFACE TYPE bitmask which types of EGL surfaces are supported. (always EGL WINDOW BIT | EGL PIXMAP BIT | EGL PBUFFER BIT)
+ //EGL TRANSPARENT TYPE enum type of transparency supported (always EGL_NONE)
+ //EGL TRANSPARENT RED VALUE integer transparent red value (undefined)
+ //EGL TRANSPARENT GREEN VALUE integer transparent green value (undefined)
+ //EGL TRANSPARENT BLUE VALUE integer transparent blue value (undefined)
+};
+
+
+/*-------------------------------------------------------------------*//*!
+* \brief
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+#define EGL_NUMCONFIGS 60
+
+class RIEGLDisplay
+{
+public:
+ RIEGLDisplay(EGLDisplay id);
+ ~RIEGLDisplay();
+
+ int getNumConfigs() const { return EGL_NUMCONFIGS; }
+ const RIEGLConfig& getConfigByIdx(int i) const { RI_ASSERT(i >= 0 && i < EGL_NUMCONFIGS); return m_configs[i]; }
+ const RIEGLConfig& getConfig(const EGLConfig config) const { for(int i=0;i<EGL_NUMCONFIGS;i++) { if(m_configs[i].m_config == config) return m_configs[i]; } RI_ASSERT(0); return m_configs[0]; }
+
+ EGLDisplay getID() const { return m_id; }
+
+ void addContext(RIEGLContext* ctx) { RI_ASSERT(ctx); m_contexts.push_back(ctx); } //throws bad_alloc
+ void removeContext(RIEGLContext* ctx) { RI_ASSERT(ctx); bool res = m_contexts.remove(ctx); RI_ASSERT(res); RI_UNREF(res); }
+
+ void addSurface(RIEGLSurface* srf) { RI_ASSERT(srf); m_surfaces.push_back(srf); } //throws bad_alloc
+ void removeSurface(RIEGLSurface* srf) { RI_ASSERT(srf); bool res = m_surfaces.remove(srf); RI_ASSERT(res); RI_UNREF(res); }
+
+ EGLBoolean contextExists(const EGLContext ctx) const;
+ EGLBoolean surfaceExists(const EGLSurface srf) const;
+ EGLBoolean configExists(const EGLConfig cfg) const;
+
+private:
+ RIEGLDisplay(const RIEGLDisplay& t);
+ RIEGLDisplay& operator=(const RIEGLDisplay&t);
+
+ EGLDisplay m_id;
+
+ Array<RIEGLContext*> m_contexts;
+ Array<RIEGLSurface*> m_surfaces;
+
+ RIEGLConfig m_configs[EGL_NUMCONFIGS];
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class EGL
+{
+public:
+ EGL();
+ ~EGL();
+
+ void addReference() { m_referenceCount++; }
+ int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+
+ void addDisplay(RIEGLDisplay* display) { RI_ASSERT(display); m_displays.push_back(display); } //throws bad alloc
+ void removeDisplay(RIEGLDisplay* display) { RI_ASSERT(display); bool res = m_displays.remove(display); RI_ASSERT(res); RI_UNREF(res); }
+ RIEGLDisplay* getDisplay(const EGLDisplay displayID) const;
+ EGLDisplay findDisplay(const EGLContext ctx) const;
+
+ void addCurrentThread(RIEGLThread* thread) { RI_ASSERT(thread); m_currentThreads.push_back(thread); } //throws bad alloc
+ void removeCurrentThread(RIEGLThread* thread) { RI_ASSERT(thread); bool res = m_currentThreads.remove(thread); RI_ASSERT(res); RI_UNREF(res); }
+ RIEGLThread* getCurrentThread() const;
+
+ RIEGLThread* getThread();
+ void destroyThread();
+
+ bool isInUse(const void* image) const;
+
+private:
+ EGL(const EGL&); // Not allowed.
+ const EGL& operator=(const EGL&); // Not allowed.
+
+ Array<RIEGLThread*> m_threads; //threads that have called EGL
+ Array<RIEGLThread*> m_currentThreads; //threads that have a bound context
+ Array<RIEGLDisplay*> m_displays;
+
+ int m_referenceCount;
+};
+
+void* eglvgGetCurrentVGContext(void);
+bool eglvgIsInUse(void* image);
+
+} //end of namespace
+
+#endif /* __RIMINIEGL_H */
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riPath.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,188 @@
+#ifndef __RIPATH_H
+#define __RIPATH_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Path class.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _OPENVG_H
+#include "openvg.h"
+#endif
+
+#ifndef __RIMATH_H
+#include "riMath.h"
+#endif
+
+#ifndef __RIARRAY_H
+#include "riArray.h"
+#endif
+
+#ifndef __RIRASTERIZER_H
+#include "riRasterizer.h"
+#endif
+
+//==============================================================================================
+
+namespace OpenVGRI
+{
+
+/*-------------------------------------------------------------------*//*!
+* \brief Storage and operations for VGPath.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Path
+{
+public:
+ Path(VGint format, VGPathDatatype datatype, RIfloat scale, RIfloat bias, int segmentCapacityHint, int coordCapacityHint, VGbitfield caps); //throws bad_alloc
+ ~Path();
+
+ VGint getFormat() const { return m_format; }
+ VGPathDatatype getDatatype() const { return m_datatype; }
+ RIfloat getScale() const { return m_scale; }
+ RIfloat getBias() const { return m_bias; }
+ VGbitfield getCapabilities() const { return m_capabilities; }
+ void setCapabilities(VGbitfield caps) { m_capabilities = caps; }
+ int getNumSegments() const { return m_segments.size(); }
+ int getNumCoordinates() const { return m_data.size() / getBytesPerCoordinate(m_datatype); }
+ void addReference() { m_referenceCount++; }
+ int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+
+ void clear(VGbitfield capabilities);
+ void appendData(const RIuint8* segments, int numSegments, const RIuint8* data); //throws bad_alloc
+ void append(const Path* srcPath); //throws bad_alloc
+ void modifyCoords(int startIndex, int numSegments, const RIuint8* data);
+ void transform(const Path* srcPath, const Matrix3x3& matrix); //throws bad_alloc
+ //returns true if interpolation succeeds, false if start and end paths are not compatible
+ bool interpolate(const Path* startPath, const Path* endPath, RIfloat amount); //throws bad_alloc
+ void fill(const Matrix3x3& pathToSurface, Rasterizer& rasterizer); //throws bad_alloc
+ void stroke(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const Array<RIfloat>& dashPattern, RIfloat dashPhase, bool dashPhaseReset, RIfloat strokeWidth, VGCapStyle capStyle, VGJoinStyle joinStyle, RIfloat miterLimit); //throws bad_alloc
+
+ void getPointAlong(int startIndex, int numSegments, RIfloat distance, Vector2& p, Vector2& t); //throws bad_alloc
+ RIfloat getPathLength(int startIndex, int numSegments); //throws bad_alloc
+ void getPathBounds(RIfloat& minx, RIfloat& miny, RIfloat& maxx, RIfloat& maxy); //throws bad_alloc
+ void getPathTransformedBounds(const Matrix3x3& pathToSurface, RIfloat& minx, RIfloat& miny, RIfloat& maxx, RIfloat& maxy); //throws bad_alloc
+
+private:
+ enum VertexFlags
+ {
+ START_SUBPATH = (1<<0),
+ END_SUBPATH = (1<<1),
+ START_SEGMENT = (1<<2),
+ END_SEGMENT = (1<<3),
+ CLOSE_SUBPATH = (1<<4),
+ IMPLICIT_CLOSE_SUBPATH = (1<<5)
+ };
+ struct Vertex
+ {
+ Vertex() : userPosition(), userTangent(), pathLength(0.0f), flags(0) {}
+ Vector2 userPosition;
+ Vector2 userTangent;
+ RIfloat pathLength;
+ unsigned int flags;
+ };
+ struct StrokeVertex
+ {
+ StrokeVertex() : p(), t(), ccw(), cw(), pathLength(0.0f), flags(0), inDash(false) {}
+ Vector2 p;
+ Vector2 t;
+ Vector2 ccw;
+ Vector2 cw;
+ RIfloat pathLength;
+ unsigned int flags;
+ bool inDash;
+ };
+
+ Path(const Path&); //!< Not allowed.
+ const Path& operator=(const Path&); //!< Not allowed.
+
+ static VGPathSegment getPathSegment(RIuint8 data) { return (VGPathSegment)(data & 0x1e); }
+ static VGPathAbsRel getPathAbsRel(RIuint8 data) { return (VGPathAbsRel)(data & 0x1); }
+ static int segmentToNumCoordinates(VGPathSegment segment);
+ static int countNumCoordinates(const RIuint8* segments, int numSegments);
+ static int getBytesPerCoordinate(VGPathDatatype datatype);
+
+ static void setCoordinate(Array<RIuint8>& data, VGPathDatatype datatype, RIfloat scale, RIfloat bias, int i, RIfloat c);
+
+ RIfloat getCoordinate(int i) const;
+ void setCoordinate(int i, RIfloat c) { setCoordinate(m_data, m_datatype, m_scale, m_bias, i, c); }
+
+ void addVertex(const Vector2& p, const Vector2& t, RIfloat pathLength, unsigned int flags); //throws bad_alloc
+ void addEdge(const Vector2& p0, const Vector2& p1, const Vector2& t0, const Vector2& t1, unsigned int startFlags, unsigned int endFlags); //throws bad_alloc
+
+ void addEndPath(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, bool subpathHasGeometry, unsigned int flags); //throws bad_alloc
+ bool addLineTo(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, bool subpathHasGeometry); //throws bad_alloc
+ bool addQuadTo(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, const Vector2& p2, bool subpathHasGeometry, float strokeWidth); //throws bad_alloc
+ bool addCubicTo(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, const Vector2& p2, const Vector2& p3, bool subpathHasGeometry, float strokeWidth); //throws bad_alloc
+ bool addArcTo(const Matrix3x3& pathToSurface, const Vector2& p0, RIfloat rh, RIfloat rv, RIfloat rot, const Vector2& p1, const Vector2& p1r, VGPathSegment segment, bool subpathHasGeometry, float strokeWidth); //throws bad_alloc
+
+ void tessellate(const Matrix3x3& pathToSurface, float strokeWidth); //throws bad_alloc
+
+ void normalizeForInterpolation(const Path* srcPath); //throws bad_alloc
+
+ void interpolateStroke(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const StrokeVertex& v0, const StrokeVertex& v1, RIfloat strokeWidth) const; //throws bad_alloc
+ void doCap(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const StrokeVertex& v, RIfloat strokeWidth, VGCapStyle capStyle) const; //throws bad_alloc
+ void doJoin(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const StrokeVertex& v0, const StrokeVertex& v1, RIfloat strokeWidth, VGJoinStyle joinStyle, RIfloat miterLimit) const; //throws bad_alloc
+
+ //input data
+ VGint m_format;
+ VGPathDatatype m_datatype;
+ RIfloat m_scale;
+ RIfloat m_bias;
+ VGbitfield m_capabilities;
+ int m_referenceCount;
+ Array<RIuint8> m_segments;
+ Array<RIuint8> m_data;
+
+ //data produced by tessellation
+ struct VertexIndex
+ {
+ int start;
+ int end;
+ };
+ Array<Vertex> m_vertices;
+ int m_numTessVertices;
+ Array<VertexIndex> m_segmentToVertex;
+ RIfloat m_userMinx;
+ RIfloat m_userMiny;
+ RIfloat m_userMaxx;
+ RIfloat m_userMaxy;
+};
+
+//==============================================================================================
+
+} //namespace OpenVGRI
+
+//==============================================================================================
+
+#endif /* __RIPATH_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riPixelPipe.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,155 @@
+#ifndef __RIPIXELPIPE_H
+#define __RIPIXELPIPE_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Paint and PixelPipe classes.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef __RIMATH_H
+#include "riMath.h"
+#endif
+
+#ifndef __RIIMAGE_H
+#include "riImage.h"
+#endif
+
+//=======================================================================
+
+namespace OpenVGRI
+{
+
+/*-------------------------------------------------------------------*//*!
+* \brief Storage and operations for VGPaint.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Paint
+{
+public:
+ Paint();
+ ~Paint();
+ void addReference() { m_referenceCount++; }
+ int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
+
+ struct GradientStop
+ {
+ GradientStop() : offset(0.0f), color(0.0f, 0.0f, 0.0f, 0.0f, Color::sRGBA) {}
+ RIfloat offset;
+ Color color;
+ };
+
+ VGPaintType m_paintType;
+ Color m_paintColor;
+ Color m_inputPaintColor;
+ VGColorRampSpreadMode m_colorRampSpreadMode;
+ Array<GradientStop> m_colorRampStops;
+ Array<GradientStop> m_inputColorRampStops;
+ VGboolean m_colorRampPremultiplied;
+ Vector2 m_inputLinearGradientPoint0;
+ Vector2 m_inputLinearGradientPoint1;
+ Vector2 m_inputRadialGradientCenter;
+ Vector2 m_inputRadialGradientFocalPoint;
+ RIfloat m_inputRadialGradientRadius;
+ Vector2 m_linearGradientPoint0;
+ Vector2 m_linearGradientPoint1;
+ Vector2 m_radialGradientCenter;
+ Vector2 m_radialGradientFocalPoint;
+ RIfloat m_radialGradientRadius;
+ VGTilingMode m_patternTilingMode;
+ Image* m_pattern;
+private:
+ Paint(const Paint&); //!< Not allowed.
+ const Paint& operator=(const Paint&); //!< Not allowed.
+
+ int m_referenceCount;
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief Encapsulates all information needed for painting a pixel.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class PixelPipe
+{
+public:
+ PixelPipe(); //throws bad_alloc
+ ~PixelPipe();
+
+ void pixelPipe(int x, int y, RIfloat coverage, unsigned int sampleMask) const; //rasterizer calls this function for each pixel
+
+ void setDrawable(Drawable* drawable);
+ void setBlendMode(VGBlendMode blendMode);
+ void setMask(bool masking);
+ void setImage(Image* image, VGImageMode imageMode); //image = NULL disables drawImage functionality
+ void setSurfaceToPaintMatrix(const Matrix3x3& surfaceToPaintMatrix);
+ void setSurfaceToImageMatrix(const Matrix3x3& surfaceToImageMatrix);
+ void setImageQuality(VGImageQuality imageQuality);
+ void setTileFillColor(const Color& c);
+ void setPaint(const Paint* paint);
+ void setColorTransform(bool enable, RIfloat values[8]);
+
+private:
+ void linearGradient(RIfloat& g, RIfloat& rho, RIfloat x, RIfloat y) const;
+ void radialGradient(RIfloat& g, RIfloat& rho, RIfloat x, RIfloat y) const;
+ Color integrateColorRamp(RIfloat gmin, RIfloat gmax) const;
+ Color colorRamp(RIfloat gradient, RIfloat rho) const;
+ Color blend(const Color& s, RIfloat ar, RIfloat ag, RIfloat ab, const Color& d, VGBlendMode blendMode) const;
+ void colorTransform(Color& c) const;
+
+ PixelPipe(const PixelPipe&); //!< Not allowed.
+ const PixelPipe& operator=(const PixelPipe&); //!< Not allowed.
+
+ Drawable* m_drawable;
+ bool m_masking;
+ Image* m_image;
+ const Paint* m_paint;
+ Paint m_defaultPaint;
+ VGBlendMode m_blendMode;
+ VGImageMode m_imageMode;
+ VGImageQuality m_imageQuality;
+ Color m_tileFillColor;
+ bool m_colorTransform;
+ RIfloat m_colorTransformValues[8];
+ Matrix3x3 m_surfaceToPaintMatrix;
+ Matrix3x3 m_surfaceToImageMatrix;
+};
+
+//=======================================================================
+
+} //namespace OpenVGRI
+
+//=======================================================================
+
+#endif /* __RIPIXELPIPE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/riRasterizer.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,173 @@
+#ifndef __RIRASTERIZER_H
+#define __RIRASTERIZER_H
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -----------------------------------
+ *
+ * Copyright (c) 2007 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief Rasterizer class.
+ * \note
+ *//*-------------------------------------------------------------------*/
+
+#ifndef __RIMATH_H
+#include "riMath.h"
+#endif
+
+#ifndef __RIARRAY_H
+#include "riArray.h"
+#endif
+
+#ifndef __RIPIXELPIPE_H
+#include "riPixelPipe.h"
+#endif
+
+//=======================================================================
+
+namespace OpenVGRI
+{
+
+/*-------------------------------------------------------------------*//*!
+* \brief Scalar and vector data types used by the rasterizer.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+typedef RIfloat RScalar; //change this if you want to have different precision for rasterizer scalars and RIfloat
+
+struct RVector2
+{
+ RI_INLINE RVector2() { }
+ RI_INLINE RVector2(const Vector2& v) { x = v.x; y = v.y; }
+ RI_INLINE RVector2(RIfloat vx, RIfloat vy) { x = vx; y = vy; }
+ RI_INLINE void set(RIfloat vx, RIfloat vy) { x = vx; y = vy; }
+ RScalar x;
+ RScalar y;
+};
+
+/*-------------------------------------------------------------------*//*!
+* \brief Converts a set of edges to coverage values for each pixel and
+* calls PixelPipe::pixelPipe for painting a pixel.
+* \param
+* \return
+* \note
+*//*-------------------------------------------------------------------*/
+
+class Rasterizer
+{
+public:
+ Rasterizer(); //throws bad_alloc
+ ~Rasterizer();
+
+ void setup(int vpx, int vpy, int vpwidth, int vpheight, VGFillRule fillRule, const PixelPipe* pixelPipe, RIuint32* covBuffer);
+ void setScissor(const Array<Rectangle>& scissors); //throws bad_alloc
+
+ void clear();
+ void addEdge(const Vector2& v0, const Vector2& v1); //throws bad_alloc
+
+ int setupSamplingPattern(VGRenderingQuality renderingQuality, int numFSAASamples);
+ void fill(); //throws bad_alloc
+
+ void getBBox(int& sx, int& sy, int& ex, int& ey) const { sx = m_covMinx; sy = m_covMiny; ex = m_covMaxx; ey = m_covMaxy; }
+private:
+ Rasterizer(const Rasterizer&); //!< Not allowed.
+ const Rasterizer& operator=(const Rasterizer&); //!< Not allowed.
+
+ struct ScissorEdge
+ {
+ ScissorEdge() : x(0), miny(0), maxy(0), direction(0) {}
+ bool operator<(const ScissorEdge& e) const { return x < e.x; }
+ int x;
+ int miny;
+ int maxy;
+ int direction; //1 start, -1 end
+ };
+
+ struct Edge
+ {
+ Edge() : v0(), v1(), direction(1) {}
+ bool operator<(const Edge& e) const { return v0.y < e.v0.y; }
+ RVector2 v0;
+ RVector2 v1;
+ int direction;
+ };
+
+ struct ActiveEdge
+ {
+ ActiveEdge() : v0(), v1(), direction(0), minx(0.0f), maxx(0.0f), n(), cnst(0.0f) {}
+ bool operator<(const ActiveEdge& e) const { return minx < e.minx; }
+ RVector2 v0;
+ RVector2 v1;
+ int direction; //-1 down, 1 up
+ RScalar minx; //for the current scanline
+ RScalar maxx; //for the current scanline
+ RVector2 n;
+ RScalar cnst;
+ };
+
+ struct Sample
+ {
+ Sample() : x(0.0f), y(0.0f), weight(0.0f) {}
+ RScalar x;
+ RScalar y;
+ RScalar weight;
+ };
+
+ void addBBox(const Vector2& v);
+
+ Array<Edge> m_edges;
+ Array<ScissorEdge> m_scissorEdges;
+ bool m_scissor;
+
+ Sample m_samples[RI_MAX_SAMPLES];
+ int m_numSamples;
+ int m_numFSAASamples;
+ RScalar m_sumWeights;
+ RScalar m_sampleRadius;
+
+ Vector2 m_edgeMin;
+ Vector2 m_edgeMax;
+ int m_covMinx;
+ int m_covMiny;
+ int m_covMaxx;
+ int m_covMaxy;
+ int m_vpx;
+ int m_vpy;
+ int m_vpwidth;
+ int m_vpheight;
+ VGFillRule m_fillRule;
+ const PixelPipe* m_pixelPipe;
+ RIuint32* m_covBuffer;
+};
+
+//=======================================================================
+
+} //namespace OpenVGRI
+
+//=======================================================================
+
+#endif /* __RIRASTERIZER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/eglrefimpl/inc/vguinternal.h Fri Jul 02 18:48:10 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Symbian Foundation Ltd
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation Ltd - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Implementation of VGU like interface. Basically every VGU API names but prefixed with do_ e.g. do_vguLine
+*/
+
+#ifndef VGUINTERNAL_H
+#define VGUINTERNAL_H
+
+#include <vgu.h>
+
+/*
+ * defines set of internal vgu functions that are 1:1 with the published vgu functions.
+ * E.g. vguLine -> do_vguLine
+ *
+ * These do_XXX fucntions are called from the libopenvgu.dll (which is a shim) to be processed here
+ */
+
+IMPORT_C VGUErrorCode do_vguLine(VGPath path, VGfloat x0, VGfloat y0, VGfloat x1, VGfloat y1);
+IMPORT_C VGUErrorCode do_vguPolygon(VGPath path, const VGfloat * points, VGint count, VGboolean closed);
+IMPORT_C VGUErrorCode do_vguRect(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height);
+IMPORT_C VGUErrorCode do_vguRoundRect(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat arcWidth, VGfloat arcHeight);
+IMPORT_C VGUErrorCode do_vguEllipse(VGPath path, VGfloat cx, VGfloat cy, VGfloat width, VGfloat height);
+IMPORT_C VGUErrorCode do_vguArc(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat startAngle, VGfloat angleExtent, VGUArcType arcType);
+IMPORT_C VGUErrorCode do_vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, VGfloat * matrix);
+IMPORT_C VGUErrorCode do_vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, VGfloat * matrix);
+IMPORT_C VGUErrorCode 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);
+
+#endif
--- a/egl/eglrefimpl/src/session.cpp Fri Jul 02 12:05:03 2010 +0100
+++ b/egl/eglrefimpl/src/session.cpp Fri Jul 02 18:48:10 2010 +0100
@@ -80,7 +80,7 @@
CEglThreadSession::~CEglThreadSession()
{
- delete iEgl;
+//Emilio delete iEgl;
CEglDriver::Close();
}
@@ -142,8 +142,9 @@
// default display is created when driver is initialised the first time and will
// be destroyed when all threads within process have called eglReleaseThread
+ return do_eglGetDisplay(aDisplayId);
- return KEglDefaultDisplayHandle;
+ //Emilio return KEglDefaultDisplayHandle;
}
void CEglThreadSession::SetEgl(EGL* aEgl)
{
@@ -177,7 +178,7 @@
return EGL_FALSE;
}
- EGL* pEgl = NULL;
+ /* Emilio EGL* pEgl = NULL;
try
{
@@ -220,8 +221,9 @@
{
*aMinor = KEglMinorVersion;
}
+ Emilio */
- return EGL_TRUE;
+ return do_eglInitialize(aDisplay, aMajor, aMinor);
}
EGLBoolean CEglThreadSession::EglTerminate(EGLDisplay aDisplay)
@@ -242,7 +244,8 @@
display->Terminate();
iDriver.Unlock();
- return EGL_TRUE;
+ return do_eglTerminate(aDisplay);
+ //Emilio return EGL_TRUE;
}
TFuncPtrEglProc CEglThreadSession::EglGetProcAddress(const char* aName)
--- a/openvg/openvgrefimplementation/sfopenvg/group/bld.inf Fri Jul 02 12:05:03 2010 +0100
+++ b/openvg/openvgrefimplementation/sfopenvg/group/bld.inf Fri Jul 02 18:48:10 2010 +0100
@@ -23,12 +23,12 @@
sfopenvg.iby /epoc32/rom/include/sfopenvg.iby
PRJ_MMPFILES
+openvg.mmp
+openvgu.mmp
egl.mmp
vgi.mmp
sfopenvg.mmp
-openvg.mmp
-openvgu.mmp
// PRJ_TESTMMPFILES
#include "..\test\group\bld.inf"
--- a/openvg/openvgrefimplementation/sfopenvg/sfopenvg/symbian/riEGLOS.cpp Fri Jul 02 12:05:03 2010 +0100
+++ b/openvg/openvgrefimplementation/sfopenvg/sfopenvg/symbian/riEGLOS.cpp Fri Jul 02 18:48:10 2010 +0100
@@ -101,6 +101,10 @@
return NULL;
}
ctx->iNativeWindowType = (TNativeWindowType*)window;
+ RWindow* win = (RWindow*) window;
+ TSize size = TSize(win->Size());
+ ctx->iNativeWindowType->iSize.iWidth = size.iWidth;
+ ctx->iNativeWindowType->iSize.iHeight = size.iHeight;
return ctx;
}
@@ -128,8 +132,14 @@
OSWindowContext* ctx = (OSWindowContext*)context;
if(ctx)
{
- width=ctx->iNativeWindowType->iSize.iWidth;
- height=ctx->iNativeWindowType->iSize.iHeight;
+ if ( ctx->iNativeWindowType->iSize.iWidth < 360 )
+ ctx->iNativeWindowType->iSize.iWidth;
+ else
+ width= 360;//ctx->iNativeWindowType->iSize.iWidth;
+ if ( ctx->iNativeWindowType->iSize.iHeight < 640 )
+ ctx->iNativeWindowType->iSize.iHeight;
+ else
+ height= 640; //ctx->iNativeWindowType->iSize.iHeight;
}
else
{
--- a/openvg/openvgrefimplementation/sfopenvg/vgi/vgi.cpp Fri Jul 02 12:05:03 2010 +0100
+++ b/openvg/openvgrefimplementation/sfopenvg/vgi/vgi.cpp Fri Jul 02 18:48:10 2010 +0100
@@ -138,8 +138,7 @@
__ASSERT_ALWAYS(eglGetError() == EGL_SUCCESS,User::Invariant());
__ASSERT_ALWAYS(numconfigs == 1,User::Invariant());
- //TSize maxSize(MAX_WIDTH,MAX_HEIGHT);
- TSize maxSize(aSize.iWidth, aSize.iHeight);
+ TSize maxSize(MAX_WIDTH,MAX_HEIGHT);
egl.iPixmap = new(ELeave) CFbsBitmap();
egl.iPixmap->Create( maxSize, EColor16MA );