mirror of
https://github.com/reactos/reactos.git
synced 2025-06-09 20:11:14 +00:00
[WIN32K]
EngCopyBits: Use goto cleanup / break instead of code duplication, fix leaking a bits lock, if the rect function fails, remove abundant MouseSafetyOnDrawEnd svn path=/trunk/; revision=43849
This commit is contained in:
parent
38a5ae755f
commit
e72570afce
1 changed files with 21 additions and 51 deletions
|
@ -42,7 +42,7 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
RECTL *DestRect,
|
RECTL *DestRect,
|
||||||
POINTL *SourcePoint)
|
POINTL *SourcePoint)
|
||||||
{
|
{
|
||||||
BOOLEAN ret;
|
BOOL ret;
|
||||||
BYTE clippingType;
|
BYTE clippingType;
|
||||||
RECT_ENUM RectEnum;
|
RECT_ENUM RectEnum;
|
||||||
BOOL EnumMore;
|
BOOL EnumMore;
|
||||||
|
@ -78,13 +78,7 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
ret = GDIDEVFUNCS(psoDest).CopyBits(
|
ret = GDIDEVFUNCS(psoDest).CopyBits(
|
||||||
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
||||||
|
|
||||||
if (psoDest != psoSource)
|
goto cleanup;
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,13 +91,7 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
ret = GDIDEVFUNCS(psoSource).CopyBits(
|
ret = GDIDEVFUNCS(psoSource).CopyBits(
|
||||||
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
||||||
|
|
||||||
if (psoDest != psoSource)
|
goto cleanup;
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,17 +100,11 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
NULL, Clip, ColorTranslation, DestRect, SourcePoint,
|
NULL, Clip, ColorTranslation, DestRect, SourcePoint,
|
||||||
NULL, NULL, NULL, ROP3_TO_ROP4(SRCCOPY));
|
NULL, NULL, NULL, ROP3_TO_ROP4(SRCCOPY));
|
||||||
|
|
||||||
if (psoDest != psoSource)
|
goto cleanup;
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine clipping type
|
// Determine clipping type
|
||||||
if (Clip == (CLIPOBJ *) NULL)
|
if (!Clip)
|
||||||
{
|
{
|
||||||
clippingType = DC_TRIVIAL;
|
clippingType = DC_TRIVIAL;
|
||||||
}
|
}
|
||||||
|
@ -143,16 +125,8 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
BltInfo.DestRect = *DestRect;
|
BltInfo.DestRect = *DestRect;
|
||||||
BltInfo.SourcePoint = *SourcePoint;
|
BltInfo.SourcePoint = *SourcePoint;
|
||||||
|
|
||||||
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
|
ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
|
||||||
|
break;
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
if (psoDest != psoSource)
|
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case DC_RECT:
|
case DC_RECT:
|
||||||
// Clip the blt to the clip rectangle
|
// Clip the blt to the clip rectangle
|
||||||
|
@ -161,15 +135,8 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
BltInfo.SourcePoint.x = SourcePoint->x + BltInfo.DestRect.left - DestRect->left;
|
BltInfo.SourcePoint.x = SourcePoint->x + BltInfo.DestRect.left - DestRect->left;
|
||||||
BltInfo.SourcePoint.y = SourcePoint->y + BltInfo.DestRect.top - DestRect->top;
|
BltInfo.SourcePoint.y = SourcePoint->y + BltInfo.DestRect.top - DestRect->top;
|
||||||
|
|
||||||
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
|
ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
|
||||||
|
break;
|
||||||
if (psoDest != psoSource)
|
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case DC_COMPLEX:
|
case DC_COMPLEX:
|
||||||
|
|
||||||
|
@ -192,7 +159,10 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
BltInfo.SourcePoint.y = SourcePoint->y + prcl->top - DestRect->top;
|
BltInfo.SourcePoint.y = SourcePoint->y + prcl->top - DestRect->top;
|
||||||
|
|
||||||
if (!DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo))
|
if (!DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo))
|
||||||
return FALSE;
|
{
|
||||||
|
ret = FALSE;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
prcl++;
|
prcl++;
|
||||||
|
|
||||||
|
@ -200,23 +170,23 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (EnumMore);
|
} while (EnumMore);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT(FALSE);
|
||||||
|
ret = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
if (psoDest != psoSource)
|
if (psoDest != psoSource)
|
||||||
{
|
{
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
SURFACE_UnlockBitmapBits(psurfDest);
|
||||||
}
|
}
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
SURFACE_UnlockBitmapBits(psurfSource);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
if (psoDest != psoSource)
|
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue