Fixed top-down DIB handling in StretchDIBits32().
diff --git a/objects/dib.c b/objects/dib.c
index 9fbb0ce..db119c3 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -145,14 +145,15 @@
else { /* use StretchBlt32 */
HBITMAP hBitmap, hOldBitmap;
HDC hdcMem;
-
+
hBitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT,
bits, info, wUsage );
hdcMem = CreateCompatibleDC( hdc );
hOldBitmap = SelectObject( hdcMem, hBitmap );
- /* Origin for DIBitmap is bottom left ! */
+ /* Origin for DIBitmap may be bottom left (positive biHeight) or top
+ left (negative biHeight) */
StretchBlt( hdc, xDst, yDst, widthDst, heightDst,
- hdcMem, xSrc, info->bmiHeader.biHeight - heightSrc - ySrc,
+ hdcMem, xSrc, abs(info->bmiHeader.biHeight) - heightSrc - ySrc,
widthSrc, heightSrc, dwRop );
SelectObject( hdcMem, hOldBitmap );
DeleteDC( hdcMem );