Andrey Turkin : gdiplus: GdipLoadImageFromStream should use well-known pixel format constants when possible .
Alexandre Julliard
julliard at winehq.org
Thu Jan 15 08:50:59 CST 2009
Module: wine
Branch: master
Commit: 1138c28eeb0f6753e05590dd2670d6a17c815627
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1138c28eeb0f6753e05590dd2670d6a17c815627
Author: Andrey Turkin <andrey.turkin at gmail.com>
Date: Thu Jan 15 12:39:47 2009 +0300
gdiplus: GdipLoadImageFromStream should use well-known pixel format constants when possible.
---
dlls/gdiplus/image.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 1fb8824..02f8f5a 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -1068,7 +1068,35 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
else
GetDIBits(hdc, hbm, 0, 0, NULL, pbmi, DIB_RGB_COLORS);
- (*((GpBitmap**) image))->format = (bmch->bcBitCount << 8) | PixelFormatGDI;
+ switch(bmch->bcBitCount)
+ {
+ case 1:
+ (*((GpBitmap**) image))->format = PixelFormat1bppIndexed;
+ break;
+ case 4:
+ (*((GpBitmap**) image))->format = PixelFormat4bppIndexed;
+ break;
+ case 8:
+ (*((GpBitmap**) image))->format = PixelFormat8bppIndexed;
+ break;
+ case 16:
+ (*((GpBitmap**) image))->format = PixelFormat16bppRGB565;
+ break;
+ case 24:
+ (*((GpBitmap**) image))->format = PixelFormat24bppRGB;
+ break;
+ case 32:
+ (*((GpBitmap**) image))->format = PixelFormat32bppRGB;
+ break;
+ case 48:
+ (*((GpBitmap**) image))->format = PixelFormat48bppRGB;
+ break;
+ default:
+ FIXME("Bit depth %d is not fully supported yet\n", bmch->bcBitCount);
+ (*((GpBitmap**) image))->format = (bmch->bcBitCount << 8) | PixelFormatGDI;
+ break;
+ }
+
GdipFree(pbmi);
}
else if(type == PICTYPE_METAFILE || type == PICTYPE_ENHMETAFILE){
More information about the wine-cvs
mailing list