Module: wine Branch: master Commit: f365ef46f0d8a38aebf13aac0cfdb302ebbaa840 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f365ef46f0d8a38aebf13aac0c...
Author: Vincent Povirk vincent@codeweavers.com Date: Tue Feb 17 14:39:17 2009 -0600
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.
---
dlls/gdiplus/image.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index ab70354..a229f8b 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -1499,6 +1499,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi BITMAP bm; GpStatus retval; PixelFormat format; + BYTE* bits;
TRACE("%p %p %p\n", hbm, hpal, bitmap);
@@ -1539,8 +1540,16 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi return InvalidParameter; }
- retval = GdipCreateBitmapFromScan0(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, - format, bm.bmBits, bitmap); + if (bm.bmBits) + 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; }