Mercurial > hg > dmlib
changeset 971:f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
struct definition.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Feb 2015 06:10:16 +0200 |
parents | 6c33c92de066 |
children | 6d5edc6af2ad |
files | src/dmblitfunc.h src/dmlib.h src/dmlinefunc.h src/libgfx.h |
diffstat | 4 files changed, 41 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dmblitfunc.h Fri Feb 27 05:33:48 2015 +0200 +++ b/src/dmblitfunc.h Fri Feb 27 06:10:16 2015 +0200 @@ -70,14 +70,14 @@ #define DM_BLITFUNC_SRC_BYTES 1 #define DM_BLITFUNC_DST_BYTES 4 #define DM_BLITFUNC_SRC_TYPE Uint8 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 -#define DM_BLITFUNC_VARS const DMRGBA32 *pal; +#define DM_BLITFUNC_DST_TYPE DMColor +#define DM_BLITFUNC_VARS const DMColor *pal; #define DM_BLITFUNC_INIT \ if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \ - pal = (DMRGBA32 *) src->format->palette->colors; + pal = (DMColor *) src->format->palette->colors; #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = pal[sp[FP_GETH16(xv)]]; \ + const DMColor q = pal[sp[FP_GETH16(xv)]]; \ dp->r += ((q.r - dp->r) * q.a) >> 8; \ dp->g += ((q.g - dp->g) * q.a) >> 8; \ dp->b += ((q.b - dp->b) * q.a) >> 8; \ @@ -131,10 +131,10 @@ #else -#define DM_BLITFUNC_SRC_TYPE DMRGBA32 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 +#define DM_BLITFUNC_SRC_TYPE DMColor +#define DM_BLITFUNC_DST_TYPE DMColor #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = sp[FP_GETH16(xv)]; \ + const DMColor q = sp[FP_GETH16(xv)]; \ dp->r += ((q.r - dp->r) * q.a) >> 8; \ dp->g += ((q.g - dp->g) * q.a) >> 8; \ dp->b += ((q.b - dp->b) * q.a) >> 8; \ @@ -149,12 +149,12 @@ #define DM_BLITFUNC_NAME dmScaledBlitSurface32to32TransparentX #define DM_BLITFUNC_SRC_BYTES 4 #define DM_BLITFUNC_DST_BYTES 4 -#define DM_BLITFUNC_SRC_TYPE DMRGBA32 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 +#define DM_BLITFUNC_SRC_TYPE DMColor +#define DM_BLITFUNC_DST_TYPE DMColor #define DM_BLITFUNC_INIT #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = sp[FP_GETH16(xv)]; \ + const DMColor q = sp[FP_GETH16(xv)]; \ dp->r = (q.r * q.a + dp->r * dp->a) >> 8; \ dp->g = (q.g * q.a + dp->g * dp->a) >> 8; \ dp->b = (q.b * q.a + dp->b * dp->a) >> 8; \ @@ -221,10 +221,10 @@ #else -#define DM_BLITFUNC_SRC_TYPE DMRGBA32 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 +#define DM_BLITFUNC_SRC_TYPE DMColor +#define DM_BLITFUNC_DST_TYPE DMColor #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = sp[FP_GETH16(xv)]; \ + const DMColor q = sp[FP_GETH16(xv)]; \ const int a = (alpha * q.a) >> 8; \ dp->r += ((q.r - dp->r) * a) >> 8; \ dp->g += ((q.g - dp->g) * a) >> 8; \ @@ -256,11 +256,11 @@ #define DM_BLITFUNC_SRC_BYTES 1 #define DM_BLITFUNC_DST_BYTES 4 #define DM_BLITFUNC_SRC_TYPE Uint8 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 -#define DM_BLITFUNC_VARS const DMRGBA32 *pal; +#define DM_BLITFUNC_DST_TYPE DMColor +#define DM_BLITFUNC_VARS const DMColor *pal; #define DM_BLITFUNC_INIT \ if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \ - pal = (DMRGBA32 *) src->format->palette->colors; + pal = (DMColor *) src->format->palette->colors; #ifdef DM_USE_SIMD #define DM_BLITFUNC_INNER \ @@ -275,7 +275,7 @@ #define DM_BLITFUNC_FINISH asm("emms\n"); #else #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = pal[sp[FP_GETH16(xv)]]; \ + const DMColor q = pal[sp[FP_GETH16(xv)]]; \ const int qr = dp->r + q.r, qg = dp->g + q.g, qb = dp->b + q.b; \ dp->r = qr < 256 ? qr : 255; \ dp->g = qg < 256 ? qg : 255; \ @@ -307,10 +307,10 @@ #define DM_BLITFUNC_FINISH asm("emms\n"); #else -#define DM_BLITFUNC_SRC_TYPE DMRGBA32 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 +#define DM_BLITFUNC_SRC_TYPE DMColor +#define DM_BLITFUNC_DST_TYPE DMColor #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = sp[FP_GETH16(xv)]; \ + const DMColor q = sp[FP_GETH16(xv)]; \ const int qr = dp->r + q.r, qg = dp->g + q.g, qb = dp->b + q.b; \ dp->r = qr < 256 ? qr : 255; \ dp->g = qg < 256 ? qg : 255; \ @@ -393,14 +393,14 @@ #define DM_BLITFUNC_SRC_BYTES 1 #define DM_BLITFUNC_DST_BYTES 4 #define DM_BLITFUNC_SRC_TYPE Uint8 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 -#define DM_BLITFUNC_VARS const DMRGBA32 *pal; +#define DM_BLITFUNC_DST_TYPE DMColor +#define DM_BLITFUNC_VARS const DMColor *pal; #define DM_BLITFUNC_INIT \ if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \ - pal = (DMRGBA32 *) src->format->palette->colors; + pal = (DMColor *) src->format->palette->colors; #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = pal[sp[xv]]; \ + const DMColor q = pal[sp[xv]]; \ dp->r += ((q.r - dp->r) * q.a) >> 8; \ dp->g += ((q.g - dp->g) * q.a) >> 8; \ dp->b += ((q.b - dp->b) * q.a) >> 8; \ @@ -454,10 +454,10 @@ #else -#define DM_BLITFUNC_SRC_TYPE DMRGBA32 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 +#define DM_BLITFUNC_SRC_TYPE DMColor +#define DM_BLITFUNC_DST_TYPE DMColor #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = sp[xv]; \ + const DMColor q = sp[xv]; \ dp->r += ((q.r - dp->r) * q.a) >> 8; \ dp->g += ((q.g - dp->g) * q.a) >> 8; \ dp->b += ((q.b - dp->b) * q.a) >> 8; \ @@ -489,11 +489,11 @@ #define DM_BLITFUNC_SRC_BYTES 1 #define DM_BLITFUNC_DST_BYTES 4 #define DM_BLITFUNC_SRC_TYPE Uint8 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 -#define DM_BLITFUNC_VARS const DMRGBA32 *pal; +#define DM_BLITFUNC_DST_TYPE DMColor +#define DM_BLITFUNC_VARS const DMColor *pal; #define DM_BLITFUNC_INIT \ if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \ - pal = (DMRGBA32 *) src->format->palette->colors; + pal = (DMColor *) src->format->palette->colors; #ifdef DM_USE_SIMD #define DM_BLITFUNC_INNER \ @@ -508,7 +508,7 @@ #define DM_BLITFUNC_FINISH asm("emms\n"); #else #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = pal[sp[xv]]; \ + const DMColor q = pal[sp[xv]]; \ const int qr = dp->r + q.r, qg = dp->g + q.g, qb = dp->b + q.b; \ dp->r = qr < 256 ? qr : 255; \ dp->g = qg < 256 ? qg : 255; \ @@ -540,10 +540,10 @@ #define DM_BLITFUNC_FINISH asm("emms\n"); #else -#define DM_BLITFUNC_SRC_TYPE DMRGBA32 -#define DM_BLITFUNC_DST_TYPE DMRGBA32 +#define DM_BLITFUNC_SRC_TYPE DMColor +#define DM_BLITFUNC_DST_TYPE DMColor #define DM_BLITFUNC_INNER \ - const DMRGBA32 q = sp[xv]; \ + const DMColor q = sp[xv]; \ const int qr = dp->r + q.r, qg = dp->g + q.g, qb = dp->b + q.b; \ dp->r = qr < 256 ? qr : 255; \ dp->g = qg < 256 ? qg : 255; \
--- a/src/dmlib.h Fri Feb 27 05:33:48 2015 +0200 +++ b/src/dmlib.h Fri Feb 27 06:10:16 2015 +0200 @@ -166,7 +166,7 @@ #elif (SDL_BYTEORDER == SDL_LIL_ENDIAN) Uint8 r,g,b,a; #endif -} DMRGBA32; +} DMColor; typedef float DMFloat;
--- a/src/dmlinefunc.h Fri Feb 27 05:33:48 2015 +0200 +++ b/src/dmlinefunc.h Fri Feb 27 06:10:16 2015 +0200 @@ -23,10 +23,10 @@ #define DM_DRAWLINE_NAME dmDrawLine32Transparent #define DM_DRAWLINE_DST_BYTES 4 -#define DM_DRAWLINE_DST_TYPE DMRGBA32 -#define DM_DRAWLINE_INIT const DMRGBA32 *c = (DMRGBA32*) &col; +#define DM_DRAWLINE_DST_TYPE DMColor +#define DM_DRAWLINE_INIT const DMColor *c = (DMColor*) &col; #define DM_DRAWLINE_INNER \ - const DMRGBA32 q = pix[y0 + x0]; \ + const DMColor q = pix[y0 + x0]; \ const int qr = (q.r + c->r) >> 1, qg = (q.g + c->g) >> 1, qb = (q.b + c->b) >> 1; \ pix[y0 + x0].r = qr; \ pix[y0 + x0].g = qg; \ @@ -47,10 +47,10 @@ #define DM_DRAWLINE_NAME dmDrawLine32Saturate #define DM_DRAWLINE_DST_BYTES 4 -#define DM_DRAWLINE_DST_TYPE DMRGBA32 -#define DM_DRAWLINE_INIT const DMRGBA32 *c = (DMRGBA32*) &col; +#define DM_DRAWLINE_DST_TYPE DMColor +#define DM_DRAWLINE_INIT const DMColor *c = (DMColor*) &col; #define DM_DRAWLINE_INNER \ - const DMRGBA32 q = pix[y0 + x0]; \ + const DMColor q = pix[y0 + x0]; \ const int qr = q.r + c->r, qg = q.g + c->g, qb = q.b + c->b; \ pix[y0 + x0].r = qr < 255 ? qr : 255; \ pix[y0 + x0].g = qg < 255 ? qg : 255; \