From dd765f80d6657f9d42558019a9a721a98904dae0 Mon Sep 17 00:00:00 2001 From: Josh Pearson Date: Wed, 9 Sep 2015 11:45:09 -0700 Subject: [PATCH] Foramt cleanup on gl-rgb.c --- gl-rgb.c | 78 ++++++++++++++++++++++++++-------------------------- gl-rgb.h | 6 ++-- gl-texture.c | 4 +-- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gl-rgb.c b/gl-rgb.c index 500555a..e364a9d 100755 --- a/gl-rgb.c +++ b/gl-rgb.c @@ -119,41 +119,41 @@ uint16 __glKosAverageBiPixelARGB4444(uint16 p1, uint16 p2) { //===================================================================================================// //== Colorspace Conversion ==// -static uint16 _glConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a) { +static uint16 _glKosConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a) { return (uint16)((a & RGB4_MAX) << ARGB4444_ALPHA_SHIFT) | ((r & RGB4_MAX) << ARGB4444_RED_SHIFT) | ((g & RGB4_MAX) << ARGB4444_GREEN_SHIFT) | ((b & RGB4_MAX)); } -static uint16 _glConvPixelRGBU24(uint8 r, uint8 g, uint8 b) { +static uint16 _glKosConvPixelRGBU24(uint8 r, uint8 g, uint8 b) { return (uint16)((r & RGB5_MAX) << RGB565_RED_SHIFT) | ((g & RGB6_MAX) << RGB565_GREEN_SHIFT) | ((b & RGB5_MAX)); } -static void _glConvPixelsRGBF(int w, int h, float *src, uint16 *dst) { +static void _glKosConvPixelsRGBF(int w, int h, float *src, uint16 *dst) { int i; for(i = 0; i < w * h; i++) { - dst[i] = _glConvPixelRGBU24((uint8)(src[i * 3 + 0] * RGB5_MAX), - (uint8)(src[i * 3 + 1] * RGB6_MAX), - (uint8)(src[i * 3 + 2] * RGB5_MAX)); + dst[i] = _glKosConvPixelRGBU24((uint8)(src[i * 3 + 0] * RGB5_MAX), + (uint8)(src[i * 3 + 1] * RGB6_MAX), + (uint8)(src[i * 3 + 2] * RGB5_MAX)); } } -static void _glConvPixelsRGBAF(int w, int h, float *src, uint16 *dst) { +static void _glKosConvPixelsRGBAF(int w, int h, float *src, uint16 *dst) { int i; for(i = 0; i < w * h; i++) { - dst[i] = _glConvPixelRGBAU32((uint8)(src[i * 4 + 0] * RGB4_MAX), - (uint8)(src[i * 4 + 1] * RGB4_MAX), - (uint8)(src[i * 4 + 2] * RGB4_MAX), - (uint8)(src[i * 4 + 3] * RGB4_MAX)); + dst[i] = _glKosConvPixelRGBAU32((uint8)(src[i * 4 + 0] * RGB4_MAX), + (uint8)(src[i * 4 + 1] * RGB4_MAX), + (uint8)(src[i * 4 + 2] * RGB4_MAX), + (uint8)(src[i * 4 + 3] * RGB4_MAX)); } } -static void _glConvPixelsRGBU24(int w, int h, uint8 *src, uint16 *dst) { +static void _glKosConvPixelsRGBU24(int w, int h, uint8 *src, uint16 *dst) { unsigned char r, g, b; int i; @@ -162,11 +162,11 @@ static void _glConvPixelsRGBU24(int w, int h, uint8 *src, uint16 *dst) { g = (src[i * 3 + 1] * RGB6_MAX) / RGB8_MAX; b = (src[i * 3 + 2] * RGB5_MAX) / RGB8_MAX; - dst[i] = _glConvPixelRGBU24(r, g, b); + dst[i] = _glKosConvPixelRGBU24(r, g, b); } } -static void _glConvPixelsRGBAU32(int w, int h, uint8 *src, uint16 *dst) { +static void _glKosConvPixelsRGBAU32(int w, int h, uint8 *src, uint16 *dst) { unsigned char r, g, b, a; int i; @@ -176,11 +176,11 @@ static void _glConvPixelsRGBAU32(int w, int h, uint8 *src, uint16 *dst) { b = (src[i * 4 + 2] * RGB4_MAX) / RGB8_MAX; a = (src[i * 4 + 3] * RGB4_MAX) / RGB8_MAX; - dst[i] = _glConvPixelRGBAU32(r, g, b, a); + dst[i] = _glKosConvPixelRGBAU32(r, g, b, a); } } -static void _glConvPixelsRGBS24(int w, int h, int8 *src, uint16 *dst) { +static void _glKosConvPixelsRGBS24(int w, int h, int8 *src, uint16 *dst) { unsigned char r, g, b; int i; @@ -189,11 +189,11 @@ static void _glConvPixelsRGBS24(int w, int h, int8 *src, uint16 *dst) { g = ((src[i * 3 + 1] + S8_NEG_OFT) * RGB6_MAX) / RGB8_MAX; b = ((src[i * 3 + 2] + S8_NEG_OFT) * RGB5_MAX) / RGB8_MAX; - dst[i] = _glConvPixelRGBU24(r, g, b); + dst[i] = _glKosConvPixelRGBU24(r, g, b); } } -static void _glConvPixelsRGBAS32(int w, int h, int8 *src, uint16 *dst) { +static void _glKosConvPixelsRGBAS32(int w, int h, int8 *src, uint16 *dst) { unsigned char r, g, b, a; int i; @@ -203,11 +203,11 @@ static void _glConvPixelsRGBAS32(int w, int h, int8 *src, uint16 *dst) { b = ((src[i * 4 + 2] + S8_NEG_OFT) * RGB4_MAX) / RGB8_MAX; a = ((src[i * 4 + 3] + S8_NEG_OFT) * RGB4_MAX) / RGB8_MAX; - dst[i] = _glConvPixelRGBAU32(r, g, b, a); + dst[i] = _glKosConvPixelRGBAU32(r, g, b, a); } } -static void _glConvPixelsRGBS48(int w, int h, int16 *src, uint16 *dst) { +static void _glKosConvPixelsRGBS48(int w, int h, int16 *src, uint16 *dst) { unsigned char r, g, b; int i; @@ -216,11 +216,11 @@ static void _glConvPixelsRGBS48(int w, int h, int16 *src, uint16 *dst) { g = ((src[i * 3 + 1] + S16_NEG_OFT) * RGB6_MAX) / RGB16_MAX; b = ((src[i * 3 + 2] + S16_NEG_OFT) * RGB5_MAX) / RGB16_MAX; - dst[i] = _glConvPixelRGBU24(r, g, b); + dst[i] = _glKosConvPixelRGBU24(r, g, b); } } -static void _glConvPixelsRGBAS64(int w, int h, int16 *src, uint16 *dst) { +static void _glKosConvPixelsRGBAS64(int w, int h, int16 *src, uint16 *dst) { unsigned char r, g, b, a; int i; @@ -230,11 +230,11 @@ static void _glConvPixelsRGBAS64(int w, int h, int16 *src, uint16 *dst) { b = ((src[i * 4 + 2] + S16_NEG_OFT) * RGB4_MAX) / RGB16_MAX; a = ((src[i * 4 + 3] + S16_NEG_OFT) * RGB4_MAX) / RGB16_MAX; - dst[i] = _glConvPixelRGBAU32(r, g, b, a); + dst[i] = _glKosConvPixelRGBAU32(r, g, b, a); } } -static void _glConvPixelsRGBU48(int w, int h, uint16 *src, uint16 *dst) { +static void _glKosConvPixelsRGBU48(int w, int h, uint16 *src, uint16 *dst) { unsigned char r, g, b; int i; @@ -243,11 +243,11 @@ static void _glConvPixelsRGBU48(int w, int h, uint16 *src, uint16 *dst) { g = ((src[i * 3 + 1]) * RGB6_MAX) / RGB16_MAX; b = ((src[i * 3 + 2]) * RGB5_MAX) / RGB16_MAX; - dst[i] = _glConvPixelRGBU24(r, g, b); + dst[i] = _glKosConvPixelRGBU24(r, g, b); } } -static void _glConvPixelsRGBAU64(int w, int h, uint16 *src, uint16 *dst) { +static void _glKosConvPixelsRGBAU64(int w, int h, uint16 *src, uint16 *dst) { unsigned char r, g, b, a; int i; @@ -257,54 +257,54 @@ static void _glConvPixelsRGBAU64(int w, int h, uint16 *src, uint16 *dst) { b = (src[i * 4 + 2] * RGB4_MAX) / RGB16_MAX; a = (src[i * 4 + 3] * RGB4_MAX) / RGB16_MAX; - dst[i] = _glConvPixelRGBAU32(r, g, b, a); + dst[i] = _glKosConvPixelRGBAU32(r, g, b, a); } } -void _glPixelConvertRGB(int format, int w, int h, void *src, uint16 *dst) { +void _glKosPixelConvertRGB(int format, int w, int h, void *src, uint16 *dst) { switch(format) { case GL_BYTE: - _glConvPixelsRGBS24(w, h, (int8 *)src, dst); + _glKosConvPixelsRGBS24(w, h, (int8 *)src, dst); break; case GL_UNSIGNED_BYTE: - _glConvPixelsRGBU24(w, h, (uint8 *)src, dst); + _glKosConvPixelsRGBU24(w, h, (uint8 *)src, dst); break; case GL_SHORT: - _glConvPixelsRGBS48(w, h, (int16 *)src, dst); + _glKosConvPixelsRGBS48(w, h, (int16 *)src, dst); break; case GL_UNSIGNED_SHORT: - _glConvPixelsRGBU48(w, h, (uint16 *)src, dst); + _glKosConvPixelsRGBU48(w, h, (uint16 *)src, dst); break; case GL_FLOAT: - _glConvPixelsRGBF(w, h, (float *)src, dst); + _glKosConvPixelsRGBF(w, h, (float *)src, dst); break; } } -void _glPixelConvertRGBA(int format, int w, int h, void *src, uint16 *dst) { +void _glKosPixelConvertRGBA(int format, int w, int h, void *src, uint16 *dst) { switch(format) { case GL_BYTE: - _glConvPixelsRGBAS32(w, h, (int8 *)src, dst); + _glKosConvPixelsRGBAS32(w, h, (int8 *)src, dst); break; case GL_UNSIGNED_BYTE: - _glConvPixelsRGBAU32(w, h, (uint8 *)src, dst); + _glKosConvPixelsRGBAU32(w, h, (uint8 *)src, dst); break; case GL_SHORT: - _glConvPixelsRGBAS64(w, h, (int16 *)src, dst); + _glKosConvPixelsRGBAS64(w, h, (int16 *)src, dst); break; case GL_UNSIGNED_SHORT: - _glConvPixelsRGBAU64(w, h, (uint16 *)src, dst); + _glKosConvPixelsRGBAU64(w, h, (uint16 *)src, dst); break; case GL_FLOAT: - _glConvPixelsRGBAF(w, h, (float *)src, dst); + _glKosConvPixelsRGBAF(w, h, (float *)src, dst); break; } } diff --git a/gl-rgb.h b/gl-rgb.h index 3d4632e..847078a 100755 --- a/gl-rgb.h +++ b/gl-rgb.h @@ -62,9 +62,9 @@ typedef GLfloat GLrgba4f[4]; #define ARGB_PACK_ARGBF(a,r,g,b) (((a*0xFF) << 24) | ((r*0xFF) << 16) | ((g*0xFF)<<8) | (b*0xFF)) #define S8_NEG_OFT 128 // Absolute Value of Minimum 8bit Signed Range // -#define S16_NEG_OFT 32768 // Absolute Value of Minimum bit Signed Range // +#define S16_NEG_OFT 32768 // Absolute Value of Minimum 16bit Signed Range // -void _glPixelConvertRGB(int format, int w, int h, void *src, uint16 *dst); -void _glPixelConvertRGBA(int format, int w, int h, void *src, uint16 *dst); +void _glKosPixelConvertRGB(int format, int w, int h, void *src, uint16 *dst); +void _glKosPixelConvertRGBA(int format, int w, int h, void *src, uint16 *dst); #endif diff --git a/gl-texture.c b/gl-texture.c index 80c4ffa..2e701ce 100755 --- a/gl-texture.c +++ b/gl-texture.c @@ -273,13 +273,13 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat, switch(internalFormat) { case GL_RGB: - _glPixelConvertRGB(type, width, height, (void *)data, tex); + _glKosPixelConvertRGB(type, width, height, (void *)data, tex); GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->color = (PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED); sq_cpy(GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->data, tex, bytes); break; case GL_RGBA: - _glPixelConvertRGBA(type, width, height, (void *)data, tex); + _glKosPixelConvertRGBA(type, width, height, (void *)data, tex); GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->color = (PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED); sq_cpy(GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->data, tex, bytes); break;