r/sr=roc
Add system exception handling around the call to StretchDIBits - it fails on some printer drivers
This commit is contained in:
mkaply%us.ibm.com 2006-11-15 05:39:32 +00:00
parent 8c7a251d5e
commit 7e18d9771a

View File

@ -2046,11 +2046,21 @@ CompositeBitsInMemory(HDC aTheHDC, int aDX, int aDY, int aDWidth, int aDHeight,
::GdiFlush();
// output the composed image
::StretchDIBits(aTheHDC, aDX, aDY, aDWidth, aDHeight,
aSX, aSrcy, aSWidth, aSHeight,
screenBits, (LPBITMAPINFO)&offbmi,
256 == aNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS,
SRCCOPY);
__try {
::StretchDIBits(aTheHDC, aDX, aDY, aDWidth, aDHeight,
aSX, aSrcy, aSWidth, aSHeight,
screenBits, (LPBITMAPINFO)&offbmi,
256 == aNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS,
SRCCOPY);
} __except (EXCEPTION_EXECUTE_HANDLER) {
/* yeah this is ugly - certain printer drivers crash in the StretchDIBits */
/* workaround is to subtract one from aSrcy */
::StretchDIBits(aTheHDC, aDX, aDY, aDWidth, aDHeight,
aSX, aSrcy-1, aSWidth, aSHeight,
screenBits, (LPBITMAPINFO)&offbmi,
256 == aNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS,
SRCCOPY);
}
::SelectObject(memDC, oldBitmap);
}