gdi32: Store the return value separately in StretchDIBits instead of overwriting heightSrc.

This commit is contained in:
Alexandre Julliard 2008-03-26 20:51:58 +01:00
parent 12ae8ff814
commit 6e387f34c5

View file

@ -188,18 +188,19 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
const BITMAPINFO *info, UINT wUsage, DWORD dwRop ) const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
{ {
DC *dc; DC *dc;
INT ret;
if (!bits || !info) if (!bits || !info)
return 0; return 0;
if (!(dc = get_dc_ptr( hdc ))) return FALSE; if (!(dc = get_dc_ptr( hdc ))) return 0;
if(dc->funcs->pStretchDIBits) if(dc->funcs->pStretchDIBits)
{ {
update_dc( dc ); update_dc( dc );
heightSrc = dc->funcs->pStretchDIBits(dc->physDev, xDst, yDst, widthDst, ret = dc->funcs->pStretchDIBits(dc->physDev, xDst, yDst, widthDst,
heightDst, xSrc, ySrc, widthSrc, heightDst, xSrc, ySrc, widthSrc,
heightSrc, bits, info, wUsage, dwRop); heightSrc, bits, info, wUsage, dwRop);
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
else /* use StretchBlt */ else /* use StretchBlt */
@ -248,7 +249,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
{ {
/* fast path */ /* fast path */
TRACE("using fast path\n"); TRACE("using fast path\n");
heightSrc = SetDIBits( hdc, hBitmap, 0, height, bits, info, wUsage); ret = SetDIBits( hdc, hBitmap, 0, height, bits, info, wUsage);
} }
else else
{ {
@ -290,13 +291,13 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
dwRop ); dwRop );
} }
heightSrc = SetDIBits(hdcMem, hBitmap, 0, height, bits, info, wUsage); ret = SetDIBits(hdcMem, hBitmap, 0, height, bits, info, wUsage);
/* Origin for DIBitmap may be bottom left (positive biHeight) or top /* Origin for DIBitmap may be bottom left (positive biHeight) or top
left (negative biHeight) */ left (negative biHeight) */
if (heightSrc) StretchBlt( hdc, xDst, yDst, widthDst, heightDst, if (ret) StretchBlt( hdc, xDst, yDst, widthDst, heightDst,
hdcMem, xSrc, abs(height) - heightSrc - ySrc, hdcMem, xSrc, abs(height) - heightSrc - ySrc,
widthSrc, heightSrc, dwRop ); widthSrc, heightSrc, dwRop );
if(hpal) if(hpal)
SelectPalette(hdcMem, hpal, FALSE); SelectPalette(hdcMem, hpal, FALSE);
SelectObject( hdcMem, hOldBitmap ); SelectObject( hdcMem, hOldBitmap );
@ -304,7 +305,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
DeleteObject( hBitmap ); DeleteObject( hBitmap );
} }
} }
return heightSrc; return ret;
} }