[CHG] Using some macro to make the code easier to read

This commit is contained in:
Crayon2000 2009-11-06 16:58:14 +00:00
parent f31e16e0f5
commit 0ac411a9e8

View file

@ -74,12 +74,12 @@ void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc,
for (x = 0; x < texsrc->w; x++) { for (x = 0; x < texsrc->w; x++) {
color = GRRLIB_GetPixelFromtexImg(x, y, texsrc); color = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
gray = (((color >> 24 & 0xFF)* 77 + gray = ((R(color)* 77 +
(color >> 16 & 0xFF)*150 + G(color)*150 +
(color >> 8 & 0xFF)* 28 ) / 255); B(color)* 28 ) / 255);
GRRLIB_SetPixelTotexImg(x, y, texdest, GRRLIB_SetPixelTotexImg(x, y, texdest,
((gray << 24) | (gray << 16) | (gray << 8) | (color & 0xFF))); ((gray << 24) | (gray << 16) | (gray << 8) | A(color)));
} }
} }
GRRLIB_SetHandle(texdest, 0, 0); GRRLIB_SetHandle(texdest, 0, 0);
@ -105,7 +105,7 @@ void GRRLIB_BMFX_Sepia (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) {
sb = R(color)*0.272 + G(color)*0.534 + B(color)*0.131; sb = R(color)*0.272 + G(color)*0.534 + B(color)*0.131;
if (sr>255) sr=255; if (sg>255) sg=255; if (sb>255) sb=255; if (sr>255) sr=255; if (sg>255) sg=255; if (sb>255) sb=255;
GRRLIB_SetPixelTotexImg(x, y, texdest, GRRLIB_SetPixelTotexImg(x, y, texdest,
GRRLIB_GetColor(sr,sg,sb,color&0xFF)); GRRLIB_GetColor(sr,sg,sb,A(color)));
} }
} }
GRRLIB_SetHandle(texdest, 0, 0); GRRLIB_SetHandle(texdest, 0, 0);