Commit 0815fb06 authored by Mihai Moldovan's avatar Mihai Moldovan

nx-X11/programs/Xserver/hw/nxagent/Render.c: use macros obtaining values from…

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.
parent 81569ad6
...@@ -226,7 +226,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -226,7 +226,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", 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 #endif
while (nglyphs > 0) while (nglyphs > 0)
...@@ -235,7 +235,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -235,7 +235,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
{ {
widthInBits = gi -> width * 32; widthInBits = gi -> width * 32;
bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad); bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy));
bytesToClean = bytesPerLine * height; bytesToClean = bytesPerLine * height;
...@@ -245,7 +245,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -245,7 +245,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
widthInBits, bytesPerLine, height); widthInBits, bytesPerLine, height);
#endif #endif
if (dpy -> byte_order == LSBFirst) if (ImageByteOrder(dpy) == LSBFirst)
{ {
for (i = 3; i < bytesToClean; i += 4) for (i = 3; i < bytesToClean; i += 4)
{ {
...@@ -279,7 +279,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -279,7 +279,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
{ {
widthInBits = gi -> width; widthInBits = gi -> width;
bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad); bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy));
bitsToClean = (bytesPerLine << 3) - (gi -> width); bitsToClean = (bytesPerLine << 3) - (gi -> width);
...@@ -295,19 +295,19 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -295,19 +295,19 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: bitsToClean &=7 is %d, bytesToCLean is %d." fprintf(stderr, "nxagentCleanGlyphs: bitsToClean &=7 is %d, bytesToCLean is %d."
" byte_order is %d, bitmap_bit_order is %d.\n", bitsToClean, bytesToClean, " byte_order is %d, bitmap_bit_order is %d.\n", bitsToClean, bytesToClean,
dpy -> byte_order, dpy -> bitmap_bit_order); ImageByteOrder(dpy), BitmapBitOrder(dpy));
#endif #endif
for (i = 1; i <= height; i++) 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++) for (j = 1; j <= bytesToClean; j++)
{ {
images[i * bytesPerLine - j] = 0x00; images[i * bytesPerLine - j] = 0x00;
#ifdef DEBUG #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); , (i * bytesPerLine - j), i, j);
#endif #endif
...@@ -321,13 +321,13 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -321,13 +321,13 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n" 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 #endif
} }
} }
if (dpy -> bitmap_bit_order == MSBFirst) if (BitmapBitOrder(dpy) == MSBFirst)
{ {
images[i * bytesPerLine - j] &= 0xff << bitsToClean; images[i * bytesPerLine - j] &= 0xff << bitsToClean;
...@@ -366,7 +366,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ...@@ -366,7 +366,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
{ {
widthInBits = gi -> width * depth; widthInBits = gi -> width * depth;
bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad); bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy));
widthInBytes = (widthInBits >> 3); widthInBytes = (widthInBits >> 3);
......
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