瀏覽代碼

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 年之前
父節點
當前提交
8f68604bcc
共有 1 個文件被更改,包括 4 次插入11 次删除
  1. +4
    -11
      pipi/codec/gdi.c

+ 4
- 11
pipi/codec/gdi.c 查看文件

@@ -68,15 +68,8 @@ pipi_image_t *pipi_load_gdi(const char *name)
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;

@@ -133,9 +126,9 @@ int pipi_save_gdi(pipi_image_t *img, const char *name)
for(x = 0; x < img->w; x++)
{
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[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);
}
if(padding)


Loading…
取消
儲存