From c886922cc0b8c32ead0459b581f51ff60fdebbd4 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Wed, 6 Dec 2017 23:47:39 +0000 Subject: Gem 427a3d0e61d61e64e76facfa905c120356383bab osx/x86_64 built 'master:427a3d0e61d61e64e76facfa905c120356383bab' for osx/x86_64 --- Gem/develop/include/Gem/Utils/PixPete.h | 229 +++++++++++++++++--------------- 1 file changed, 121 insertions(+), 108 deletions(-) (limited to 'Gem/develop/include/Gem/Utils/PixPete.h') diff --git a/Gem/develop/include/Gem/Utils/PixPete.h b/Gem/develop/include/Gem/Utils/PixPete.h index cc8005a..c0d141a 100644 --- a/Gem/develop/include/Gem/Utils/PixPete.h +++ b/Gem/develop/include/Gem/Utils/PixPete.h @@ -35,10 +35,10 @@ typedef unsigned char U8; */ #ifdef __APPLE__ -# define SHIFT_ALPHA (24) -# define SHIFT_RED (16) -# define SHIFT_GREEN (8) -# define SHIFT_BLUE (0) +# define SHIFT_ALPHA (24) +# define SHIFT_RED (16) +# define SHIFT_GREEN (8) +# define SHIFT_BLUE (0) # define SHIFT_U (24) # define SHIFT_Y1 (16) @@ -47,10 +47,10 @@ typedef unsigned char U8; #else -# define SHIFT_ALPHA (24) -# define SHIFT_RED (16) -# define SHIFT_GREEN (8) -# define SHIFT_BLUE (0) +# define SHIFT_ALPHA (24) +# define SHIFT_RED (16) +# define SHIFT_GREEN (8) +# define SHIFT_BLUE (0) # define SHIFT_U (0) # define SHIFT_Y1 (8) @@ -62,165 +62,178 @@ const float Pete_Pi=3.141582f; const float Pete_TwoPi=(2.0f*Pete_Pi); const float Pete_HalfPi=(0.5f*Pete_Pi); -static inline void Pete_ZeroMemory(void* pMemory,int nCount) { - char* pCurrent=(char*)pMemory; - char* pEnd=(pCurrent+nCount); - // while (pCurrent=pBufferStart) { + while (pBuffer32Current>=pBufferStart) { - *((PETE_PIXELDATA32*)pBuffer32Current)= - *((PETE_PIXELDATA24*)pBuffer24Current); + *((PETE_PIXELDATA32*)pBuffer32Current)= + *((PETE_PIXELDATA24*)pBuffer24Current); - pBuffer32Current-=SIZEOF_PETE_PIXELDATA32; - pBuffer24Current-=SIZEOF_PETE_PIXELDATA24; - } + pBuffer32Current-=SIZEOF_PETE_PIXELDATA32; + pBuffer24Current-=SIZEOF_PETE_PIXELDATA24; + } } -static inline void Pete_CopyAndConvert16Bit565To32Bit(PETE_PIXELDATA16* pSource,PETE_PIXELDATA32* pOutput,int nPixelCount) { +static inline void Pete_CopyAndConvert16Bit565To32Bit(PETE_PIXELDATA16* pSource,PETE_PIXELDATA32* pOutput,int nPixelCount) +{ - char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA16); - char* pCurrentSource=((char*)pSource); - char* pCurrentOutput=((char*)pOutput); + char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA16); + char* pCurrentSource=((char*)pSource); + char* pCurrentOutput=((char*)pOutput); - while (pCurrentSource>11)&31; - const int nMaskedGreen=(SourceColour>>5)&63; - const int nMaskedBlue=(SourceColour>>0)&31; + const int nMaskedRed=(SourceColour>>11)&31; + const int nMaskedGreen=(SourceColour>>5)&63; + const int nMaskedBlue=(SourceColour>>0)&31; - const int nNormalizedRed=(nMaskedRed<<3)|(nMaskedRed>>2); - const int nNormalizedGreen=(nMaskedGreen<<2)|(nMaskedGreen>>4); - const int nNormalizedBlue=(nMaskedBlue<<3)|(nMaskedBlue>>2); + const int nNormalizedRed=(nMaskedRed<<3)|(nMaskedRed>>2); + const int nNormalizedGreen=(nMaskedGreen<<2)|(nMaskedGreen>>4); + const int nNormalizedBlue=(nMaskedBlue<<3)|(nMaskedBlue>>2); - const PETE_PIXELDATA32 OutputColour= - (nNormalizedRed<<16)| - (nNormalizedGreen<<8)| - (nNormalizedBlue<<0); + const PETE_PIXELDATA32 OutputColour= + (nNormalizedRed<<16)| + (nNormalizedGreen<<8)| + (nNormalizedBlue<<0); - *((PETE_PIXELDATA32*)pCurrentOutput)=OutputColour; + *((PETE_PIXELDATA32*)pCurrentOutput)=OutputColour; - pCurrentSource+=SIZEOF_PETE_PIXELDATA16; - pCurrentOutput+=SIZEOF_PETE_PIXELDATA32; + pCurrentSource+=SIZEOF_PETE_PIXELDATA16; + pCurrentOutput+=SIZEOF_PETE_PIXELDATA32; - } + } } -static inline void Pete_CopyAndConvert32BitTo16Bit565(PETE_PIXELDATA32* pSource,PETE_PIXELDATA16* pOutput,int nPixelCount) { +static inline void Pete_CopyAndConvert32BitTo16Bit565(PETE_PIXELDATA32* pSource,PETE_PIXELDATA16* pOutput,int nPixelCount) +{ - char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA32); - char* pCurrentSource=((char*)pSource); - char* pCurrentOutput=((char*)pOutput); + char* pSourceEnd=((char*)pSource)+(nPixelCount*SIZEOF_PETE_PIXELDATA32); + char* pCurrentSource=((char*)pSource); + char* pCurrentOutput=((char*)pOutput); - while (pCurrentSource>16)&0xff; - const int nSourceGreen=(SourceColour>>8)&0xff; - const int nSourceBlue=(SourceColour>>0)&0xff; + const int nSourceRed=(SourceColour>>16)&0xff; + const int nSourceGreen=(SourceColour>>8)&0xff; + const int nSourceBlue=(SourceColour>>0)&0xff; - const int nMaskedRed=(nSourceRed>>3); - const int nMaskedGreen=(nSourceGreen>>2); - const int nMaskedBlue=(nSourceBlue>>3); + const int nMaskedRed=(nSourceRed>>3); + const int nMaskedGreen=(nSourceGreen>>2); + const int nMaskedBlue=(nSourceBlue>>3); - PETE_PIXELDATA16 OutputColour= - (nMaskedRed<<11)| - (nMaskedGreen<<5)| - (nMaskedBlue<<0); + PETE_PIXELDATA16 OutputColour= + (nMaskedRed<<11)| + (nMaskedGreen<<5)| + (nMaskedBlue<<0); - *((PETE_PIXELDATA16*)pCurrentOutput)=OutputColour; + *((PETE_PIXELDATA16*)pCurrentOutput)=OutputColour; - pCurrentSource+=SIZEOF_PETE_PIXELDATA32; - pCurrentOutput+=SIZEOF_PETE_PIXELDATA16; - } + pCurrentSource+=SIZEOF_PETE_PIXELDATA32; + pCurrentOutput+=SIZEOF_PETE_PIXELDATA16; + } } typedef void* SPete_MemHandle; -inline SPete_MemHandle Pete_NewHandle(int nBytesToAlloc) { - return malloc(nBytesToAlloc); +inline SPete_MemHandle Pete_NewHandle(int nBytesToAlloc) +{ + return malloc(nBytesToAlloc); } -inline void Pete_FreeHandle(SPete_MemHandle InHandle) { - free(InHandle); +inline void Pete_FreeHandle(SPete_MemHandle InHandle) +{ + free(InHandle); } -inline void* Pete_LockHandle(SPete_MemHandle InHandle) { - return InHandle; +inline void* Pete_LockHandle(SPete_MemHandle InHandle) +{ + return InHandle; } -inline void Pete_UnLockHandle(SPete_MemHandle InHandle) { - // do nothing +inline void Pete_UnLockHandle(SPete_MemHandle InHandle) +{ + // do nothing } const int cnBiggestSignedInt=0x7fffffff; -inline int GetLuminance(const U32 inColour) { - const int nRed=(inColour&(0xff<>16; - const int nGreen=(inColour&(0xff<>8; - const int nBlue=(inColour&(0xff<>0; +inline int GetLuminance(const U32 inColour) +{ + const int nRed=(inColour&(0xff<>16; + const int nGreen=(inColour&(0xff<>8; + const int nBlue=(inColour&(0xff<>0; - const int nLuminance = - ((77 * nRed)+ - (150* nGreen)+ // used to be 50 which is plain wrong - (29 * nBlue)); + const int nLuminance = + ((77 * nRed)+ + (150* nGreen)+ // used to be 50 which is plain wrong + (29 * nBlue)); - return nLuminance; + return nLuminance; } #endif /* _INCLUDE__GEM_UTILS_PIXPETE_H_ */ -- cgit v1.2.1