# HG changeset patch # User Faisal Memon # Date 1273848093 -3600 # Node ID 5c983aa672eae0769d02a13f228090bed0f9f7cf # Parent 4ac0d9f65e95cfbeecb57db20a50816b317a19c1 Merge 1. Pull in cpp files in the performance enhanced Khronos RI OVG files which are newly added. I've ignored platform-specific cpp files for linux, macosx, and null operating systems because this local solution has its own platform glue (i.e. facility to target Bitmaps but no full windowing support). I've ignored sfEGLInterface.cpp because this is used as a bridge to go from EGL to Nokia's Platsim which offers an EGL service. That's not relevant to this implementation because this is ARM side code, not Intel side. I just left a comment to sfEGLInterface.cpp in case we need to pick up this later on. The current code compiles on winscw. Prior to this fix, the code works on winscw, and can launch the SVG tiger (tiger.exe). That takes about 20 seconds to render. I hope to always be able to show this icon on each commit, and the plan is for the render time to reduce with this series of submissions. On this commit, the tiger renders ok in 20 seconds. diff -r 4ac0d9f65e95 -r 5c983aa672ea openvg/openvgrefimplementation/sfopenvg/group/sfopenvg.mmp --- a/openvg/openvgrefimplementation/sfopenvg/group/sfopenvg.mmp Thu May 13 14:19:38 2010 +0100 +++ b/openvg/openvgrefimplementation/sfopenvg/group/sfopenvg.mmp Fri May 14 15:41:33 2010 +0100 @@ -63,6 +63,9 @@ source riPixelPipe.cpp source riRasterizer.cpp source riVGU.cpp +source riUtils.cpp +// source sfEGLInterface.cpp is skipped because this contains adaptation to +// use Nokia Platsim interfaces to provide EGL services //for EGL SOURCEPATH ..\sfopenvg\symbian diff -r 4ac0d9f65e95 -r 5c983aa672ea openvg/openvgrefimplementation/sfopenvg/sfopenvg/riUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openvg/openvgrefimplementation/sfopenvg/sfopenvg/riUtils.cpp Fri May 14 15:41:33 2010 +0100 @@ -0,0 +1,113 @@ +/*------------------------------------------------------------------------ + * + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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. + * + *//*-------------------------------------------------------------------*/ + +#ifndef __RIUTILS_H_ +# include "riUtils.h" +#endif + +#include + +namespace OpenVGRI +{ + +/** + * \brief Sets mem areas to byte(s) in c. + * \param dst Destination pointer. + * \param c Data to set into dst. + * \param nElements Amount of elements to set. + * \param nBytesPerElement Amount of bytes for each element. + * \note This is moslty an image-settings support function. It is assumed that several + * bytes / elements can be set at once, especially in 3-byte case. + */ +void riMemSet32(void* dst, RIuint32 c, size_t nElements, size_t nBytesPerElement) +{ + // \todo This function should be called from a function that handles npot element sizes. + // \todo Investigate the status of (open) std::fill implementations. Some of that code + // did not _seem_ to bundle sets or use SSE, etc. + // \todo Use SSE instructions on Intel? + + RI_ASSERT(dst); + RI_ASSERT(nElements); + + switch(nBytesPerElement) + { + case 4: + { + RIuint32* ptr = (RIuint32*)dst; + do { + *ptr++ = c; + } while(--nElements); + break; + } + case 3: + { + // \todo Endianness. + RIuint8* ptr = (RIuint8*)dst; + RIuint8 b[3]; + b[0] = c & 0xff; + b[1] = (c >> 8)&0xff; + b[2] = (c >> 16)&0xff; + do { + *ptr++ = b[0]; + *ptr++ = b[1]; + *ptr++ = b[2]; + } while(--nElements); + break; + } + case 2: + { + size_t dws = nElements / 2; + if (dws) + { + RIuint32* ptr32 = (RIuint32*)dst; + dst = (void*)(((RIuint8*)dst + dws * 4)); + RIuint32 dw = c | (c<<16); + do { + *ptr32++ = dw; + } while(--dws); + nElements &= 0x01; + } + if (nElements) + { + RIuint16 *ptr16 = (RIuint16*)dst; + const RIuint16 w = (RIuint16)c; + do { + *ptr16++ = w; + } while(--nElements); + } + } + case 1: + { + memset(dst, c, nElements); + break; + } + default: + RI_ASSERT(false); + } + +} + +} + diff -r 4ac0d9f65e95 -r 5c983aa672ea openvg/openvgrefimplementation/sfopenvg/sfopenvg/riUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openvg/openvgrefimplementation/sfopenvg/sfopenvg/riUtils.h Fri May 14 15:41:33 2010 +0100 @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------ + * + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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. + * + *//*-------------------------------------------------------------------*/ + +#ifndef __RIUTILS_H_ +#define __RIUTILS_H_ + +#ifndef __RIDEFS_H +# include "riDefs.h" +#endif + +// This file contains "utility" functions that did not "fit" into existing RI files. +// Once more functionality is accumulated, the corresponding functions/classes should be +// moved to proper files asap. For example, the memcopy functions could go into file +// "riMemory.xxx". + +namespace OpenVGRI +{ + +void riMemSet32(void* dst, RIuint32 c, size_t nElements, size_t nBytesPerElement); + +} + +#endif +