aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:56 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:56 +0200
commit22914447019845ba3ba238e5814b59939e744f19 (patch)
tree3fc9f4d98f3e04e61820f65cfd5b4091a5befd8e /nx-X11/programs/Xserver/hw/nxagent/GCOps.c
parentfc05e5e04843762820effb5b5bb145536ddd41f0 (diff)
downloadnx-libs-22914447019845ba3ba238e5814b59939e744f19.tar.gz
nx-libs-22914447019845ba3ba238e5814b59939e744f19.tar.bz2
nx-libs-22914447019845ba3ba238e5814b59939e744f19.zip
Imported nxagent-3.3.0-18.tar.gznxagent/3.3.0-18
Summary: Imported nxagent-3.3.0-18.tar.gz Keywords: Imported nxagent-3.3.0-18.tar.gz into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/GCOps.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/GCOps.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
index 83aa04f11..9afd6e392 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c
@@ -594,6 +594,8 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
unsigned int format;
unsigned long planeMask = 0xffffffff;
+ int oldDstxyValue;
+
RegionPtr pDstRegion;
int skip = 0;
@@ -605,6 +607,91 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
(void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height);
#endif
+ /*
+ * Here, before using fbDoCopy() called by fbCopyArea(),
+ * it should be provided that the cast in fbDoCopy() from
+ * int to short int would not cut off significative bits.
+ */
+
+ if (dstx + pDstDrawable->x + width > 32767)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentCopyArea: x2 exceeding short int.\n");
+ #endif
+
+ width = 32767 - dstx - pDstDrawable->x;
+
+ if (width <= 0)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCopyArea: Returning null on x2 check.\n");
+ #endif
+
+ return NullRegion;
+ }
+ }
+
+ if (dstx + pDstDrawable->x < -32768)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentCopyArea: x1 exceeding short int.\n");
+ #endif
+
+ width += pDstDrawable->x + dstx + 32768;
+ srcx -= pDstDrawable->x + dstx + 32768;
+ dstx = -32768 - pDstDrawable->x;
+
+ if (width <= 0)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCopyArea: Returning null on x1 check.\n");
+ #endif
+
+ return NullRegion;
+ }
+ }
+
+ oldDstxyValue = dsty;
+
+ if (dsty + pDstDrawable->y + height > 32767)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentCopyArea: y2 exceeding short int.\n");
+ #endif
+
+ height = 32767 - dsty - pDstDrawable->y;
+
+ if (height <= 0)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCopyArea: Returning null on y2 check.\n");
+ #endif
+
+ return NullRegion;
+ }
+ }
+
+ if (dsty + pDstDrawable->y < -32768)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentCopyArea: y1 exceeding short int.\n");
+ #endif
+
+ height += 32768 + pDstDrawable->y + dsty;
+ srcy -= 32768 + pDstDrawable->y + dsty;
+ dsty = -32768 - pDstDrawable->y;
+
+ if (height <= 0)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCopyArea: Returning null on y1 check.\n");
+ #endif
+
+ return NullRegion;
+ }
+ }
+
+
if (nxagentGCTrap == 1 || nxagentShmTrap == 1)
{
if (pSrcDrawable -> type == DRAWABLE_PIXMAP &&