use (A)RGB_JOIN macro

SVN revision: 49562
This commit is contained in:
Vincent Torri 2010-06-08 05:39:46 +00:00
parent 6aac60a150
commit 7eacb5c1d4
7 changed files with 40 additions and 70 deletions

View File

@ -40,7 +40,7 @@ read_int(FILE *file, int *ret)
{
unsigned char b[4];
if (fread(b, sizeof(unsigned char), 4, file) != 4) return 0;
*ret = (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0];
*ret = ARGB_JOIN(b[3], b[2], b[1], b[0]);
return 1;
}
@ -562,7 +562,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (fread(&a, 1, 1, f) != 1) goto close_file;
}
a = 0xff; // fillin a as solid for paletted images
pal[i] = (a << 24) | (r << 16) | (g << 8) | b;
pal[i] = ARGB_JOIN(a, r, g, b);
}
fseek(f, offset, SEEK_SET);
buffer = malloc(image_size + 8); // add 8 for padding to avoid checks
@ -900,7 +900,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
r = (tmp >> 7) & 0xf8; r |= r >> 5;
g = (tmp >> 2) & 0xf8; g |= g >> 5;
b = (tmp << 3) & 0xf8; b |= b >> 5;
*pix = 0xff000000 | (r << 16) | (g << 8) | (b);
*pix = ARGB_JOIN(0xff, r, g, b);
p += 2;
if (p >= buffer_end) break;
pix++;
@ -921,7 +921,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
b = p[0];
g = p[1];
r = p[2];
*pix = 0xff000000 | (r << 16) | (g << 8) | (b);
*pix = ARGB_JOIN(0xff, r, g, b);
p += 3;
if (p >= buffer_end) break;
pix++;
@ -944,7 +944,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
r = p[2];
a = p[3];
if (!hasa) a = 0xff;
*pix = (a << 24) | (r << 16) | (g << 8) | (b);
*pix = ARGB_JOIN(a, r, g, b);
p += 4;
if (p >= buffer_end) break;
pix++;
@ -990,7 +990,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
r = (tmp >> 8) & 0xf8; r |= r >> 5;
g = (tmp >> 3) & 0xfc; g |= g >> 6;
b = (tmp << 3) & 0xf8; b |= b >> 5;
*pix = 0xff000000 | (r << 16) | (g << 8) | (b);
*pix = ARGB_JOIN(0xff, r, g, b);
p += 2;
if (p >= buffer_end) break;
pix++;
@ -1017,7 +1017,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
r = (tmp >> 7) & 0xf8; r |= r >> 5;
g = (tmp >> 2) & 0xf8; g |= g >> 5;
b = (tmp << 3) & 0xf8; b |= b >> 5;
*pix = 0xff000000 | (r << 16) | (g << 8) | (b);
*pix = ARGB_JOIN(0xff, r, g, b);
p += 2;
if (p >= buffer_end) break;
pix++;
@ -1040,7 +1040,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
r = p[2];
a = p[3];
if (!hasa) a = 0xff;
*pix = (a << 24) | (r << 16) | (g << 8) | (b);
*pix = ARGB_JOIN(a, r, g, b);
p += 4;
if (p >= buffer_end) break;
pix++;

View File

@ -272,14 +272,14 @@ evas_image_load_file_data_gif(Image_Entry *ie, const char *file, const char *key
r = cmap->Colors[bg].Red;
g = cmap->Colors[bg].Green;
b = cmap->Colors[bg].Blue;
*ptr++ = 0x00ffffff & ((r << 16) | (g << 8) | b);
*ptr++ = 0x00ffffff & RGB_JOIN(r, g, b);
}
else
{
r = cmap->Colors[rows[i][j]].Red;
g = cmap->Colors[rows[i][j]].Green;
b = cmap->Colors[rows[i][j]].Blue;
*ptr++ = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr++ = ARGB_JOIN(0xff, r, g, b);
}
per += per_inc;
}

View File

@ -493,8 +493,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, FILE *f, int *error)
{
for (x = 0; x < w; x++)
{
*ptr2 =
(0xff000000) | ((ptr[0]) << 16) | ((ptr[1]) << 8) | (ptr[2]);
*ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[1], ptr[2]);
ptr += 3;
ptr2++;
}
@ -525,8 +524,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, FILE *f, int *error)
ptr += (3 * ie->load_opts.region.x);
for (x = 0; x < ie->load_opts.region.w; x++)
{
*ptr2 =
(0xff000000) | ((ptr[0]) << 16) | ((ptr[1]) << 8) | (ptr[2]);
*ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[1], ptr[2]);
ptr += 3;
ptr2++;
}
@ -560,8 +558,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, FILE *f, int *error)
{
for (x = 0; x < w; x++)
{
*ptr2 =
(0xff000000) | ((ptr[0]) << 16) | ((ptr[0]) << 8) | (ptr[0]);
*ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[0], ptr[0]);
ptr++;
ptr2++;
}
@ -588,8 +585,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, FILE *f, int *error)
ptr += ie->load_opts.region.x;
for (x = 0; x < ie->load_opts.region.w; x++)
{
*ptr2 =
(0xff000000) | ((ptr[0]) << 16) | ((ptr[0]) << 8) | (ptr[0]);
*ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[0], ptr[0]);
ptr++;
ptr2++;
}

