{
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;
}
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
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++;
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++;
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++;
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++;
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++;
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++;
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;
}
{
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++;
}
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++;
}
{
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++;
}
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++;
}
if (vb > 255)
vb = 255;
- *color = 0xff000000 | (vr << 16) | (vg << 8) | vb;
+ *color = ARGB_JOIN(0xff, vr, vg, vb);
return 1;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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++;
}
}
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++;
}
}
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++;
}
}
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++;
}
}
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;
}
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;
}
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;
}
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;
}
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);
}
}
}
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++;
}
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++;
}
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++;
}
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++;
}
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++;
}
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++;
}
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++;
}
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++;
}
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;