Commit b8830034 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Do not reuse a passed CONST RECT * pointer.

parent a7617a05
...@@ -2588,19 +2588,21 @@ HRGN WINAPI GetRandomRgn(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3) ...@@ -2588,19 +2588,21 @@ HRGN WINAPI GetRandomRgn(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3)
*/ */
static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINEREGION *rgnSrc, WINEREGION* rgnDst) static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINEREGION *rgnSrc, WINEREGION* rgnDst)
{ {
if( !rect ) /* just copy and offset */ if( !rect ) /* just copy and offset */
{ {
RECT *xrect;
if( rgnDst == rgnSrc ) if( rgnDst == rgnSrc )
{ {
if( off->x || off->y ) if( off->x || off->y )
rect = rgnDst->rects; xrect = rgnDst->rects;
else else
return TRUE; return TRUE;
} }
else else
rect = HeapReAlloc( SystemHeap, 0, rgnDst->rects, xrect = HeapReAlloc( SystemHeap, 0, rgnDst->rects,
rgnSrc->size * sizeof( RECT )); rgnSrc->size * sizeof( RECT ));
if( rect ) if( xrect )
{ {
INT i; INT i;
...@@ -2611,18 +2613,17 @@ static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINER ...@@ -2611,18 +2613,17 @@ static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINER
{ {
for( i = 0; i < rgnDst->numRects; i++ ) for( i = 0; i < rgnDst->numRects; i++ )
{ {
rect[i].left = rgnSrc->rects[i].left + off->x; xrect[i].left = rgnSrc->rects[i].left + off->x;
rect[i].right = rgnSrc->rects[i].right + off->x; xrect[i].right = rgnSrc->rects[i].right + off->x;
rect[i].top = rgnSrc->rects[i].top + off->y; xrect[i].top = rgnSrc->rects[i].top + off->y;
rect[i].bottom = rgnSrc->rects[i].bottom + off->y; xrect[i].bottom = rgnSrc->rects[i].bottom + off->y;
} }
OffsetRect( &rgnDst->extents, off->x, off->y ); OffsetRect( &rgnDst->extents, off->x, off->y );
} }
else else
memcpy( rect, rgnSrc->rects, rgnDst->numRects * sizeof( RECT )); memcpy( xrect, rgnSrc->rects, rgnDst->numRects * sizeof(RECT));
rgnDst->rects = rect; rgnDst->rects = xrect;
} } else
else
return FALSE; return FALSE;
} }
else if( IsRectEmpty(rect) || !EXTENTCHECK(rect, &rgnSrc->extents) ) else if( IsRectEmpty(rect) || !EXTENTCHECK(rect, &rgnSrc->extents) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment