Commit 39ff69c7 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

NXmiexpose.c: use upstream miHandleExposures()

It is (functionally) identical to our code, so why have duplicate code?
parent a2523273
......@@ -102,280 +102,6 @@ Equipment Corporation.
#include "../../mi/miexpose.c"
/* miHandleExposures
generate a region for exposures for areas that were copied from obscured or
non-existent areas to non-obscured areas of the destination. Paint the
background for the region, if the destination is a window.
NOTE:
this should generally be called, even if graphicsExposures is false,
because this is where bits get recovered from backing store.
NOTE:
added argument 'plane' is used to indicate how exposures from backing
store should be accomplished. If plane is 0 (i.e. no bit plane), CopyArea
should be used, else a CopyPlane of the indicated plane will be used. The
exposing is done by the backing store's GraphicsExpose function, of course.
*/
RegionPtr
miHandleExposures(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, plane)
register DrawablePtr pSrcDrawable;
register DrawablePtr pDstDrawable;
GCPtr pGC;
int srcx, srcy;
int width, height;
int dstx, dsty;
unsigned long plane;
{
register ScreenPtr pscr;
RegionPtr prgnSrcClip; /* drawable-relative source clip */
RegionRec rgnSrcRec;
RegionPtr prgnDstClip; /* drawable-relative dest clip */
RegionRec rgnDstRec;
BoxRec srcBox; /* unclipped source */
RegionRec rgnExposed; /* exposed region, calculated source-
relative, made dst relative to
intersect with visible parts of
dest and send events to client,
and then screen relative to paint
the window background
*/
WindowPtr pSrcWin;
BoxRec expBox;
Bool extents;
/*
* Set the elements reported by the compiler
* as uninitialized.
*/
expBox.x1 = 0;
expBox.y1 = 0;
expBox.x2 = 0;
expBox.y2 = 0;
/* This prevents warning about pscr not being used. */
pGC->pScreen = pscr = pGC->pScreen;
/* avoid work if we can */
if (!pGC->graphicsExposures &&
(pDstDrawable->type == DRAWABLE_PIXMAP) &&
((pSrcDrawable->type == DRAWABLE_PIXMAP) ||
(((WindowPtr)pSrcDrawable)->backStorage == NULL)))
return NULL;
srcBox.x1 = srcx;
srcBox.y1 = srcy;
srcBox.x2 = srcx+width;
srcBox.y2 = srcy+height;
if (pSrcDrawable->type != DRAWABLE_PIXMAP)
{
BoxRec TsrcBox;
TsrcBox.x1 = srcx + pSrcDrawable->x;
TsrcBox.y1 = srcy + pSrcDrawable->y;
TsrcBox.x2 = TsrcBox.x1 + width;
TsrcBox.y2 = TsrcBox.y1 + height;
pSrcWin = (WindowPtr) pSrcDrawable;
if (pGC->subWindowMode == IncludeInferiors)
{
prgnSrcClip = NotClippedByChildren (pSrcWin);
if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN)
{
RegionDestroy(prgnSrcClip);
return NULL;
}
}
else
{
if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN)
return NULL;
prgnSrcClip = &rgnSrcRec;
RegionNull(prgnSrcClip);
RegionCopy(prgnSrcClip, &pSrcWin->clipList);
}
RegionTranslate(prgnSrcClip,
-pSrcDrawable->x, -pSrcDrawable->y);
}
else
{
BoxRec box;
if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) &&
(srcBox.x2 <= pSrcDrawable->width) &&
(srcBox.y2 <= pSrcDrawable->height))
return NULL;
box.x1 = 0;
box.y1 = 0;
box.x2 = pSrcDrawable->width;
box.y2 = pSrcDrawable->height;
prgnSrcClip = &rgnSrcRec;
RegionInit(prgnSrcClip, &box, 1);
pSrcWin = (WindowPtr)NULL;
}
if (pDstDrawable == pSrcDrawable)
{
prgnDstClip = prgnSrcClip;
}
else if (pDstDrawable->type != DRAWABLE_PIXMAP)
{
if (pGC->subWindowMode == IncludeInferiors)
{
prgnDstClip = NotClippedByChildren((WindowPtr)pDstDrawable);
}
else
{
prgnDstClip = &rgnDstRec;
RegionNull(prgnDstClip);
RegionCopy(prgnDstClip,
&((WindowPtr)pDstDrawable)->clipList);
}
RegionTranslate(prgnDstClip,
-pDstDrawable->x, -pDstDrawable->y);
}
else
{
BoxRec box;
box.x1 = 0;
box.y1 = 0;
box.x2 = pDstDrawable->width;
box.y2 = pDstDrawable->height;
prgnDstClip = &rgnDstRec;
RegionInit(prgnDstClip, &box, 1);
}
/* drawable-relative source region */
RegionInit(&rgnExposed, &srcBox, 1);
/* now get the hidden parts of the source box*/
RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip);
if (pSrcWin && pSrcWin->backStorage)
{
/*
* Copy any areas from the source backing store. Modifies
* rgnExposed.
*/
(* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable,
pDstDrawable,
pGC,
&rgnExposed,
srcx, srcy,
dstx, dsty,
plane);
}
/* move them over the destination */
RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy);
/* intersect with visible areas of dest */
RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip);
/*
* If we have LOTS of rectangles, we decide to take the extents
* and force an exposure on that. This should require much less
* work overall, on both client and server. This is cheating, but
* isn't prohibited by the protocol ("spontaneous combustion" :-)
* for windows.
*/
extents = pGC->graphicsExposures &&
(RegionNumRects(&rgnExposed) > RECTLIMIT) &&
(pDstDrawable->type != DRAWABLE_PIXMAP);
#ifdef SHAPE
if (pSrcWin)
{
RegionPtr region;
if (!(region = wClipShape (pSrcWin)))
region = wBoundingShape (pSrcWin);
/*
* If you try to CopyArea the extents of a shaped window, compacting the
* exposed region will undo all our work!
*/
if (extents && pSrcWin && region &&
(RegionContainsRect(region, &srcBox) != rgnIN))
extents = FALSE;
}
#endif
if (extents)
{
WindowPtr pWin = (WindowPtr)pDstDrawable;
expBox = *RegionExtents(&rgnExposed);
RegionReset(&rgnExposed, &expBox);
/* need to clear out new areas of backing store */
if (pWin->backStorage)
(void) (* pWin->drawable.pScreen->ClearBackingStore)(
pWin,
expBox.x1,
expBox.y1,
expBox.x2 - expBox.x1,
expBox.y2 - expBox.y1,
FALSE);
}
if ((pDstDrawable->type != DRAWABLE_PIXMAP) &&
(((WindowPtr)pDstDrawable)->backgroundState != None))
{
WindowPtr pWin = (WindowPtr)pDstDrawable;
/* make the exposed area screen-relative */
RegionTranslate(&rgnExposed,
pDstDrawable->x, pDstDrawable->y);
if (extents)
{
/* PaintWindowBackground doesn't clip, so we have to */
RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
}
(*pWin->drawable.pScreen->PaintWindowBackground)(
(WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND);
if (extents)
{
RegionReset(&rgnExposed, &expBox);
}
else
RegionTranslate(&rgnExposed,
-pDstDrawable->x, -pDstDrawable->y);
}
if (prgnDstClip == &rgnDstRec)
{
RegionUninit(prgnDstClip);
}
else if (prgnDstClip != prgnSrcClip)
{
RegionDestroy(prgnDstClip);
}
if (prgnSrcClip == &rgnSrcRec)
{
RegionUninit(prgnSrcClip);
}
else
{
RegionDestroy(prgnSrcClip);
}
if (pGC->graphicsExposures)
{
/* don't look */
RegionPtr exposed = RegionCreate(NullBox, 0);
*exposed = rgnExposed;
return exposed;
}
else
{
RegionUninit(&rgnExposed);
return NULL;
}
}
void
miWindowExposures(pWin, prgn, other_exposed)
WindowPtr pWin;
......
......@@ -126,7 +126,6 @@ exposing is done by the backing store's GraphicsExpose function, of course.
*/
#ifndef NXAGENT_SERVER
RegionPtr
miHandleExposures(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, plane)
......@@ -373,7 +372,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
return NULL;
}
}
#endif
/* send GraphicsExpose events, or a NoExpose event, based on the region */
......
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