gdiplus: Fix GdipCreateBitmapFromHBITMAP flipping images vertically.
GdipCreateBitmapFromHBITMAP currently assumes that all bitmaps are top-down, even though a positive height (which it also assumes) signals a bottom-up DIB. The net result is that GdipCreateBitmapFromHBITMAP flips images vertically.
This commit is contained in:
parent
65750fabbb
commit
f365ef46f0
|
@ -1499,6 +1499,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
GpStatus retval;
|
GpStatus retval;
|
||||||
PixelFormat format;
|
PixelFormat format;
|
||||||
|
BYTE* bits;
|
||||||
|
|
||||||
TRACE("%p %p %p\n", hbm, hpal, bitmap);
|
TRACE("%p %p %p\n", hbm, hpal, bitmap);
|
||||||
|
|
||||||
|
@ -1539,8 +1540,16 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = GdipCreateBitmapFromScan0(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes,
|
if (bm.bmBits)
|
||||||
format, bm.bmBits, bitmap);
|
bits = (BYTE*)bm.bmBits + (bm.bmHeight - 1) * bm.bmWidthBytes;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FIXME("can only get image data from DIB sections\n");
|
||||||
|
bits = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = GdipCreateBitmapFromScan0(bm.bmWidth, bm.bmHeight, -bm.bmWidthBytes,
|
||||||
|
format, bits, bitmap);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue