clip the destination rect against the bounds of the destination and source surface. Fixes a crash of gdi32_winetest bitmap that occurs as soon as IntCreateCompatibleBitmap is fixed. Other Eng* code needs to be checked as well.

svn path=/trunk/; revision=50998
This commit is contained in:
Timo Kreuzer
2011-03-07 22:00:19 +00:00
parent 8daf17a4e8
commit d089825a9f
@@ -49,12 +49,28 @@ EngCopyBits(SURFOBJ *psoDest,
BLTINFO BltInfo;
SURFACE *psurfDest;
SURFACE *psurfSource;
RECTL rclDest = *DestRect;
POINTL ptlSrc = *SourcePoint;
ASSERT(psoDest != NULL && psoSource != NULL && DestRect != NULL && SourcePoint != NULL);
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
/* Clip dest rect against source surface size / source point */
if (psoSource->sizlBitmap.cx - ptlSrc.x < rclDest.right - rclDest.left)
rclDest.right = rclDest.left + psoSource->sizlBitmap.cx - ptlSrc.x;
if (psoSource->sizlBitmap.cy - ptlSrc.y < rclDest.bottom - rclDest.top)
rclDest.bottom = rclDest.top + psoSource->sizlBitmap.cy - ptlSrc.y;
/* Clip dest rect against target surface size */
if (rclDest.right > psoDest->sizlBitmap.cx)
rclDest.right = psoDest->sizlBitmap.cx;
if (rclDest.bottom > psoDest->sizlBitmap.cy)
rclDest.bottom = psoDest->sizlBitmap.cy;
if (RECTL_bIsEmptyRect(&rclDest)) return TRUE;
DestRect = &rclDest;
// FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead,
// mark the copy block function to be DrvCopyBits instead of the
// GDI's copy bit function so as to remove clipping from the