Browse Source

fix yet another bug i wrote :( -- be endian-neutral.

tags/v0.99.beta17
Ben Wiley Sittler bsittler 16 years ago
parent
commit
04e8348ea5
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      caca-php/php_caca.c

+ 4
- 5
caca-php/php_caca.c View File

@@ -382,12 +382,11 @@ void *gd_get_pixels(gdImage *img) {
{
for (i = 0; i < img->sy; i++) {
for (j = 0; j < img->sx; j++) {
uint8_t *dst = ((uint8_t *) result) + i * pitch + j * sizeof(int);
int *dst = (int *) (((char *) result) + i * pitch + j * sizeof(int));

dst[3] = 255 - (uint8_t) ((((uint32_t) img->tpixels[i][j]) & 0x7f000000) >> 23);
dst[2] = (((uint32_t) img->tpixels[i][j]) & 0x00ff0000) >> 16;
dst[1] = (((uint32_t) img->tpixels[i][j]) & 0x0000ff00) >> 8;
dst[0] = ((uint32_t) img->tpixels[i][j]) & 0x000000ff;
*dst = (((255 - (uint8_t) ((((uint32_t) img->tpixels[i][j]) & 0x7f000000) >> 23)) << 24)
|
(img->tpixels[i][j] & 0x00ffffff));
}
}
}


Loading…
Cancel
Save