aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Drawable.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Drawable.c94
1 files changed, 38 insertions, 56 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
index 82723b5a0..2c1b07fa5 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
@@ -32,7 +32,6 @@
#include "Handlers.h"
#include "Pixels.h"
#include "Reconnect.h"
-#include "GCOps.h"
#include "NXlib.h"
@@ -419,14 +418,13 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (useStoredBitmap != 0)
{
#ifdef TEST
- fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] has a synchronization bitmap at [%p] "
+ fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] has a synchronization bitmap "
"[%d,%d,%d,%d] with [%ld] rects.\n", nxagentDrawableType(pDrawable),
- (void *) pDrawable, (void *) nxagentDrawableBitmap(pDrawable),
- nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1,
- nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1,
- nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2,
- nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2,
- REGION_NUM_RECTS(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable))));
+ (void *) pDrawable, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1,
+ nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1,
+ nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2,
+ nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2,
+ REGION_NUM_RECTS(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable))));
#endif
clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height);
@@ -583,7 +581,8 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
#ifdef TEST
fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize [%ld] rects of [%s] at [%p].\n",
- REGION_NUM_RECTS(clipRegion), nxagentDrawableType(pDrawable), (void *) pDrawable);
+ REGION_NUM_RECTS(clipRegion), (pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window"),
+ (void *) pDrawable);
fprintf(stderr, "nxagentSynchronizeRegion: Extents geometry [%d,%d,%d,%d].\n",
clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2);
@@ -616,22 +615,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (data == NULL)
{
#ifdef WARNING
-
fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Failed to allocate memory for synchronization.\n");
-
- /*
- * Print detailed informations if the
- * image length is zero.
- */
-
- if (length == 0)
- {
- fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] with region geometry [%ld][%d,%d,%d,%d].\n",
- nxagentDrawableType(pDrawable), (void *) pDrawable, REGION_NUM_RECTS(clipRegion),
- clipRegion -> extents.x1, clipRegion -> extents.y1,
- clipRegion -> extents.x2, clipRegion -> extents.y2);
- }
-
#endif
goto nxagentSynchronizeRegionFree;
@@ -686,14 +670,10 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
if (nxagentDrawableStatus(pDrawable) == Synchronized)
{
#ifdef WARNING
-
if (pDrawable -> type == DRAWABLE_WINDOW && pSrcDrawable != pDrawable)
- {
fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Trying to synchronize "
"the clean drawable type [%d] at [%p] with source at [%p].\n",
pDrawable -> type, (void *) pDrawable, (void *) pSrcDrawable);
- }
-
#endif
goto nxagentSynchronizeRegionStop;
@@ -768,6 +748,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentGetImage(pSrcDrawable, x, y, w, h, format, AllPlanes, data);
+ nxagentRealizeImage(pDrawable, pGC, pDrawable -> depth,
+ x, y, w, h, leftPad, format, data);
+
/*
* Going to unmark the synchronized
* region.
@@ -822,13 +805,6 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentUnmarkCorruptedRegion(pDrawable, &tileRegion);
}
- #ifdef TEST
- else
- {
- fprintf(stderr, "nxagentSynchronizeRegion: Tile [%d,%d,%d,%d] on drawable [%p] doesn't match.\n",
- x, y, x + w, y + h, (void *) pDrawable);
- }
- #endif
}
else
{
@@ -859,14 +835,6 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
}
}
- /*
- * Realize the image after comparing the
- * source data with the bitmap data.
- */
-
- nxagentRealizeImage(pDrawable, pGC, pDrawable -> depth,
- x, y, w, h, leftPad, format, data);
-
REGION_UNINIT(pDrawable -> pScreen, &tileRegion);
#if !defined(COLLECTED_UPDATES)
@@ -2587,13 +2555,16 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
GCPtr pGC = NULL;
RegionPtr pClipRegion = NullRegion;
+ char *data = NULL;
+
int x, y;
int w, h;
+ int length, format;
int saveTrap;
#ifdef TEST
- fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for [%s] at [%p].\n",
- nxagentDrawableType(pDrawable), (void *) pDrawable);
+ fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for drawable at [%p].\n",
+ (void *) pDrawable);
#endif
/*
@@ -2681,8 +2652,24 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
w = pClipRegion -> extents.x2 - pClipRegion -> extents.x1;
h = pClipRegion -> extents.y2 - pClipRegion -> extents.y1;
- nxagentCopyArea(pDrawable, (DrawablePtr) pBitmap, pGC, x, y, w, h, x, y);
+ data = nxagentAllocateImageData(w, h, pDrawable -> depth, &length, &format);
+
+ if (data == NULL)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentCreateDrawableBitmap: Cannot allocate memory for the bitmap data.\n");
+ #endif
+
+ nxagentDestroyPixmap(pBitmap);
+ goto nxagentCreateDrawableBitmapEnd;
+ }
+
+ nxagentGetImage(pDrawable, x, y, w, h, format, AllPlanes, data);
+
+ nxagentPutImage((DrawablePtr) pBitmap, pGC, pBitmap -> drawable.depth, x, y, w, h,
+ 0, format, data);
+
REGION_UNION(pDrawable -> pScreen, nxagentCorruptedRegion((DrawablePtr) pBitmap),
nxagentCorruptedRegion((DrawablePtr) pBitmap), pClipRegion);
@@ -2724,6 +2711,11 @@ nxagentCreateDrawableBitmapEnd:
nxagentFreeRegion(pDrawable, pClipRegion);
}
+ if (data != NULL)
+ {
+ xfree(data);
+ }
+
if (pGC != NULL)
{
FreeScratchGC(pGC);
@@ -3099,16 +3091,6 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt
REGION_INTERSECT(pWin -> pScreen, &expose, &expose, &pWin -> clipList);
- /*
- * Reduce the overall region to expose.
- */
-
- REGION_TRANSLATE(pWin -> pScreen, &expose, -pWin -> drawable.x, -pWin -> drawable.y);
-
- REGION_SUBTRACT(pWin -> pScreen, pExpose, pExpose, &expose);
-
- REGION_TRANSLATE(pWin -> pScreen, &expose, pWin -> drawable.x, pWin -> drawable.y);
-
miWindowExposures(pWin, &expose, &expose);
nxagentSendBackgroundExposeEnd: