# HG changeset patch # User Faisal Memon # Date 1273853005 -3600 # Node ID 9c70c0a878c06a6a86ca12468a58f36240c948df # Parent 9662a45141efa4f9034be2ed2e1fbeda75f7b267 Merge 3. Improve performance by switching to less aggressive settings for RI_NUM_TESSELLATED_SEGMENTS and RI_MAX_SAMPLES. Ignored the WIN32 specific API decoration defines when doing the merge. Note the code is now optimised in riPath.cpp to change from RI_NUM_TESSELLATED_SEGMENTS to _QUAD, _CUBIC, _ARC settings which are each now set to 8. SVG Tiger now renders in 5 seconds (15 seconds quicker). The quality of the OVG icons is slightly reduced but still very useable. diff -r 9662a45141ef -r 9c70c0a878c0 openvg/openvgrefimplementation/sfopenvg/sfopenvg/riDefs.h --- a/openvg/openvgrefimplementation/sfopenvg/sfopenvg/riDefs.h Fri May 14 16:07:10 2010 +0100 +++ b/openvg/openvgrefimplementation/sfopenvg/sfopenvg/riDefs.h Fri May 14 17:03:25 2010 +0100 @@ -45,8 +45,6 @@ #include #endif -namespace OpenVGRI -{ //make for-clause scope c++ standard compliant on msvc #if defined (_MSC_VER) @@ -59,8 +57,12 @@ #pragma warning(disable:4714) //disable function not __forceinlined warning #endif // _MSC_VER +namespace OpenVGRI +{ //======================================================================= +typedef long long RIint64; +typedef unsigned long long RIuint64; typedef int RIint32; typedef unsigned int RIuint32; typedef short RIint16; @@ -121,17 +123,31 @@ #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_MAX_SAMPLES 1 +#define RI_NUM_TESSELLATED_SEGMENTS_QUAD 8 +#define RI_NUM_TESSELLATED_SEGMENTS_CUBIC 8 +#define RI_NUM_TESSELLATED_SEGMENTS_ARC 8 +#if defined(__GNUC__) && !defined(SF_PROFILE) +# ifndef NDEBUG +# define _DEBUG 1 +# endif +#endif +#if _DEBUG #define RI_DEBUG +#endif #ifdef RI_DEBUG -# define RI_ASSERT assert +# define RI_ASSERT(X) assert(X) #else -# define RI_ASSERT +# define RI_ASSERT(X) (void(0)) #endif +#if defined(RI_DEBUG) +# define RI_PRINTF(...) printf(__VA_ARGS__) +#else +# define RI_PRINTF(...) +#endif #define RI_UNREF(X) ((void)(X)) #define RI_APIENTRY EXPORT_C @@ -147,7 +163,16 @@ bool isValidImageFormat(int format); bool isValidImageFormat(EGLNativePixmapType f); - +RI_INLINE void RI_MEM_ZERO(void *dst, size_t n) +{ + RI_ASSERT(n > 0); + RI_ASSERT((n & 0x3) == 0); + RIuint32 *ptr = (RIuint32*)dst; + for(size_t i = 0; i < (n>>2); i++) + { + *ptr++ = 0; + } +} //======================================================================= } //namespace OpenVGRI diff -r 9662a45141ef -r 9c70c0a878c0 openvg/openvgrefimplementation/sfopenvg/sfopenvg/riPath.cpp --- a/openvg/openvgrefimplementation/sfopenvg/sfopenvg/riPath.cpp Fri May 14 16:07:10 2010 +0100 +++ b/openvg/openvgrefimplementation/sfopenvg/sfopenvg/riPath.cpp Fri May 14 17:03:25 2010 +0100 @@ -2009,7 +2009,7 @@ if(!subpathHasGeometry) startFlags |= START_SUBPATH; - const int segments = RI_NUM_TESSELLATED_SEGMENTS; + const int segments = RI_NUM_TESSELLATED_SEGMENTS_QUAD; Vector2 pp = p0; Vector2 tp = incomingTangent; unsigned int prevFlags = startFlags; @@ -2073,7 +2073,7 @@ if(!subpathHasGeometry) startFlags |= START_SUBPATH; - const int segments = RI_NUM_TESSELLATED_SEGMENTS; + const int segments = RI_NUM_TESSELLATED_SEGMENTS_CUBIC; Vector2 pp = p0; Vector2 tp = incomingTangent; unsigned int prevFlags = startFlags; @@ -2241,7 +2241,7 @@ outgoingTangent = normalize(outgoingTangent); RI_ASSERT(!isZero(incomingTangent) && !isZero(outgoingTangent)); - const int segments = RI_NUM_TESSELLATED_SEGMENTS; + const int segments = RI_NUM_TESSELLATED_SEGMENTS_ARC; Vector2 pp = p0; Vector2 tp = incomingTangent; unsigned int prevFlags = startFlags;