Commit c8a48f23 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Don't create a DIB section for non-alpha or reference bitmaps.

parent 473afa4b
......@@ -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)
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment