aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-06-11 23:46:20 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-11-15 12:14:57 +0100
commit0535c49cac55d931c9d5b4178db050e6f6e543cf (patch)
treee789b23b122ac001163c718512f024e5dec7b52e /nx-X11
parentdb74c07e6b0dfceb789f4a0c5b7116f9078104ad (diff)
downloadnx-libs-0535c49cac55d931c9d5b4178db050e6f6e543cf.tar.gz
nx-libs-0535c49cac55d931c9d5b4178db050e6f6e543cf.tar.bz2
nx-libs-0535c49cac55d931c9d5b4178db050e6f6e543cf.zip
Pixmap.c: call miModifyPixmapHeader twice instead of duplicating code
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pixmap.c94
1 files changed, 11 insertions, 83 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
index f8241d4d7..371678d0e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
@@ -555,89 +555,18 @@ Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int dep
bitsPerPixel, devKind, (void *) pPixData);
#endif
- if ((width > 0) && (height > 0) && (depth > 0) &&
- (bitsPerPixel > 0) && (devKind > 0) && pPixData)
- {
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = devKind;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = pPixData;
-
- pVirtualPixmap->drawable.depth = depth;
- pVirtualPixmap->drawable.bitsPerPixel = bitsPerPixel;
- pVirtualPixmap->drawable.id = 0;
- pVirtualPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pVirtualPixmap->drawable.x = 0;
- pVirtualPixmap->drawable.y = 0;
- pVirtualPixmap->drawable.width = width;
- pVirtualPixmap->drawable.height = height;
- pVirtualPixmap->devKind = devKind;
- pVirtualPixmap->refcnt = 1;
- pVirtualPixmap->devPrivate.ptr = pPixData;
- }
- else
- {
- if (width > 0)
- pPixmap->drawable.width = width;
-
- if (height > 0)
- pPixmap->drawable.height = height;
-
- if (depth > 0)
- pPixmap->drawable.depth = depth;
-
- if (bitsPerPixel > 0)
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- else if ((bitsPerPixel < 0) && (depth > 0))
- pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
-
- if (devKind > 0)
- pPixmap->devKind = devKind;
- else if ((devKind < 0) && ((width > 0) || (depth > 0)))
- pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width,
- pPixmap->drawable.depth);
-
- if (pPixData)
- pPixmap->devPrivate.ptr = pPixData;
-
- /*
- * XXX This was the previous assignment:
- *
- * pVirtualPixmap->devPrivate.ptr = pPixData;
- */
-
- if (width > 0)
- pVirtualPixmap->drawable.width = width;
-
- if (height > 0)
- pVirtualPixmap->drawable.height = height;
-
- if (depth > 0)
- pVirtualPixmap->drawable.depth = depth;
-
- if (bitsPerPixel > 0)
- pVirtualPixmap->drawable.bitsPerPixel = bitsPerPixel;
- else if ((bitsPerPixel < 0) && (depth > 0))
- pVirtualPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
-
- if (devKind > 0)
- pVirtualPixmap->devKind = devKind;
- else if ((devKind < 0) && ((width > 0) || (depth > 0)))
- pVirtualPixmap->devKind = PixmapBytePad(pVirtualPixmap->drawable.width,
- pVirtualPixmap->drawable.depth);
+ /*
+ * ignore return code, because the only case where this will return
+ * FALSE is pPixmap == NULL, which we have already caught above.
+ */
+ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData);
+ miModifyPixmapHeader(pVirtualPixmap, width, height, depth, bitsPerPixel, devKind, pPixData);
- if (pPixData)
- pVirtualPixmap->devPrivate.ptr = pPixData;
-
- #ifdef PANIC
+ #ifdef PANIC
+ if (!((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
+ (devKind > 0) && pPixData))
+ {
if (pPixmap->drawable.x != 0 || pPixmap->drawable.y != 0)
{
fprintf(stderr, "nxagentModifyPixmapHeader: PANIC! Pixmap at [%p] has x [%d] and y [%d].\n",
@@ -645,9 +574,8 @@ Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int dep
FatalError("nxagentModifyPixmapHeader: PANIC! Pixmap has x or y greater than zero.");
}
-
- #endif
}
+ #endif
return True;
}