gdiplus: Don't create a DIB section for non-alpha or reference bitmaps.
This commit is contained in:
parent
473afa4b8c
commit
c8a48f237e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue