From 0815fb06f1135f6f276d2d534a569e6b10b52241 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Wed, 13 Sep 2017 11:50:40 +0200 Subject: nx-X11/programs/Xserver/hw/nxagent/Render.c: use macros obtaining values from _XPrivDisplay instead of the other Display structure directly. Fixes: ArcticaProject/nx-libs#512 It's unclear to me why (Display*)(dpy)->bitmap_pad and (_XPrivDisplay)(dpy)->bitmap_pad produce different results. Technically, Display is referencing the _XDisplay/Display structure defined in Xlibint.h, while _XPrivDisplay is a typedef'd pointer to the (anonymous) structure defined in Xlib.h, since we're not defining the XLIB_ILLEGAL_ACCESS macro. The weird part is that both should be equal when it comes to its bitmap_pad, byte_order and bitmap_bit_order members. --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index cf1d0ed07..e71004acd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -226,7 +226,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", - depth, gi -> width, dpy -> bitmap_pad); + depth, gi -> width, BitmapPad(dpy)); #endif while (nglyphs > 0) @@ -235,7 +235,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, { widthInBits = gi -> width * 32; - bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad); + bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy)); bytesToClean = bytesPerLine * height; @@ -245,7 +245,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, widthInBits, bytesPerLine, height); #endif - if (dpy -> byte_order == LSBFirst) + if (ImageByteOrder(dpy) == LSBFirst) { for (i = 3; i < bytesToClean; i += 4) { @@ -279,7 +279,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, { widthInBits = gi -> width; - bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad); + bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy)); bitsToClean = (bytesPerLine << 3) - (gi -> width); @@ -295,19 +295,19 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: bitsToClean &=7 is %d, bytesToCLean is %d." " byte_order is %d, bitmap_bit_order is %d.\n", bitsToClean, bytesToClean, - dpy -> byte_order, dpy -> bitmap_bit_order); + ImageByteOrder(dpy), BitmapBitOrder(dpy)); #endif for (i = 1; i <= height; i++) { - if (dpy -> byte_order == dpy -> bitmap_bit_order) + if (ImageByteOrder(dpy) == BitmapBitOrder(dpy)) { for (j = 1; j <= bytesToClean; j++) { images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: byte_order = bitmap_bit_orde, cleaning %d, i=%d, j=%d.\n" + fprintf(stderr, "nxagentCleanGlyphs: byte_order == bitmap_bit_order, cleaning %d, i=%d, j=%d.\n" , (i * bytesPerLine - j), i, j); #endif @@ -321,13 +321,13 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n" - , dpy -> byte_order, dpy -> bitmap_bit_order, (i * bytesPerLine - j), i, j); + , ImageByteOrder(dpy), BitmapBitOrder(dpy), (i * bytesPerLine - j), i, j); #endif } } - if (dpy -> bitmap_bit_order == MSBFirst) + if (BitmapBitOrder(dpy) == MSBFirst) { images[i * bytesPerLine - j] &= 0xff << bitsToClean; @@ -366,7 +366,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, { widthInBits = gi -> width * depth; - bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad); + bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy)); widthInBytes = (widthInBits >> 3); -- cgit v1.2.3