View File

@ -494,7 +494,7 @@ pmaps_buffer_rgb_get(Pmaps_Buffer *b, DATA32 *color)
if (vb > 255)
vb = 255;
*color = 0xff000000 | (vr << 16) | (vg << 8) | vb;
*color = ARGB_JOIN(0xff, vr, vg, vb);
return 1;
}
@ -511,7 +511,7 @@ pmaps_buffer_gray_get(Pmaps_Buffer *b, DATA32 *color)
val = (val * 255) / b->max;
if (val > 255)
val = 255;
*color = 0xff000000 | (val << 16) | (val << 8) | val;
*color = ARGB_JOIN(0xff, val, val, val);
return 1;
}

View File

@ -245,13 +245,9 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
for (x = 0; (x < w) && ((bufptr + 4) <= bufend); x++)
{
if (hasa)
*dataptr =
((255 - bufptr[3]) << 24) | (bufptr[2] << 16) |
(bufptr[1] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(255 - bufptr[3], bufptr[2], bufptr[1], bufptr[0]);
else
*dataptr =
(0xff << 24) | (bufptr[2] << 16) |
(bufptr[1] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(0xff, bufptr[2], bufptr[1], bufptr[0]);
dataptr++;
bufptr += 4;
}
@ -259,9 +255,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
case 24:
for (x = 0; (x < w) && ((bufptr + 3) <= bufend); x++)
{
*dataptr =
(0xff << 24) | (bufptr[2] << 16) |
(bufptr[1] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(0xff, bufptr[2], bufptr[1], bufptr[0]);
dataptr++;
bufptr += 3;
}
@ -280,9 +274,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
b = (tmp << 3) & 0xf8; b |= b >> 5;
a = 0xff;
if ((hasa) && (tmp & 0x8000)) a = 0;
*dataptr =
(a << 24) | (r << 16) |
(g << 8) | (b );
*dataptr = ARGB_JOIN(a, r, g, b);
dataptr++;
bufptr += 2;
}
@ -290,9 +282,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
case 8:
for (x = 0; (x < w) && ((bufptr + 1) <= bufend); x++)
{
*dataptr =
(0xff << 24) | (bufptr[0] << 16) |
(bufptr[0] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(0xff, bufptr[0], bufptr[0], bufptr[0]);
dataptr++;
bufptr += 1;
}
@ -332,8 +322,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
bufptr += 4;
for (i = 0; (i < count) && (dataptr < dataend); i++)
{
*dataptr =
(a << 24) | (r << 16) | (g << 8) | (b);
*dataptr = ARGB_JOIN(a, r, g, b);
dataptr++;
}
}
@ -349,8 +338,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
bufptr += 3;
for (i = 0; (i < count) && (dataptr < dataend); i++)
{
*dataptr =
(0xff << 24) | (r << 16) | (g << 8) | (b);
*dataptr = ARGB_JOIN(0xff, r, g, b);
dataptr++;
}
}
@ -372,10 +360,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
bufptr += 2;
for (i = 0; (i < count) && (dataptr < dataend); i++)
{
*dataptr =
*dataptr =
(a << 24) | (r << 16) |
(g << 8) | (b );
*dataptr = ARGB_JOIN(a, r, g, b);
dataptr++;
}
}
@ -389,8 +374,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
bufptr += 1;
for (i = 0; (i < count) && (dataptr < dataend); i++)
{
*dataptr =
(0xff << 24) | (g << 16) | (g << 8) | (g);
*dataptr = ARGB_JOIN(0xff, g, g, g);
dataptr++;
}
}
@ -407,13 +391,9 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
for (i = 0; (i < count) && (bufptr < (bufend - 4)) && (dataptr < dataend); i++)
{
if (hasa)
*dataptr =
((255 - bufptr[3]) << 24) | (bufptr[2] << 16) |
(bufptr[1] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(255 - bufptr[3], bufptr[2], bufptr[1], bufptr[0]);
else
*dataptr =
(0xff << 24) | (bufptr[2] << 16) |
(bufptr[1] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(0xff, bufptr[2], bufptr[1], bufptr[0]);
dataptr++;
bufptr += 4;
}
@ -421,9 +401,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
case 24:
for (i = 0; (i < count) && (bufptr < (bufend - 3)) && (dataptr < dataend); i++)
{
*dataptr =
(0xff << 24) | (bufptr[2] << 16) |
(bufptr[1] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(0xff, bufptr[2], bufptr[1], bufptr[0]);
dataptr++;
bufptr += 3;
}
@ -442,9 +420,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
b = (tmp << 3) & 0xf8; b |= b >> 5;
a = 0xff;
if ((hasa) && (tmp & 0x8000)) a = 0;
*dataptr =
(a << 24) | (r << 16) |
(g << 8) | (b );
*dataptr = ARGB_JOIN(a, r, g, b);
dataptr++;
bufptr += 2;
}
@ -452,9 +428,7 @@ evas_image_load_file_data_tga(Image_Entry *ie, const char *file, const char *key
case 8:
for (i = 0; (i < count) && (bufptr < (bufend - 1)) && (dataptr < dataend); i++)
{
*dataptr =
(0xff << 24) | (bufptr[0] << 16) |
(bufptr[0] << 8) | (bufptr[0] );
*dataptr = ARGB_JOIN(0xff, bufptr[0], bufptr[0], bufptr[0]);
dataptr++;
bufptr += 1;
}

View File

@ -125,7 +125,7 @@ raster(TIFFRGBAImage_Extra * img, uint32 * rast,
g = (g * (a + 1)) >> 8;
b = (b * (a + 1)) >> 8;
}
(*(buffer_pixel++)) = (a << 24) | (r << 16) | (g << 8) | b;
(*(buffer_pixel++)) = ARGB_JOIN(a, r, g, b);
}
}
}

