Alexandre Julliard : gdi32: Move coordinate checks into the common part of GdiAlphaBlend.
Alexandre Julliard
julliard at winehq.org
Tue Sep 13 12:18:11 CDT 2011
Module: wine
Branch: master
Commit: 497c3982b647fa6e16b960ee59efa16e9d86f324
URL: http://source.winehq.org/git/wine.git/?a=commit;h=497c3982b647fa6e16b960ee59efa16e9d86f324
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Sep 13 17:10:37 2011 +0200
gdi32: Move coordinate checks into the common part of GdiAlphaBlend.
---
dlls/gdi32/bitblt.c | 18 +++++++++++++++++-
dlls/winex11.drv/xrender.c | 13 ++-----------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index e8e2c88..9f37ab0 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -669,7 +669,23 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
blendFunction.BlendOp, blendFunction.BlendFlags,
blendFunction.SourceConstantAlpha, blendFunction.AlphaFormat );
- if (!ret) ret = dst_dev->funcs->pAlphaBlend( dst_dev, &dst, src_dev, &src, blendFunction );
+ if (src.x < 0 || src.y < 0 || src.width < 0 || src.height < 0 ||
+ (dcSrc->header.type == OBJ_MEMDC &&
+ (src.width > dcSrc->vis_rect.right - dcSrc->vis_rect.left - src.x ||
+ src.height > dcSrc->vis_rect.bottom - dcSrc->vis_rect.top - src.y)))
+ {
+ WARN( "Invalid src coords: (%d,%d), size %dx%d\n", src.x, src.y, src.width, src.height );
+ SetLastError( ERROR_INVALID_PARAMETER );
+ ret = FALSE;
+ }
+ else if (dst.width < 0 || dst.height < 0)
+ {
+ WARN( "Invalid dst coords: (%d,%d), size %dx%d\n", dst.x, dst.y, dst.width, dst.height );
+ SetLastError( ERROR_INVALID_PARAMETER );
+ ret = FALSE;
+ }
+ else if (!ret) ret = dst_dev->funcs->pAlphaBlend( dst_dev, &dst, src_dev, &src, blendFunction );
+
release_dc_ptr( dcDst );
}
release_dc_ptr( dcSrc );
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 62fba77..2e7aca3 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -2396,22 +2396,13 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
double xscale, yscale;
BOOL use_repeat;
- if (src->x < 0 || src->y < 0 || src->width < 0 || src->height < 0 ||
- src->width > physdev_src->x11dev->drawable_rect.right - physdev_src->x11dev->drawable_rect.left - src->x ||
- src->height > physdev_src->x11dev->drawable_rect.bottom - physdev_src->x11dev->drawable_rect.top - src->y)
- {
- WARN( "Invalid src coords: (%d,%d), size %dx%d\n", src->x, src->y, src->width, src->height );
- SetLastError( ERROR_INVALID_PARAMETER );
- return FALSE;
- }
-
if (!X11DRV_XRender_Installed || src_dev->funcs != dst_dev->funcs)
{
dst_dev = GET_NEXT_PHYSDEV( dst_dev, pAlphaBlend );
return dst_dev->funcs->pAlphaBlend( dst_dev, dst, src_dev, src, blendfn );
}
- if (physdev_src->x11dev != physdev_dst->x11dev) X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_GdiMod );
+ if (physdev_src != physdev_dst) X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_GdiMod );
X11DRV_LockDIBSection( physdev_dst->x11dev, DIB_Status_GdiMod );
dst_pict = get_xrender_picture( physdev_dst->x11dev );
@@ -2460,7 +2451,7 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs );
- if (physdev_src->x11dev != physdev_dst->x11dev) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE );
+ if (physdev_src != physdev_dst) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE );
X11DRV_UnlockDIBSection( physdev_dst->x11dev, TRUE );
return TRUE;
}
More information about the wine-cvs
mailing list