mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Check better that handles are actual handles to a region.
This commit is contained in:
parent
9fd10756ad
commit
ec133cea9a
@ -339,7 +339,7 @@ BOOL WINAPI SetRectRgn( HRGN hrgn, INT left, INT top,
|
|||||||
RGNOBJ * obj;
|
RGNOBJ * obj;
|
||||||
|
|
||||||
TRACE(" %04x %d,%d-%d,%d\n",
|
TRACE(" %04x %d,%d-%d,%d\n",
|
||||||
hrgn, left, top, right, bottom );
|
hrgn, left, top, right, bottom );
|
||||||
|
|
||||||
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE;
|
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE;
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ HRGN WINAPI CreateRoundRectRgn( INT left, INT top,
|
|||||||
if (!(hrgn = REGION_CreateRegion(d))) return 0;
|
if (!(hrgn = REGION_CreateRegion(d))) return 0;
|
||||||
obj = (RGNOBJ *) GDI_HEAP_LOCK( hrgn );
|
obj = (RGNOBJ *) GDI_HEAP_LOCK( hrgn );
|
||||||
TRACE("(%d,%d-%d,%d %dx%d): ret=%04x\n",
|
TRACE("(%d,%d-%d,%d %dx%d): ret=%04x\n",
|
||||||
left, top, right, bottom, ellipse_width, ellipse_height, hrgn );
|
left, top, right, bottom, ellipse_width, ellipse_height, hrgn );
|
||||||
|
|
||||||
/* Check parameters */
|
/* Check parameters */
|
||||||
|
|
||||||
@ -774,7 +774,7 @@ static void REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
|
|||||||
*/
|
*/
|
||||||
BOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect )
|
BOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect )
|
||||||
{
|
{
|
||||||
RGNOBJ *obj = (RGNOBJ *) GDI_HEAP_LOCK( hrgn );
|
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
|
||||||
|
|
||||||
if(!obj) return FALSE;
|
if(!obj) return FALSE;
|
||||||
REGION_UnionRectWithRegion( lpRect, obj->rgn );
|
REGION_UnionRectWithRegion( lpRect, obj->rgn );
|
||||||
@ -833,7 +833,7 @@ BOOL REGION_LPTODP( HDC hdc, HRGN hDest, HRGN hSrc )
|
|||||||
RECT tmpRect;
|
RECT tmpRect;
|
||||||
|
|
||||||
TRACE(" hdc=%04x dest=%04x src=%04x\n",
|
TRACE(" hdc=%04x dest=%04x src=%04x\n",
|
||||||
hdc, hDest, hSrc) ;
|
hdc, hDest, hSrc) ;
|
||||||
|
|
||||||
if (dc->w.MapMode == MM_TEXT) /* Requires only a translation */
|
if (dc->w.MapMode == MM_TEXT) /* Requires only a translation */
|
||||||
{
|
{
|
||||||
@ -888,7 +888,7 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
|
|||||||
INT result = ERROR;
|
INT result = ERROR;
|
||||||
|
|
||||||
TRACE(" %04x,%04x -> %04x mode=%x\n",
|
TRACE(" %04x,%04x -> %04x mode=%x\n",
|
||||||
hSrc1, hSrc2, hDest, mode );
|
hSrc1, hSrc2, hDest, mode );
|
||||||
if (destObj)
|
if (destObj)
|
||||||
{
|
{
|
||||||
RGNOBJ *src1Obj = (RGNOBJ *) GDI_GetObjPtr( hSrc1, REGION_MAGIC);
|
RGNOBJ *src1Obj = (RGNOBJ *) GDI_GetObjPtr( hSrc1, REGION_MAGIC);
|
||||||
@ -911,7 +911,7 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
|
|||||||
{
|
{
|
||||||
TRACE("dump:\n");
|
TRACE("dump:\n");
|
||||||
if(TRACE_ON(region))
|
if(TRACE_ON(region))
|
||||||
REGION_DumpRegion(src2Obj->rgn);
|
REGION_DumpRegion(src2Obj->rgn);
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case RGN_AND:
|
case RGN_AND:
|
||||||
@ -938,6 +938,8 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
|
|||||||
REGION_DumpRegion(destObj->rgn);
|
REGION_DumpRegion(destObj->rgn);
|
||||||
|
|
||||||
GDI_HEAP_UNLOCK( hDest );
|
GDI_HEAP_UNLOCK( hDest );
|
||||||
|
} else {
|
||||||
|
ERR("Invalid rgn=%04x\n", hDest);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -2745,7 +2747,7 @@ empty:
|
|||||||
* lpPt: Points to offset the cropped region. Can be NULL (no offset).
|
* lpPt: Points to offset the cropped region. Can be NULL (no offset).
|
||||||
*
|
*
|
||||||
* hDst: Region to hold the result (a new region is created if it's 0).
|
* hDst: Region to hold the result (a new region is created if it's 0).
|
||||||
* Allowed to be the same region as hSrc in which case everyhting
|
* Allowed to be the same region as hSrc in which case everything
|
||||||
* will be done in place, with no memory reallocations.
|
* will be done in place, with no memory reallocations.
|
||||||
*
|
*
|
||||||
* Returns: hDst if success, 0 otherwise.
|
* Returns: hDst if success, 0 otherwise.
|
||||||
@ -2773,7 +2775,7 @@ HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RGNOBJ *objSrc = (RGNOBJ *) GDI_HEAP_LOCK( hSrc );
|
RGNOBJ *objSrc = (RGNOBJ *) GDI_GetObjPtr( hSrc, REGION_MAGIC );
|
||||||
|
|
||||||
if(objSrc)
|
if(objSrc)
|
||||||
{
|
{
|
||||||
@ -2782,13 +2784,16 @@ HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt
|
|||||||
|
|
||||||
if( hDst )
|
if( hDst )
|
||||||
{
|
{
|
||||||
objDst = (RGNOBJ *) GDI_HEAP_LOCK( hDst );
|
if (!(objDst = (RGNOBJ *) GDI_GetObjPtr( hDst, REGION_MAGIC )))
|
||||||
|
{
|
||||||
|
hDst = 0;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
rgnDst = objDst->rgn;
|
rgnDst = objDst->rgn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rgnDst = HeapAlloc(SystemHeap, 0, sizeof( WINEREGION ));
|
if ((rgnDst = HeapAlloc(SystemHeap, 0, sizeof( WINEREGION ))))
|
||||||
if( rgnDst )
|
|
||||||
{
|
{
|
||||||
rgnDst->size = rgnDst->numRects = 0;
|
rgnDst->size = rgnDst->numRects = 0;
|
||||||
rgnDst->rects = NULL; /* back end will allocate exact number */
|
rgnDst->rects = NULL; /* back end will allocate exact number */
|
||||||
@ -2803,7 +2808,7 @@ HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt
|
|||||||
|
|
||||||
if( lpRect )
|
if( lpRect )
|
||||||
TRACE("src %p -> dst %p (%i,%i)-(%i,%i) by (%li,%li)\n", objSrc->rgn, rgnDst,
|
TRACE("src %p -> dst %p (%i,%i)-(%i,%i) by (%li,%li)\n", objSrc->rgn, rgnDst,
|
||||||
lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, lpPt->x, lpPt->y );
|
lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, lpPt->x, lpPt->y );
|
||||||
else
|
else
|
||||||
TRACE("src %p -> dst %p by (%li,%li)\n", objSrc->rgn, rgnDst, lpPt->x, lpPt->y );
|
TRACE("src %p -> dst %p by (%li,%li)\n", objSrc->rgn, rgnDst, lpPt->x, lpPt->y );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user