Browse Source

libpipi: do not swap bytes in the GDI loader.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2945 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam 16 years ago
parent
commit
8f68604bcc
1 changed files with 4 additions and 11 deletions
  1. +4
    -11
      pipi/codec/gdi.c

+ 4
- 11
pipi/codec/gdi.c View File

@@ -68,15 +68,8 @@ pipi_image_t *pipi_load_gdi(const char *name)
return NULL; return NULL;
} }


/* FIXME: get rid of this loop, maybe by using BITMAPV4HEADER above
* so that GDI reorders the pixels for us. */
for(y = 0; y < img->h; y++)
for(x = 0; x < img->w; x++)
{
/* Swap B and R, don't touch G and A. */
uint8_t tmp = data[0]; data[0] = data[2]; data[2] = tmp;
data += 4;
}
/* FIXME: do we need to swap bytes? Apparently Vista doesn't need it,
* but we'd need a more thorough test. */


img->codec_priv = NULL; img->codec_priv = NULL;


@@ -133,9 +126,9 @@ int pipi_save_gdi(pipi_image_t *img, const char *name)
for(x = 0; x < img->w; x++) for(x = 0; x < img->w; x++)
{ {
uint8_t tmp[3]; uint8_t tmp[3];
tmp[0] = data[4 * (img->w * (img->h - 1 - y) + x) + 2];
tmp[0] = data[4 * (img->w * (img->h - 1 - y) + x) + 0];
tmp[1] = data[4 * (img->w * (img->h - 1 - y) + x) + 1]; tmp[1] = data[4 * (img->w * (img->h - 1 - y) + x) + 1];
tmp[2] = data[4 * (img->w * (img->h - 1 - y) + x) + 0];
tmp[2] = data[4 * (img->w * (img->h - 1 - y) + x) + 2];
WriteFile(hfile, tmp, 3, &ret, NULL); WriteFile(hfile, tmp, 3, &ret, NULL);
} }
if(padding) if(padding)


Loading…
Cancel
Save