Пример #1
0
static void test_SubtractRect(void)
{
    RECT rect1;
    RECT rect2;
    RECT rectr;
    BOOL result;

    /* source rectangles don't intersect */
    SetRect(&rect1, 50, 50, 150, 100);
    SetRect(&rect2, 250, 200, 1500, 1000);
    result = SubtractRect(&rectr, &rect1, &rect2);
    ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
    ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150
        && rectr.bottom == 100, "wrong rect subtraction of SubtractRect "
        "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);

    /* source rect 2 partially overlaps rect 1 */
    SetRect(&rect1, 2431, 626, 3427, 1608);
    SetRect(&rect2, 2499, 626, 3427, 1608);
    result = SubtractRect(&rectr, &rect1, &rect2);
    ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
    ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
        && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
        "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);

    /* source rect 2 partially overlaps rect 1 - dest is src rect 2 */
    SetRect(&rect1, 2431, 626, 3427, 1608);
    SetRect(&rect2, 2499, 626, 3427, 1608);
    result = SubtractRect(&rect2, &rect1, &rect2);
    ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
    ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
        && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
        "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);

    /* source rect 2 completely overlaps rect 1 */
    SetRect(&rect1, 250, 250, 400, 500);
    SetRect(&rect2, 50, 50, 1500, 1000);
    result = SubtractRect(&rectr, &rect1, &rect2);
    ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
        "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);

    /* source rect 2 completely overlaps rect 1 - dest is src rect 2 */
    SetRect(&rect1, 250, 250, 400, 500);
    SetRect(&rect2, 50, 50, 1500, 1000);
    result = SubtractRect(&rect2, &rect1, &rect2);
    ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
        "(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom);
}
Пример #2
0
void CCEGLView::centerWindow()
{
    if (! m_hWnd)
    {
        return;
    }

    RECT rcDesktop, rcWindow;
    GetWindowRect(GetDesktopWindow(), &rcDesktop);

    // substract the task bar
    HWND hTaskBar = FindWindow(TEXT("Shell_TrayWnd"), NULL);
    if (hTaskBar != NULL)
    {
        APPBARDATA abd;

        abd.cbSize = sizeof(APPBARDATA);
        abd.hWnd = hTaskBar;

        SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
        SubtractRect(&rcDesktop, &rcDesktop, &abd.rc);
    }
    GetWindowRect(m_hWnd, &rcWindow);

    int offsetX = (rcDesktop.right - rcDesktop.left - (rcWindow.right - rcWindow.left)) / 2;
    offsetX = (offsetX > 0) ? offsetX : rcDesktop.left;
    int offsetY = (rcDesktop.bottom - rcDesktop.top - (rcWindow.bottom - rcWindow.top)) / 2;
    offsetY = (offsetY > 0) ? offsetY : rcDesktop.top;

    SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
}
Пример #3
0
VOID WINAPI
GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, const INT *lpInfo)
{
    RECT rcCtrl;
    const INT *lpRun;
    HWND hwndCtrl;

    TRACE("(%p %p %p)\n",
	   hwnd, lpRect, lpInfo);

    GetClientRect (hwnd, lpRect);
    lpRun = lpInfo;

    do {
	lpRun += 2;
	if (*lpRun == 0)
	    return;
	lpRun++;
	hwndCtrl = GetDlgItem (hwnd, *lpRun);
	if (GetWindowLongW (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
	    TRACE("control id 0x%x\n", *lpRun);
	    GetWindowRect (hwndCtrl, &rcCtrl);
	    MapWindowPoints (NULL, hwnd, (LPPOINT)&rcCtrl, 2);
	    SubtractRect (lpRect, lpRect, &rcCtrl);
	}
	lpRun++;
    } while (*lpRun);
}
Пример #4
0
AUI_ERRCODE aui_DirtyList::SubtractRect(
	sint32 left,
	sint32 top,
	sint32 right,
	sint32 bottom )
{
	RECT rect = { left, top, right, bottom };
	return SubtractRect( &rect );
}
Пример #5
0
HDWP DockWnd_DeferPanelPos(HDWP hdwp, HWND hwndMain, RECT *rect)
{
	DOCKSERVER *dsp = GetDockServer(hwndMain);
	DOCKPANEL *dpp;

	if(dsp == 0)
		return 0;

	CopyRect(&dsp->DockRect, rect);
	CopyRect(&dsp->ClientRect, rect);

	for(dpp = dsp->PanelListHead; dpp; dpp = dpp->flink)
	{
		RECT rc = *rect;
		RECT rc2;
	                 
		if(dpp->fDocked == FALSE || dpp->fVisible == FALSE)
		{
			continue;
		}

		GetPanelClientSize(dpp, &rc2, TRUE);
		
		if(dpp->dwStyle & DWS_DOCKED_LEFT)
		{
			rc.right = rc.left + RectWidth(&rc2);
		}
		else if(dpp->dwStyle & DWS_DOCKED_RIGHT)
		{
			rc.left = rc.right - RectWidth(&rc2);	
		}
		else if(dpp->dwStyle & DWS_DOCKED_TOP)
		{
			rc.bottom = rc.top + RectHeight(&rc2);
		}
		else if(dpp->dwStyle & DWS_DOCKED_BOTTOM)
		{
			rc.top = rc.bottom - RectHeight(&rc2);
		}

		SubtractRect(rect, rect, &rc);

		hdwp = DeferWindowPos(hdwp, dpp->hwndPanel, 0, rc.left, rc.top, rc.right-rc.left,rc.bottom-rc.top,
			SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
	}

    CopyRect(&dsp->ClientRect, rect);

	return hdwp;
}
Пример #6
0
void
xxxInvalidateDesktopOnPaletteChange(PWND pwnd)
{
    PDESKTOP    pdesk;
    PWND        pwndShell;
    TL          tlpwndShell;
    RECT        rc;
    BOOL        fRedrawDesktop;

    CheckLock(pwnd);

    /*
     * Invalidate the shell window.
     */
    pdesk = PtiCurrent()->rpdesk;
    pwndShell = (pdesk) ? pdesk->pDeskInfo->spwndShell : NULL;
    if (!pwndShell) {
        fRedrawDesktop = TRUE;
        rc = gpsi->rcScreen;
    } else {
        ThreadLockAlways(pwndShell, &tlpwndShell);
        xxxRedrawWindow(
                pwndShell,
                NULL,
                NULL,
                RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN);

        /*
         * The shell window may not cover all of the desktop.
         * Invalidate the part of the desktop wallpaper it
         * doesn't sit over.
         */
        fRedrawDesktop = SubtractRect(&rc, &pwnd->rcWindow, &pwndShell->rcWindow);
        ThreadUnlock(&tlpwndShell);
    }

    /*
     * Invalidate the desktop window.
     */
    if (fRedrawDesktop) {
        xxxRedrawWindow(
                pwnd,
                &rc,
                NULL,
                RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN);
    }
}
Пример #7
0
static int HWAccelBlit (GAL_Surface *src, GAL_Rect *srcrect,
                       GAL_Surface *dst, GAL_Rect *dstrect)
{
    RECT rc_src = {srcrect->x, srcrect->y, srcrect->x + srcrect->w, srcrect->y + srcrect->h};
    RECT rc_dst = {dstrect->x, dstrect->y, dstrect->x + dstrect->w, dstrect->y + dstrect->h};
    RECT rc_inter, rc_sub [4];
    
    if (rc_src.top < rc_dst.top && IntersectRect (&rc_inter, &rc_src, &rc_dst)) {
        int i, sub_count, inter_h;
        Sint32 off_x = dstrect->x - srcrect->x;
        Sint32 off_y = dstrect->y - srcrect->y;
        GAL_Rect tmp_src, tmp_dst;

        inter_h = rc_inter.bottom - rc_inter.top;
        for (i = 0; i < inter_h; i++) {
            rc_inter.top = rc_inter.bottom - 1;
            make_rects (&tmp_src, &tmp_dst, &rc_inter, off_x, off_y);
            HWAccelBlit_helper (src, &tmp_src, dst, &tmp_dst);
            rc_inter.bottom --;
        }

        sub_count = SubtractRect (rc_sub, &rc_src, &rc_dst);
        for (i = 0; i < sub_count; i++) {
            make_rects (&tmp_src, &tmp_dst, rc_sub + i, off_x, off_y);
            HWAccelBlit_helper (src, &tmp_src, dst, &tmp_dst);
        }
    }
    else if (rc_src.top == rc_dst.top && rc_src.left < rc_dst.left) {
        int i;
        GAL_Rect tmp_src, tmp_dst;
        Sint32 off_x = dstrect->x - srcrect->x;
        RECT rc = rc_src;

        for (i = 0; i < rc_src.right - rc_src.left; i++) {
            rc.left = rc.right - 1;
            make_rects (&tmp_src, &tmp_dst, &rc, off_x, 0);
            HWAccelBlit_helper (src, &tmp_src, dst, &tmp_dst);
            rc.right --;
        }
    }
    else
        HWAccelBlit_helper (src, srcrect, dst, dstrect);

	return(0);
}
void MainWindow::OnSize()
{
	// resize the toolbar
	SendMessage(toolbar.Window(), WM_SIZE, 0, 0);

	// resize the rebar 
	SendMessage(rebar.Window(), WM_SIZE, 0, 0);

	RECT rcWindow;
	RECT rcControl;

	// Find the client area of the application.
	GetClientRect(m_hwnd, &rcWindow);

	// Subtract the area of the rebar control.
	GetClientRect(rebar.Window(), &rcControl);
	SubtractRect(&rcWindow, &rcWindow, &rcControl);

	// What's left is the area for the video. Notify the player.
	m_pPlayer->UpdateVideoWindow(&rcWindow);
}
Пример #9
0
void WinWindow::MakeCenter()
{
	RETURN_IF_NULL(mWindowHandle);
	RECT parentRect;
	RECT selfRect;
	MedusaWindowHandle parentWindowHandle = mParentWindowHandle;
	if (parentWindowHandle == nullptr)
	{
		parentWindowHandle = GetDesktopWindow();
		GetClientRect(parentWindowHandle, &parentRect);

		// subtract the task bar
		HWND hTaskBar = FindWindow(TEXT("Shell_TrayWnd"), nullptr);
		if (hTaskBar != nullptr)
		{
			APPBARDATA abd;

			abd.cbSize = sizeof(APPBARDATA);
			abd.hWnd = hTaskBar;

			SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
			SubtractRect(&parentRect, &parentRect, &abd.rc);
		}

		GetWindowRect(mWindowHandle, &selfRect);

		int offsetX = (parentRect.right - parentRect.left - (selfRect.right - selfRect.left)) / 2;
		offsetX = (offsetX > 0) ? offsetX : parentRect.left;
		int offsetY = (parentRect.bottom - parentRect.top - (selfRect.bottom - selfRect.top)) / 2;
		offsetY = (offsetY > 0) ? offsetY : parentRect.top;

		SetWindowPos(mWindowHandle, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
	}
	else
	{
		GetClientRect(parentWindowHandle, &parentRect);
		MoveWindow(mWindowHandle, parentRect.left, parentRect.top, (int)mSize.Width, (int)mSize.Height, TRUE);
	}

}
Пример #10
0
/* Calculatess the window coordinates relative to the upper left corner of the mainhWnd window */
static RECT icvCalcWindowRect( CvWindow* window )
{
    const int gutter = 1;
    RECT crect, trect, rect;

    assert(window);

    GetClientRect(window->frame, &crect);
    if(window->toolbar.toolbar)
    {
        GetWindowRect(window->toolbar.toolbar, &trect);
        icvScreenToClient(window->frame, &trect);
        SubtractRect( &rect, &crect, &trect);
    }
    else
        rect = crect;

    rect.top += gutter;
    rect.left += gutter;
    rect.bottom -= gutter;
    rect.right -= gutter;

    return rect;
}
Пример #11
0
/*
 * @implemented
 */
INT
WINAPI
CombineRgn(
    _In_ HRGN hrgnDest,
    _In_ HRGN hrgnSrc1,
    _In_ HRGN hrgnSrc2,
    _In_ INT  iCombineMode)
{
    PRGN_ATTR prngattrDest = NULL;
    PRGN_ATTR prngattrSrc1 = NULL;
    PRGN_ATTR prngattrSrc2 = NULL;
    RECT rcTemp;

    /* Get the region attribute for dest and source 1 */
    prngattrDest = GdiGetRgnAttr(hrgnDest);
    prngattrSrc1 = GdiGetRgnAttr(hrgnSrc1);

    /* If that failed or if the source 1 region is complex, go to win32k */
    if ((prngattrDest == NULL) || (prngattrSrc1 == NULL) ||
        (prngattrSrc1->iComplexity > SIMPLEREGION))
    {
        return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
    }

    /* Handle RGN_COPY first, it needs only hrgnSrc1 */
    if (iCombineMode == RGN_COPY)
    {
        /* Check if the source region is a NULLREGION */
        if (prngattrSrc1->iComplexity == NULLREGION)
        {
            /* The dest region is a NULLREGION, too */
            return IntSetNullRgn(prngattrDest);
        }

        /* We already know that the source region cannot be complex, so
           create a rect region from the bounds of the source rect */
        return IntSetRectRgn(prngattrDest,
                             prngattrSrc1->Rect.left,
                             prngattrSrc1->Rect.top,
                             prngattrSrc1->Rect.right,
                             prngattrSrc1->Rect.bottom);
    }

    /* For all other operations we need hrgnSrc2 */
    prngattrSrc2 = GdiGetRgnAttr(hrgnSrc2);

    /* If we got no attribute or the region is complex, go to win32k */
    if ((prngattrSrc2 == NULL) || (prngattrSrc2->iComplexity > SIMPLEREGION))
    {
        return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
    }

    /* Handle RGN_AND */
    if (iCombineMode == RGN_AND)
    {
        /* Check if either of the regions is a NULLREGION */
        if ((prngattrSrc1->iComplexity == NULLREGION) ||
            (prngattrSrc2->iComplexity == NULLREGION))
        {
            /* Result is also a NULLREGION */
            return IntSetNullRgn(prngattrDest);
        }

        /* Get the intersection of the 2 rects */
        if (!IntersectRect(&rcTemp, &prngattrSrc1->Rect, &prngattrSrc2->Rect))
        {
            /* The rects do not intersect, result is a NULLREGION */
            return IntSetNullRgn(prngattrDest);
        }

        /* Use the intersection of the rects */
        return IntSetRectRgn(prngattrDest,
                             rcTemp.left,
                             rcTemp.top,
                             rcTemp.right,
                             rcTemp.bottom);
    }

    /* Handle RGN_DIFF */
    if (iCombineMode == RGN_DIFF)
    {
        /* Check if source 1 is a NULLREGION */
        if (prngattrSrc1->iComplexity == NULLREGION)
        {
            /* The result is a NULLREGION as well */
            return IntSetNullRgn(prngattrDest);
        }

        /* Get the intersection of the 2 rects */
        if ((prngattrSrc2->iComplexity == NULLREGION) ||
            !IntersectRect(&rcTemp, &prngattrSrc1->Rect, &prngattrSrc2->Rect))
        {
            /* The rects do not intersect, dest equals source 1 */
            return IntSetRectRgn(prngattrDest,
                                 prngattrSrc1->Rect.left,
                                 prngattrSrc1->Rect.top,
                                 prngattrSrc1->Rect.right,
                                 prngattrSrc1->Rect.bottom);
        }

        /* We need to check is whether we can subtract the rects. For that
           we call SubtractRect, which will give us the bounding box of the
           subtraction. The function returns FALSE if the resulting rect is
           empty */
        if (!SubtractRect(&rcTemp, &prngattrSrc1->Rect, &rcTemp))
        {
            /* The result is a NULLREGION */
            return IntSetNullRgn(prngattrDest);
        }

        /* Now check if the result of SubtractRect matches the source 1 rect.
           Since we already know that the rects intersect, the result can
           only match the source 1 rect, if it could not be "cut" on either
           side, but the overlapping was on a corner, so the new bounding box
           equals the previous rect */
        if (!EqualRect(&rcTemp, &prngattrSrc1->Rect))
        {
            /* We got a properly subtracted rect, so use it. */
            return IntSetRectRgn(prngattrDest,
                                 rcTemp.left,
                                 rcTemp.top,
                                 rcTemp.right,
                                 rcTemp.bottom);
        }

        /* The result would be a complex region, go to win32k */
        return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
    }

    /* Handle OR and XOR */
    if ((iCombineMode == RGN_OR) || (iCombineMode == RGN_XOR))
    {
        /* Check if source 1 is a NULLREGION */
        if (prngattrSrc1->iComplexity == NULLREGION)
        {
            /* Check if source 2 is also a NULLREGION */
            if (prngattrSrc2->iComplexity == NULLREGION)
            {
                /* Both are NULLREGIONs, result is also a NULLREGION */
                return IntSetNullRgn(prngattrDest);
            }

            /* The result is equal to source 2 */
            return IntSetRectRgn(prngattrDest,
                                 prngattrSrc2->Rect.left,
                                 prngattrSrc2->Rect.top,
                                 prngattrSrc2->Rect.right,
                                 prngattrSrc2->Rect.bottom );
        }

        /* Check if only source 2 is a NULLREGION */
        if (prngattrSrc2->iComplexity == NULLREGION)
        {
            /* The result is equal to source 1 */
            return IntSetRectRgn(prngattrDest,
                                 prngattrSrc1->Rect.left,
                                 prngattrSrc1->Rect.top,
                                 prngattrSrc1->Rect.right,
                                 prngattrSrc1->Rect.bottom);
        }

        /* Do the rects have the same x extent */
        if ((prngattrSrc1->Rect.left == prngattrSrc2->Rect.left) &&
            (prngattrSrc1->Rect.right == prngattrSrc2->Rect.right))
        {
            /* Do the rects also have the same y extent */
            if ((prngattrSrc1->Rect.top == prngattrSrc2->Rect.top) &&
                (prngattrSrc1->Rect.bottom == prngattrSrc2->Rect.bottom))
            {
                /* Rects are equal, if this is RGN_OR, the result is source 1 */
                if (iCombineMode == RGN_OR)
                {
                    /* The result is equal to source 1 */
                    return IntSetRectRgn(prngattrDest,
                                         prngattrSrc1->Rect.left,
                                         prngattrSrc1->Rect.top,
                                         prngattrSrc1->Rect.right,
                                         prngattrSrc1->Rect.bottom );
                }
                else
                {
                    /* XORing with itself yields an empty region */
                    return IntSetNullRgn(prngattrDest);
                }
            }

            /* Check if the rects are disjoint */
            if ((prngattrSrc2->Rect.bottom < prngattrSrc1->Rect.top) ||
                (prngattrSrc2->Rect.top > prngattrSrc1->Rect.bottom))
            {
                /* The result would be a complex region, go to win32k */
                return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
            }

            /* Check if this is OR */
            if (iCombineMode == RGN_OR)
            {
                /* Use the maximum extent of both rects combined */
                return IntSetRectRgn(prngattrDest,
                                     prngattrSrc1->Rect.left,
                                     min(prngattrSrc1->Rect.top, prngattrSrc2->Rect.top),
                                     prngattrSrc1->Rect.right,
                                     max(prngattrSrc1->Rect.bottom, prngattrSrc2->Rect.bottom));
            }

            /* Check if the rects are adjacent */
            if (prngattrSrc2->Rect.bottom == prngattrSrc1->Rect.top)
            {
                /* The result is the combined rects */
                return IntSetRectRgn(prngattrDest,
                                     prngattrSrc1->Rect.left,
                                     prngattrSrc2->Rect.top,
                                     prngattrSrc1->Rect.right,
                                     prngattrSrc1->Rect.bottom );
            }
            else if (prngattrSrc2->Rect.top == prngattrSrc1->Rect.bottom)
            {
                /* The result is the combined rects */
                return IntSetRectRgn(prngattrDest,
                                     prngattrSrc1->Rect.left,
                                     prngattrSrc1->Rect.top,
                                     prngattrSrc1->Rect.right,
                                     prngattrSrc2->Rect.bottom );
            }

            /* When we are here, this is RGN_XOR and the rects overlap */
            return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
        }

        /* Do the rects have the same y extent */
        if ((prngattrSrc1->Rect.top == prngattrSrc2->Rect.top) &&
            (prngattrSrc1->Rect.bottom == prngattrSrc2->Rect.bottom))
        {
            /* Check if the rects are disjoint */
            if ((prngattrSrc2->Rect.right < prngattrSrc1->Rect.left) ||
                (prngattrSrc2->Rect.left > prngattrSrc1->Rect.right))
            {
                /* The result would be a complex region, go to win32k */
                return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
            }

            /* Check if this is OR */
            if (iCombineMode == RGN_OR)
            {
                /* Use the maximum extent of both rects combined */
                return IntSetRectRgn(prngattrDest,
                                     min(prngattrSrc1->Rect.left, prngattrSrc2->Rect.left),
                                     prngattrSrc1->Rect.top,
                                     max(prngattrSrc1->Rect.right, prngattrSrc2->Rect.right),
                                     prngattrSrc1->Rect.bottom);
            }

            /* Check if the rects are adjacent */
            if (prngattrSrc2->Rect.right == prngattrSrc1->Rect.left)
            {
                /* The result is the combined rects */
                return IntSetRectRgn(prngattrDest,
                                     prngattrSrc2->Rect.left,
                                     prngattrSrc1->Rect.top,
                                     prngattrSrc1->Rect.right,
                                     prngattrSrc1->Rect.bottom );
            }
            else if (prngattrSrc2->Rect.left == prngattrSrc1->Rect.right)
            {
                /* The result is the combined rects */
                return IntSetRectRgn(prngattrDest,
                                     prngattrSrc1->Rect.left,
                                     prngattrSrc1->Rect.top,
                                     prngattrSrc2->Rect.right,
                                     prngattrSrc1->Rect.bottom );
            }

            /* When we are here, this is RGN_XOR and the rects overlap */
            return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
        }

        /* Last case: RGN_OR and one rect is completely within the other */
        if (iCombineMode == RGN_OR)
        {
            /* Check if rect 1 can contain rect 2 */
            if (prngattrSrc1->Rect.left <= prngattrSrc2->Rect.left)
            {
                /* rect 1 might be the outer one, check of that is true */
                if ((prngattrSrc1->Rect.right >= prngattrSrc2->Rect.right) &&
                    (prngattrSrc1->Rect.top <= prngattrSrc2->Rect.top) &&
                    (prngattrSrc1->Rect.bottom >= prngattrSrc2->Rect.bottom))
                {
                    /* Rect 1 contains rect 2, use it */
                    return IntSetRectRgn(prngattrDest,
                                         prngattrSrc1->Rect.left,
                                         prngattrSrc1->Rect.top,
                                         prngattrSrc1->Rect.right,
                                         prngattrSrc1->Rect.bottom );
                }
            }
            else
            {
                /* rect 2 might be the outer one, check of that is true */
                if ((prngattrSrc2->Rect.right >= prngattrSrc1->Rect.right) &&
                    (prngattrSrc2->Rect.top <= prngattrSrc1->Rect.top) &&
                    (prngattrSrc2->Rect.bottom >= prngattrSrc1->Rect.bottom))
                {
                    /* Rect 2 contains rect 1, use it */
                    return IntSetRectRgn(prngattrDest,
                                         prngattrSrc2->Rect.left,
                                         prngattrSrc2->Rect.top,
                                         prngattrSrc2->Rect.right,
                                         prngattrSrc2->Rect.bottom );
                }
            }
        }

        /* We couldn't handle the operation, go to win32k */
        return NtGdiCombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, iCombineMode);
    }

    DPRINT1("Invalid iCombineMode %d\n", iCombineMode);
    SetLastError(ERROR_INVALID_PARAMETER);
    return ERROR;
}