View File

@ -443,7 +443,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[lookup[lu1][0]].r;
g = (unsigned char)cmap[lookup[lu1][0]].g;
b = (unsigned char)cmap[lookup[lu1][0]].b;
*ptr = (r << 16) | (g << 8) | b;
*ptr = RGB_JOIN(r, g, b);
ptr++;
count++;
}
@ -452,7 +452,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[lookup[lu1][0]].r;
g = (unsigned char)cmap[lookup[lu1][0]].g;
b = (unsigned char)cmap[lookup[lu1][0]].b;
*ptr = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr = ARGB_JOIN(0xff, r, g, b);
ptr++;
count++;
}
@ -469,7 +469,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[lookup[lu1][0]].r;
g = (unsigned char)cmap[lookup[lu1][0]].g;
b = (unsigned char)cmap[lookup[lu1][0]].b;
*ptr = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr = ARGB_JOIN(0xff, r, g, b);
ptr++;
count++;
}
@ -493,7 +493,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[lookup[lu1][lu2]].r;
g = (unsigned char)cmap[lookup[lu1][lu2]].g;
b = (unsigned char)cmap[lookup[lu1][lu2]].b;
*ptr = (r << 16) | (g << 8) | b;
*ptr = RGB_JOIN(r, g, b);
ptr++;
count++;
}
@ -502,7 +502,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[lookup[lu1][lu2]].r;
g = (unsigned char)cmap[lookup[lu1][lu2]].g;
b = (unsigned char)cmap[lookup[lu1][lu2]].b;
*ptr = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr = ARGB_JOIN(0xff, r, g, b);
ptr++;
count++;
}
@ -522,7 +522,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[lookup[lu1][lu2]].r;
g = (unsigned char)cmap[lookup[lu1][lu2]].g;
b = (unsigned char)cmap[lookup[lu1][lu2]].b;
*ptr = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr = ARGB_JOIN(0xff, r, g, b);
ptr++;
count++;
}
@ -552,7 +552,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[j].r;
g = (unsigned char)cmap[j].g;
b = (unsigned char)cmap[j].b;
*ptr = (r << 16) | (g << 8) | b;
*ptr = RGB_JOIN(r, g, b);
ptr++;
count++;
}
@ -561,7 +561,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[j].r;
g = (unsigned char)cmap[j].g;
b = (unsigned char)cmap[j].b;
*ptr = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr = ARGB_JOIN(0xff, r, g, b);
ptr++;
count++;
}
@ -589,7 +589,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key __UN
r = (unsigned char)cmap[j].r;
g = (unsigned char)cmap[j].g;
b = (unsigned char)cmap[j].b;
*ptr = (0xff << 24) | (r << 16) | (g << 8) | b;
*ptr = ARGB_JOIN(0xff, r, g, b);
ptr++;
count++;
break;