Module: wine Branch: master Commit: c8a48f237e43174673fa3686ebe99e42f6a0d8a4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c8a48f237e43174673fa3686eb...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Sep 30 16:07:53 2010 -0500
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<height; i++) - memcpy(bits+i*dib_stride, scan0+i*stride, row_size); - *bitmap = GdipAlloc(sizeof(GpBitmap)); if(!*bitmap) { diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 9fae06c..940dbef 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -2194,7 +2194,7 @@ static void test_fromMemoryBitmap(void)
GdipDeleteGraphics(graphics);
- todo_wine expect(0x79, bits[0]); + expect(0x79, bits[0]); todo_wine expect(0x68, bits[3]);
GdipDisposeImage((GpImage*)bitmap);