From 3268ed2ea500a2053504c02ad0ffa8139652dd2b Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 30 Sep 2010 16:07:53 -0500 Subject: [PATCH] gdiplus: Don't create a DIB section for non-alpha or reference bitmaps. --- dlls/gdiplus/image.c | 14 +------------- dlls/gdiplus/tests/graphics.c | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 9b83d95..e17edde 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -1630,7 +1630,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, INT row_size, dib_stride; HDC hdc; BYTE *bits=NULL, *own_bits=NULL; - int i; REAL xres, yres; GpStatus stat; @@ -1655,7 +1654,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, if(stride == 0) stride = dib_stride; - if (format & PixelFormatGDI) + if (format & PixelFormatGDI && !(format & (PixelFormatAlpha|PixelFormatIndexed)) && !scan0) { pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (!pbmi) @@ -1691,12 +1690,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, { /* Not a GDI format; don't try to make an HBITMAP. */ if (scan0) - { - /* FIXME: We should do this with GDI formats too when scan0 is - * provided, but for now we need the HDC for most drawing - * operations. */ bits = scan0; - } else { INT size = abs(stride) * height; @@ -1709,12 +1703,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, } } - /* copy bits to the dib if necessary */ - /* FIXME: should reference the bits instead of copying them */ - if (scan0 && bits != scan0) - for (i=0; i