Commit d94f4727 authored by Ulrich Sibiller's avatar Ulrich Sibiller

Drawable.c: code simplifications / scope improvements

parent 0133d461
...@@ -122,12 +122,8 @@ int nxagentSkipImage = 0; ...@@ -122,12 +122,8 @@ int nxagentSkipImage = 0;
static int nxagentTooManyImageData(void) static int nxagentTooManyImageData(void)
{ {
unsigned int r; unsigned int limit = nxagentOption(ImageRateLimit);
unsigned int limit; unsigned int r = nxagentGetDataRate() / 1000;
limit = nxagentOption(ImageRateLimit);
r = nxagentGetDataRate() / 1000;
#ifdef TEST #ifdef TEST
if (r > limit) if (r > limit)
...@@ -141,8 +137,6 @@ static int nxagentTooManyImageData(void) ...@@ -141,8 +137,6 @@ static int nxagentTooManyImageData(void)
int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int breakMask, WindowPtr owner) int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int breakMask, WindowPtr owner)
{ {
int result;
pDrawable = nxagentSplitDrawable(pDrawable); pDrawable = nxagentSplitDrawable(pDrawable);
if (nxagentLosslessTrap == 0) if (nxagentLosslessTrap == 0)
...@@ -170,7 +164,7 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre ...@@ -170,7 +164,7 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
nxagentSplitTrap = 1; nxagentSplitTrap = 1;
result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner); int result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner);
nxagentSplitTrap = 0; nxagentSplitTrap = 0;
...@@ -182,7 +176,6 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre ...@@ -182,7 +176,6 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
} }
#ifdef TEST #ifdef TEST
if (nxagentDrawableStatus(pDrawable) == Synchronized) if (nxagentDrawableStatus(pDrawable) == Synchronized)
{ {
fprintf(stderr, "nxagentSynchronizeDrawable: Drawable %s [%p] with id [%ld] now synchronized.\n", fprintf(stderr, "nxagentSynchronizeDrawable: Drawable %s [%p] with id [%ld] now synchronized.\n",
...@@ -193,7 +186,6 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre ...@@ -193,7 +186,6 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
fprintf(stderr, "nxagentSynchronizeDrawable: Drawable %s [%p] with id [%ld] not fully synchronized.\n", fprintf(stderr, "nxagentSynchronizeDrawable: Drawable %s [%p] with id [%ld] not fully synchronized.\n",
nxagentDrawableType(pDrawable), (void *) pDrawable, pDrawable -> id); nxagentDrawableType(pDrawable), (void *) pDrawable, pDrawable -> id);
} }
#endif #endif
return result; return result;
...@@ -201,31 +193,27 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre ...@@ -201,31 +193,27 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner) int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner)
{ {
int width, height, depth, length;
unsigned int leftPad, format;
char *data = NULL; char *data = NULL;
DrawablePtr pSrcDrawable;
GCPtr pGC;
int success; int success;
if (pDrawable -> type == DRAWABLE_PIXMAP) if (pDrawable -> type == DRAWABLE_PIXMAP)
{ {
leftPad = 0; GCPtr pGC;
unsigned int leftPad = 0;
width = pDrawable -> width; int width = pDrawable -> width;
height = pDrawable -> height; int height = pDrawable -> height;
depth = pDrawable -> depth; int depth = pDrawable -> depth;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSynchronizeDrawableData: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n", fprintf(stderr, "nxagentSynchronizeDrawableData: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n",
nxagentDrawableType(pDrawable), width, height, depth); nxagentDrawableType(pDrawable), width, height, depth);
#endif #endif
format = (depth == 1) ? XYPixmap : ZPixmap; unsigned int format = (depth == 1) ? XYPixmap : ZPixmap;
length = nxagentImageLength(width, height, format, leftPad, depth); int length = nxagentImageLength(width, height, format, leftPad, depth);
if ((data = malloc(length)) == NULL) if ((data = malloc(length)) == NULL)
{ {
...@@ -238,7 +226,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask ...@@ -238,7 +226,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask
goto nxagentSynchronizeDrawableDataEnd; goto nxagentSynchronizeDrawableDataEnd;
} }
pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ? DrawablePtr pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ?
((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) : ((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) :
pDrawable); pDrawable);
...@@ -369,47 +357,20 @@ nxagentSynchronizeDrawableDataEnd: ...@@ -369,47 +357,20 @@ nxagentSynchronizeDrawableDataEnd:
int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned int breakMask, WindowPtr owner) int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned int breakMask, WindowPtr owner)
{ {
GCPtr pGC;
DrawablePtr pSrcDrawable; DrawablePtr pSrcDrawable;
BoxPtr pBox;
RegionPtr clipRegion;
RegionRec tileRegion; int leftPad = 0;
RegionRec exposeRegion; int success = 0;
BoxRec box; char *data = NULL;
BoxRec tileBox; GCPtr pGC = NULL;
RegionPtr clipRegion = NullRegion;
#ifdef COLLECTED_UPDATES #ifdef COLLECTED_UPDATES
RegionRec collectedUpdates; RegionRec collectedUpdates;
#endif
char *data;
int nBox;
int x, y;
int w, h;
int extentWidth, extentHeight;
int tileWidth, tileHeight;
int length, format, leftPad;
int i;
int saveTrap;
int success;
int useStoredBitmap;
unsigned long now;
unsigned long elapsedTime;
leftPad = 0;
success = 0;
data = NULL;
pGC = NULL;
clipRegion = NullRegion;
#ifdef COLLECTED_UPDATES
RegionInit(&collectedUpdates, NullBox, 1); RegionInit(&collectedUpdates, NullBox, 1);
#endif #endif
RegionRec exposeRegion;
RegionInit(&exposeRegion, NullBox, 1); RegionInit(&exposeRegion, NullBox, 1);
if (nxagentDrawableBitmap(pDrawable) != NullPixmap && if (nxagentDrawableBitmap(pDrawable) != NullPixmap &&
...@@ -429,7 +390,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -429,7 +390,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
* full drawable. * full drawable.
*/ */
useStoredBitmap = (nxagentDrawableBitmap(pDrawable) != NullPixmap && pRegion == NullRegion); int useStoredBitmap = (nxagentDrawableBitmap(pDrawable) != NullPixmap && pRegion == NullRegion);
if (useStoredBitmap != 0) if (useStoredBitmap != 0)
{ {
...@@ -570,7 +531,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -570,7 +531,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentDrawableType(pDrawable), (void *) pDrawable); nxagentDrawableType(pDrawable), (void *) pDrawable);
#endif #endif
saveTrap = nxagentGCTrap; int saveTrap = nxagentGCTrap;
nxagentGCTrap = 0; nxagentGCTrap = 0;
...@@ -609,6 +570,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -609,6 +570,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
* huge window it had to result in a failed data memory allocation. * huge window it had to result in a failed data memory allocation.
*/ */
int w, h, extentWidth, extentHeight, tileWidth, tileHeight;
extentWidth = clipRegion -> extents.x2 - clipRegion -> extents.x1; extentWidth = clipRegion -> extents.x2 - clipRegion -> extents.x1;
extentHeight = clipRegion -> extents.y2 - clipRegion -> extents.y1; extentHeight = clipRegion -> extents.y2 - clipRegion -> extents.y1;
...@@ -619,6 +581,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -619,6 +581,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
fprintf(stderr, "nxagentSynchronizeRegion: Using tiles of size [%dx%d].\n", tileWidth, tileHeight); fprintf(stderr, "nxagentSynchronizeRegion: Using tiles of size [%dx%d].\n", tileWidth, tileHeight);
#endif #endif
int length, format;
data = nxagentAllocateImageData(w, h, pDrawable -> depth, &length, &format); data = nxagentAllocateImageData(w, h, pDrawable -> depth, &length, &format);
if (data == NULL) if (data == NULL)
...@@ -646,17 +609,17 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -646,17 +609,17 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
#ifndef USE_OPTIMIZED_BOXES #ifndef USE_OPTIMIZED_BOXES
pBox = RegionRects(clipRegion); BoxPtr pBox = RegionRects(clipRegion);
#else #else
pBox = nxagentGetOptimizedRegionBoxes(clipRegion); BoxPtr pBox = nxagentGetOptimizedRegionBoxes(clipRegion);
#endif /* USE_OPTIMIZED_BOXES */ #endif /* USE_OPTIMIZED_BOXES */
nBox = RegionNumRects(clipRegion); int nBox = RegionNumRects(clipRegion);
now = GetTimeInMillis(); unsigned long now = GetTimeInMillis();
nxagentSynchronization.abort = 0; nxagentSynchronization.abort = 0;
...@@ -664,7 +627,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -664,7 +627,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
* Going to split the updated region into small blocks. * Going to split the updated region into small blocks.
*/ */
for (i = 0; i < nBox; i++) for (int i = 0; i < nBox; i++)
{ {
#ifdef USE_OPTIMIZED_BOXES #ifdef USE_OPTIMIZED_BOXES
...@@ -676,13 +639,13 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -676,13 +639,13 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
#endif #endif
box = pBox[i]; BoxRec box = pBox[i];
for (y = box.y1; y < box.y2; y += h) for (int y = box.y1; y < box.y2; y += h)
{ {
h = min(box.y2 - y, tileHeight); h = min(box.y2 - y, tileHeight);
for (x = box.x1; x < box.x2; x += w) for (int x = box.x1; x < box.x2; x += w)
{ {
w = min(box.x2 - x, tileWidth); w = min(box.x2 - x, tileWidth);
...@@ -713,7 +676,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -713,7 +676,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
* DeferTimeout milliseconds. * DeferTimeout milliseconds.
*/ */
elapsedTime = GetTimeInMillis() - now; unsigned long elapsedTime = GetTimeInMillis() - now;
if (elapsedTime > nxagentOption(DeferTimeout)) if (elapsedTime > nxagentOption(DeferTimeout))
{ {
...@@ -762,10 +725,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -762,10 +725,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
goto nxagentSynchronizeRegionStop; goto nxagentSynchronizeRegionStop;
} }
tileBox.x1 = x; BoxRec tileBox = {.x1 = x, .y1 = y, .x2 = x + w, .y2 = y + h};
tileBox.y1 = y;
tileBox.x2 = x + w;
tileBox.y2 = y + h;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize tile [%d,%d,%d,%d].\n", fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize tile [%d,%d,%d,%d].\n",
...@@ -778,6 +738,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -778,6 +738,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
* Going to unmark the synchronized region. * Going to unmark the synchronized region.
*/ */
RegionRec tileRegion;
RegionInit(&tileRegion, &tileBox, 1); RegionInit(&tileRegion, &tileBox, 1);
RegionUnion(&exposeRegion, &exposeRegion, &tileRegion); RegionUnion(&exposeRegion, &exposeRegion, &tileRegion);
...@@ -806,11 +767,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -806,11 +767,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (nxagentDrawableStatus(pDrawable) == NotSynchronized) if (nxagentDrawableStatus(pDrawable) == NotSynchronized)
{ {
char *cmpData;
int cmpLength, cmpFormat; int cmpLength, cmpFormat;
cmpData = nxagentAllocateImageData(w, h, pDrawable -> depth, &cmpLength, &cmpFormat); char *cmpData = nxagentAllocateImageData(w, h, pDrawable -> depth, &cmpLength, &cmpFormat);
if (cmpData != NULL) if (cmpData != NULL)
{ {
...@@ -877,16 +836,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -877,16 +836,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
(nxagentOption(XRatio) != DONT_SCALE || (nxagentOption(XRatio) != DONT_SCALE ||
nxagentOption(YRatio) != DONT_SCALE)) nxagentOption(YRatio) != DONT_SCALE))
{ {
int scaledx; int scaledx = nxagentScale(x, nxagentOption(XRatio));
int scaledy; int scaledy = nxagentScale(y, nxagentOption(YRatio));
int scaledw;
int scaledh;
scaledx = nxagentScale(x, nxagentOption(XRatio));
scaledy = nxagentScale(y, nxagentOption(YRatio));
scaledw = nxagentScale(x + w, nxagentOption(XRatio)) - scaledx; int scaledw = nxagentScale(x + w, nxagentOption(XRatio)) - scaledx;
scaledh = nxagentScale(y + h, nxagentOption(YRatio)) - scaledy; int scaledh = nxagentScale(y + h, nxagentOption(YRatio)) - scaledy;
XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0); XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0);
} }
...@@ -969,14 +923,12 @@ nxagentSynchronizeRegionStop: ...@@ -969,14 +923,12 @@ nxagentSynchronizeRegionStop:
nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1 && nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1 &&
RegionNil(&exposeRegion) == 0) RegionNil(&exposeRegion) == 0)
{ {
struct nxagentExposeBackground eb; struct nxagentExposeBackground eb = {
.pBackground = (PixmapPtr) pDrawable,
int i; .pExpose = &exposeRegion,
};
eb.pBackground = (PixmapPtr) pDrawable;
eb.pExpose = &exposeRegion;
for (i = 0; i < MAXCLIENTS; i++) for (int i = 0; i < MAXCLIENTS; i++)
{ {
if (clients[i] != NULL) if (clients[i] != NULL)
{ {
...@@ -995,27 +947,22 @@ nxagentSynchronizeRegionStop: ...@@ -995,27 +947,22 @@ nxagentSynchronizeRegionStop:
RegionValidate(&collectedUpdates, &overlap); RegionValidate(&collectedUpdates, &overlap);
for (i = 0; i < RegionNumRects(&collectedUpdates); i++) for (int i = 0; i < RegionNumRects(&collectedUpdates); i++)
{ {
x = RegionRects(&collectedUpdates)[i].x1; int x = RegionRects(&collectedUpdates)[i].x1;
y = RegionRects(&collectedUpdates)[i].y1; int y = RegionRects(&collectedUpdates)[i].y1;
w = RegionRects(&collectedUpdates)[i].x2 - RegionRects(&collectedUpdates)[i].x1; int w = RegionRects(&collectedUpdates)[i].x2 - RegionRects(&collectedUpdates)[i].x1;
h = RegionRects(&collectedUpdates)[i].y2 - RegionRects(&collectedUpdates)[i].y1; int h = RegionRects(&collectedUpdates)[i].y2 - RegionRects(&collectedUpdates)[i].y1;
if (nxagentOption(Shadow) == 1 && if (nxagentOption(Shadow) == 1 &&
(nxagentOption(XRatio) != DONT_SCALE || (nxagentOption(XRatio) != DONT_SCALE ||
nxagentOption(YRatio) != DONT_SCALE)) nxagentOption(YRatio) != DONT_SCALE))
{ {
int scaledx; int scaledx = nxagentScale(x, nxagentOption(XRatio));
int scaledy; int scaledy = nxagentScale(y, nxagentOption(YRatio));
int scaledw;
int scaledh;
scaledx = nxagentScale(x, nxagentOption(XRatio));
scaledy = nxagentScale(y, nxagentOption(YRatio));
scaledw = nxagentScale(x + w, nxagentOption(XRatio)) - scaledx; int scaledw = nxagentScale(x + w, nxagentOption(XRatio)) - scaledx;
scaledh = nxagentScale(y + h, nxagentOption(YRatio)) - scaledy; int scaledh = nxagentScale(y + h, nxagentOption(YRatio)) - scaledy;
XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0); XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0);
} }
...@@ -1050,8 +997,6 @@ nxagentSynchronizeRegionFree: ...@@ -1050,8 +997,6 @@ nxagentSynchronizeRegionFree:
void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int breakMask) void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int breakMask)
{ {
RegionPtr pRegion;
if (nxagentDrawableStatus(pDrawable) == Synchronized) if (nxagentDrawableStatus(pDrawable) == Synchronized)
{ {
#ifdef TEST #ifdef TEST
...@@ -1078,7 +1023,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea ...@@ -1078,7 +1023,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea
pBox -> x1, pBox -> y1, pBox -> x2, pBox -> y2); pBox -> x1, pBox -> y1, pBox -> x2, pBox -> y2);
#endif #endif
pRegion = nxagentCreateRegion(pDrawable, NULL, pBox -> x1, pBox -> y1, RegionPtr pRegion = nxagentCreateRegion(pDrawable, NULL, pBox -> x1, pBox -> y1,
pBox -> x2 - pBox -> x1, pBox -> y2 - pBox -> y1); pBox -> x2 - pBox -> x1, pBox -> y2 - pBox -> y1);
...@@ -1282,10 +1227,6 @@ FIXME: This condition sounds only as a complication, as the break ...@@ -1282,10 +1227,6 @@ FIXME: This condition sounds only as a complication, as the break
void nxagentSynchronizationLoop(unsigned int mask) void nxagentSynchronizationLoop(unsigned int mask)
{ {
unsigned int breakMask;
int doRoundRobin;
/* /*
FIXME: All drawables should be set as synchronized and never marked as FIXME: All drawables should be set as synchronized and never marked as
corrupted while the display is down. corrupted while the display is down.
...@@ -1325,7 +1266,7 @@ FIXME: All drawables should be set as synchronized and never marked as ...@@ -1325,7 +1266,7 @@ FIXME: All drawables should be set as synchronized and never marked as
"blocking [%d].\n", nxagentCongestion, nxagentBlocking); "blocking [%d].\n", nxagentCongestion, nxagentBlocking);
#endif #endif
breakMask = mask; unsigned int breakMask = mask;
/* /*
* The resource counter can be reset if we have not aborted the * The resource counter can be reset if we have not aborted the
...@@ -1333,7 +1274,7 @@ FIXME: All drawables should be set as synchronized and never marked as ...@@ -1333,7 +1274,7 @@ FIXME: All drawables should be set as synchronized and never marked as
* round-robin and if the bitmaps are all synchronized. * round-robin and if the bitmaps are all synchronized.
*/ */
doRoundRobin = (nxagentSynchronization.pDrawable != NULL); int doRoundRobin = (nxagentSynchronization.pDrawable != NULL);
nxagentSynchronization.abort = 0; nxagentSynchronization.abort = 0;
...@@ -1471,15 +1412,8 @@ FIXME: All drawables should be set as synchronized and never marked as ...@@ -1471,15 +1412,8 @@ FIXME: All drawables should be set as synchronized and never marked as
RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
int width, int height) int width, int height)
{ {
RegionPtr pRegion; BoxRec box = {.x1 = x, .y1 = y, .x2 = x + width, .y2 = y + height};
BoxRec box; RegionPtr pRegion = RegionCreate(&box, 1);
box.x1 = x;
box.y1 = y;
box.x2 = x + width;
box.y2 = y + height;
pRegion = RegionCreate(&box, 1);
/* /*
* Clipping the region. * Clipping the region.
...@@ -1487,22 +1421,17 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ...@@ -1487,22 +1421,17 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
if (pDrawable -> type == DRAWABLE_PIXMAP) if (pDrawable -> type == DRAWABLE_PIXMAP)
{ {
BoxRec tmpBox;
RegionRec tmpRegion;
/* /*
* The region created doesn't need to be clipped * The region created doesn't need to be clipped if it has the
* if it has the pixmap dimensions. * pixmap dimensions.
*/ */
if (x != 0 || y != 0 || if (x != 0 || y != 0 ||
width != pDrawable -> width || width != pDrawable -> width ||
height != pDrawable -> height) height != pDrawable -> height)
{ {
tmpBox.x1 = 0; BoxRec tmpBox = {.x1 = 0, .y1 = 0, .x2 = pDrawable -> width, .y2 = pDrawable -> height};
tmpBox.y1 = 0; RegionRec tmpRegion;
tmpBox.x2 = pDrawable -> width;
tmpBox.y2 = pDrawable -> height;
RegionInit(&tmpRegion, &tmpBox, 1); RegionInit(&tmpRegion, &tmpBox, 1);
...@@ -1582,11 +1511,6 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ...@@ -1582,11 +1511,6 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
int x;
int y;
int width;
int height;
if (pRegion != NullRegion && RegionNil(pRegion) == 1) if (pRegion != NullRegion && RegionNil(pRegion) == 1)
{ {
#ifdef TEST #ifdef TEST
...@@ -1615,11 +1539,11 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -1615,11 +1539,11 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion)
if (pRegion == NullRegion) if (pRegion == NullRegion)
{ {
x = 0; int x = 0;
y = 0; int y = 0;
width = pDrawable -> width; int width = pDrawable -> width;
height = pDrawable -> height; int height = pDrawable -> height;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentMarkCorruptedRegion: Fully invalidating %s [%p] with " fprintf(stderr, "nxagentMarkCorruptedRegion: Fully invalidating %s [%p] with "
...@@ -1661,8 +1585,6 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -1661,8 +1585,6 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion)
void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
int oldStatus;
if (pRegion != NullRegion && RegionNil(pRegion) == 1) if (pRegion != NullRegion && RegionNil(pRegion) == 1)
{ {
#ifdef TEST #ifdef TEST
...@@ -1673,7 +1595,7 @@ void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -1673,7 +1595,7 @@ void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion)
return; return;
} }
oldStatus = nxagentDrawableStatus(pDrawable); int oldStatus = nxagentDrawableStatus(pDrawable);
if (oldStatus == Synchronized) if (oldStatus == Synchronized)
{ {
...@@ -1829,20 +1751,11 @@ void nxagentMoveCorruptedRegion(WindowPtr pWin, unsigned int mask) ...@@ -1829,20 +1751,11 @@ void nxagentMoveCorruptedRegion(WindowPtr pWin, unsigned int mask)
BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
{ {
BoxPtr pBox;
BoxRec boxExtents; BoxRec boxExtents;
int nBox; BoxPtr pBox = RegionRects(pRegion);
int i, j;
#ifdef DEBUG
int nBoxOptim;
#endif
pBox = RegionRects(pRegion);
nBox = RegionNumRects(pRegion); int nBox = RegionNumRects(pRegion);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Going to optimize region at [%p] with [%d] rects.\n", fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Going to optimize region at [%p] with [%d] rects.\n",
...@@ -1855,7 +1768,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) ...@@ -1855,7 +1768,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
} }
#ifdef DEBUG #ifdef DEBUG
nBoxOptim = nBox; int nBoxOptim = nBox;
#endif #endif
/* /*
...@@ -1863,7 +1776,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) ...@@ -1863,7 +1776,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
* their overlapping vertex as rule. * their overlapping vertex as rule.
*/ */
for (i = 0; i < nBox; i++) for (int i = 0; i < nBox; i++)
{ {
/* /*
* If the coordinates are (0,0) the box has been already merged, * If the coordinates are (0,0) the box has been already merged,
...@@ -1891,7 +1804,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) ...@@ -1891,7 +1804,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
boxExtents.y2 = pBox[i].y2; boxExtents.y2 = pBox[i].y2;
for (j = i+1; j < nBox; j++) for (int j = i+1; j < nBox; j++)
{ {
if (pBox[j].x1 == 0 && pBox[j].y1 == 0 && if (pBox[j].x1 == 0 && pBox[j].y1 == 0 &&
pBox[j].x2 == 0 && pBox[j].y2 == 0) pBox[j].x2 == 0 && pBox[j].y2 == 0)
...@@ -1994,7 +1907,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) ...@@ -1994,7 +1907,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
* partial- ly overlapping boxes. * partial- ly overlapping boxes.
*/ */
for (i = 0; i < nBox; i++) for (int i = 0; i < nBox; i++)
{ {
if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && if (pBox[i].x1 == 0 && pBox[i].y1 == 0 &&
pBox[i].x2 == 0 && pBox[i].y2 == 0) pBox[i].x2 == 0 && pBox[i].y2 == 0)
...@@ -2012,7 +1925,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) ...@@ -2012,7 +1925,7 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
boxExtents.x2 = pBox[i].x2; boxExtents.x2 = pBox[i].x2;
boxExtents.y2 = pBox[i].y2; boxExtents.y2 = pBox[i].y2;
for (j = i+1; j < nBox; j++) for (int j = i+1; j < nBox; j++)
{ {
if (pBox[j].x1 == 0 && pBox[j].y1 == 0 && if (pBox[j].x1 == 0 && pBox[j].y1 == 0 &&
pBox[j].x2 == 0 && pBox[j].y2 == 0) pBox[j].x2 == 0 && pBox[j].y2 == 0)
...@@ -2063,19 +1976,14 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) ...@@ -2063,19 +1976,14 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion)
unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel) unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel)
{ {
XImage *ximage;
Visual *pVisual;
char *data;
int depth, format, length;
int leftPad = 0; int leftPad = 0;
unsigned long pixel;
depth = pDrawable -> depth; int depth = pDrawable -> depth;
format = (depth == 1) ? XYPixmap : ZPixmap; int format = (depth == 1) ? XYPixmap : ZPixmap;
length = nxagentImageLength(1, 1, format, leftPad, depth); int length = nxagentImageLength(1, 1, format, leftPad, depth);
if ((data = malloc(length)) == NULL) char * data = malloc(length);
if (data == NULL)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentGetColor: WARNING! Failed to allocate memory for the operation.\n"); fprintf(stderr, "nxagentGetColor: WARNING! Failed to allocate memory for the operation.\n");
...@@ -2084,7 +1992,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel) ...@@ -2084,7 +1992,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel)
return -1; return -1;
} }
pVisual = nxagentImageVisual(pDrawable, depth); Visual *pVisual = nxagentImageVisual(pDrawable, depth);
if (pVisual == NULL) if (pVisual == NULL)
{ {
...@@ -2097,7 +2005,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel) ...@@ -2097,7 +2005,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel)
fbGetImage(pDrawable, xPixel, yPixel, 1, 1, format, AllPlanes, data); fbGetImage(pDrawable, xPixel, yPixel, 1, 1, format, AllPlanes, data);
ximage = XCreateImage(nxagentDisplay, pVisual, depth, format, leftPad, (char *) data, XImage *ximage = XCreateImage(nxagentDisplay, pVisual, depth, format, leftPad, (char *) data,
1, 1, BitmapPad(nxagentDisplay), 1, 1, BitmapPad(nxagentDisplay),
nxagentImagePad(1, format, leftPad, 1)); nxagentImagePad(1, format, leftPad, 1));
...@@ -2112,7 +2020,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel) ...@@ -2112,7 +2020,7 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel)
return -1; return -1;
} }
pixel = XGetPixel(ximage, 0, 0); unsigned long pixel = XGetPixel(ximage, 0, 0);
XDestroyImage(ximage); XDestroyImage(ximage);
...@@ -2126,8 +2034,6 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel) ...@@ -2126,8 +2034,6 @@ unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel)
unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion) unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
int xPicker, yPicker;
if (RegionNil(pRegion) == 1) if (RegionNil(pRegion) == 1)
{ {
return nxagentGetDrawableColor(pDrawable); return nxagentGetDrawableColor(pDrawable);
...@@ -2138,14 +2044,14 @@ unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2138,14 +2044,14 @@ unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion)
* bottom right corner of corrupted region extents. * bottom right corner of corrupted region extents.
*/ */
xPicker = pRegion -> extents.x2 + 1; int xPicker = pRegion -> extents.x2 + 1;
if (xPicker > pDrawable -> width) if (xPicker > pDrawable -> width)
{ {
xPicker = pDrawable -> width; xPicker = pDrawable -> width;
} }
yPicker = pRegion -> extents.y2 + 1; int yPicker = pRegion -> extents.y2 + 1;
if (yPicker > pDrawable -> height) if (yPicker > pDrawable -> height)
{ {
...@@ -2157,29 +2063,17 @@ unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2157,29 +2063,17 @@ unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion)
unsigned long nxagentGetDrawableColor(DrawablePtr pDrawable) unsigned long nxagentGetDrawableColor(DrawablePtr pDrawable)
{ {
int xPicker, yPicker;
/* /*
* The pixel used to determine the color of a drawable is at * The pixel used to determine the color of a drawable is at
* coordinates (x + width - 4, y + 4). * coordinates (x + width - 4, y + 4).
*/ */
xPicker = pDrawable -> width - 4; return nxagentGetColor(pDrawable, pDrawable -> width - 4, 4);
yPicker = 4;
return nxagentGetColor(pDrawable, xPicker, yPicker);
} }
void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
WindowPtr pWin;
BoxPtr pBox;
unsigned long color;
unsigned long backupPixel = 0; unsigned long backupPixel = 0;
int nBox, i;
int restore;
#ifdef DEBUG #ifdef DEBUG
static int nBoxCleared; static int nBoxCleared;
...@@ -2203,9 +2097,9 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2203,9 +2097,9 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion)
return; return;
} }
pWin = (WindowPtr) pDrawable; WindowPtr pWin = (WindowPtr) pDrawable;
restore = 0; int restore = 0;
/* /*
* If the window has already a background, we can hope it will be * If the window has already a background, we can hope it will be
...@@ -2227,7 +2121,7 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2227,7 +2121,7 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion)
backupPixel = pWin -> background.pixel; backupPixel = pWin -> background.pixel;
color = nxagentGetDrawableColor((DrawablePtr) pWin); unsigned long color = nxagentGetDrawableColor((DrawablePtr) pWin);
if (color == -1) if (color == -1)
{ {
...@@ -2247,11 +2141,11 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2247,11 +2141,11 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion)
restore = 1; restore = 1;
} }
pBox = nxagentGetOptimizedRegionBoxes(pRegion); BoxPtr pBox = nxagentGetOptimizedRegionBoxes(pRegion);
nBox = RegionNumRects(pRegion); int nBox = RegionNumRects(pRegion);
for (i = 0; i < nBox; i++) for (int i = 0; i < nBox; i++)
{ {
if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && if (pBox[i].x1 == 0 && pBox[i].y1 == 0 &&
pBox[i].x2 == 0 && pBox[i].y2 == 0) pBox[i].x2 == 0 && pBox[i].y2 == 0)
...@@ -2284,21 +2178,14 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2284,21 +2178,14 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion)
void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
GCPtr pGC;
BoxPtr pBox;
XRectangle *pRects;
int nrects;
int i;
if (RegionNil(pRegion) == 1) if (RegionNil(pRegion) == 1)
{ {
return; return;
} }
pGC = nxagentGetGraphicContext(pDrawable); GCPtr pGC = nxagentGetGraphicContext(pDrawable);
nrects = RegionNumRects(pRegion); int nrects = RegionNumRects(pRegion);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentFillRemoteRegion: Going to fill remote region [%d,%d,%d,%d] rects [%d] with color [%lu].\n", fprintf(stderr, "nxagentFillRemoteRegion: Going to fill remote region [%d,%d,%d,%d] rects [%d] with color [%lu].\n",
...@@ -2315,11 +2202,10 @@ void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -2315,11 +2202,10 @@ void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion)
} }
else else
{ {
pBox = RegionRects(pRegion); BoxPtr pBox = RegionRects(pRegion);
XRectangle *pRects = malloc(nrects * sizeof(XRectangle));
pRects = malloc(nrects * sizeof(XRectangle));
for (i = 0; i < nrects; i++) for (int i = 0; i < nrects; i++)
{ {
pRects[i].x = pBox[i].x1; pRects[i].x = pBox[i].x1;
pRects[i].y = pBox[i].y1; pRects[i].y = pBox[i].y1;
...@@ -2373,20 +2259,14 @@ int nxagentDestroyCorruptedBackgroundResource(void * p, XID id) ...@@ -2373,20 +2259,14 @@ int nxagentDestroyCorruptedBackgroundResource(void * p, XID id)
void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
int nPoints, xPoint *pPoints) int nPoints, xPoint *pPoints)
{ {
RegionPtr pRegion; RegionPtr pRegion = RegionCreate(NullBox, 1);
RegionRec tmpRegion;
BoxRec box, extents;
xPoint *xp;
int np;
np = nPoints;
xp = pPoints;
pRegion = RegionCreate(NullBox, 1);
int np = nPoints;
while (np--) while (np--)
{ {
BoxRec box;
xPoint *xp = pPoints;
if (CoordModePrevious) if (CoordModePrevious)
{ {
box.x1 = box.x2 = (xp-1) -> x + xp -> x; box.x1 = box.x2 = (xp-1) -> x + xp -> x;
...@@ -2408,6 +2288,7 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, ...@@ -2408,6 +2288,7 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
* this loop could become less expensive. * this loop could become less expensive.
*/ */
RegionRec tmpRegion;
RegionInit(&tmpRegion, &box, 1); RegionInit(&tmpRegion, &box, 1);
RegionUnion(pRegion, pRegion, &tmpRegion); RegionUnion(pRegion, pRegion, &tmpRegion);
...@@ -2417,7 +2298,7 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, ...@@ -2417,7 +2298,7 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
xp++; xp++;
} }
extents = *RegionExtents(pRegion); BoxRec extents = *RegionExtents(pRegion);
RegionReset(pRegion, &extents); RegionReset(pRegion, &extents);
...@@ -2557,14 +2438,9 @@ void nxagentRegionsOnScreen(void) ...@@ -2557,14 +2438,9 @@ void nxagentRegionsOnScreen(void)
void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
{ {
PixmapPtr pBitmap;
GCPtr pGC = NULL; GCPtr pGC = NULL;
RegionPtr pClipRegion = NullRegion; RegionPtr pClipRegion = NullRegion;
int x, y;
int w, h;
int saveTrap;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for [%s] at [%p].\n", fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for [%s] at [%p].\n",
nxagentDrawableType(pDrawable), (void *) pDrawable); nxagentDrawableType(pDrawable), (void *) pDrawable);
...@@ -2574,7 +2450,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2574,7 +2450,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
* The bitmap is created only in the nxagent. * The bitmap is created only in the nxagent.
*/ */
saveTrap = nxagentGCTrap; int saveTrap = nxagentGCTrap;
nxagentGCTrap = 1; nxagentGCTrap = 1;
...@@ -2631,6 +2507,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2631,6 +2507,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
* window, because the pixmap creation would fail. * window, because the pixmap creation would fail.
*/ */
PixmapPtr pBitmap;
pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth, 0); pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth, 0);
if (pBitmap == NULL) if (pBitmap == NULL)
...@@ -2646,10 +2523,10 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) ...@@ -2646,10 +2523,10 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
ValidateGC((DrawablePtr) pBitmap, pGC); ValidateGC((DrawablePtr) pBitmap, pGC);
x = pClipRegion -> extents.x1; int x = pClipRegion -> extents.x1;
y = pClipRegion -> extents.y1; int y = pClipRegion -> extents.y1;
w = pClipRegion -> extents.x2 - pClipRegion -> extents.x1; int w = pClipRegion -> extents.x2 - pClipRegion -> extents.x1;
h = pClipRegion -> extents.y2 - pClipRegion -> extents.y1; int h = pClipRegion -> extents.y2 - pClipRegion -> extents.y1;
nxagentCopyArea(pDrawable, (DrawablePtr) pBitmap, pGC, x, y, w, h, x, y); nxagentCopyArea(pDrawable, (DrawablePtr) pBitmap, pGC, x, y, w, h, x, y);
...@@ -3086,7 +2963,6 @@ nxagentSendBackgroundExposeEnd: ...@@ -3086,7 +2963,6 @@ nxagentSendBackgroundExposeEnd:
void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2) void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2)
{ {
WindowPtr pWin = (WindowPtr) p0; WindowPtr pWin = (WindowPtr) p0;
WindowPtr pParent;
struct nxagentExposeBackground *pPair = p2; struct nxagentExposeBackground *pPair = p2;
...@@ -3112,7 +2988,7 @@ void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2) ...@@ -3112,7 +2988,7 @@ void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2)
(void *) pWin); (void *) pWin);
#endif #endif
pParent = pWin -> parent; WindowPtr pParent = pWin -> parent;
while (pParent != NULL) while (pParent != NULL)
{ {
...@@ -3140,21 +3016,14 @@ void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2) ...@@ -3140,21 +3016,14 @@ void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2)
int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr) int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr)
{ {
RegionPtr exposeRgn; RegionPtr remoteExposeRgn = (RegionRec *) ptr;
RegionPtr remoteExposeRgn;
#ifdef DEBUG
BoxRec box;
#endif
remoteExposeRgn = (RegionRec *) ptr;
if (nxagentWindowPriv(pWin) -> deferredBackgroundExpose == 1) if (nxagentWindowPriv(pWin) -> deferredBackgroundExpose == 1)
{ {
exposeRgn = RegionCreate(NULL, 1); RegionPtr exposeRgn = RegionCreate(NULL, 1);
#ifdef DEBUG #ifdef DEBUG
box = *RegionExtents(remoteExposeRgn); BoxRec box = *RegionExtents(remoteExposeRgn);
fprintf(stderr, "nxagentClipAndSendClearExpose: Background expose extents: [%d,%d,%d,%d].\n", fprintf(stderr, "nxagentClipAndSendClearExpose: Background expose extents: [%d,%d,%d,%d].\n",
box.x1, box.y1, box.x2, box.y2); box.x1, box.y1, box.x2, box.y2);
...@@ -3230,4 +3099,3 @@ void nxagentSendDeferredBackgroundExposures(void) ...@@ -3230,4 +3099,3 @@ void nxagentSendDeferredBackgroundExposures(void)
RegionEmpty(nxagentDeferredBackgroundExposures); RegionEmpty(nxagentDeferredBackgroundExposures);
} }
} }
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