It's more subtle than this; the endianness changes according to whether it's
doing an XPutImage or an rectangle fill.  This is, of course, all fixed in
version 4.....

Cheers

Tristan

----- Original Message ----- 
From: "Mark Rainford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 22, 2003 11:25 AM
Subject: patch: fix truly horrible colours in old viewer


> Symptom:
>
> vncviewer shows all the wrong colours
>
> Applicability:
>
> 3.3.3r2 -> 3.3.7 unix vncviewer
> Dunno 'bout later versions, sorry.
>
> Circumstances:
>
> unix vncviewer on a TrueColour X11 DISPLAY + viewer exec
> platform and DISPLAY have different endian-ness.
>
> Description:
>
> The vnc server sends pixels formatted for DISPLAY (as reported by
> the viewer), but Xlib already accounts for endian flipping between
> viewer and DISPLAY: as a result the pixels can be flipped twice,
> messing up all the colours. This patch fixes it by
> reporting the endian-ness of vncviewer's exec platform.
>
>
> Patch:
>
> cd vnc-3.3.*/vnc_unixsrc/vncviewer
> patch -lp3  <<Ooof
>
> diff -urw vnc-3.3.3r2/vnc_unixsrc/vncviewer/colour.c
vnc-3.3.3r2-16.12.03/vnc_unixsrc/vncviewer/colour.c
> --- vnc-3.3.3r2/vnc_unixsrc/vncviewer/colour.c  2003-12-16
17:14:35.657109572 +0000
> +++ vnc-3.3.3r2-16.12.03/vnc_unixsrc/vncviewer/colour.c 2003-12-16
17:18:10.837739192 +0000
> @@ -102,7 +102,7 @@
>  myFormat.bitsPerPixel = visbpp;
>  myFormat.depth = visdepth;
>  myFormat.trueColour = 1;
> -    myFormat.bigEndian = (ImageByteOrder(dpy) == MSBFirst);
> +    myFormat.bigEndian = !(*(char *)&endianTest);      /* 16.12.03(mr)
X11 converts viewer=>DISPLAY */
>  myFormat.redShift = ffs(vis->red_mask) - 1;
>  myFormat.greenShift = ffs(vis->green_mask) - 1;
>  myFormat.blueShift = ffs(vis->blue_mask) - 1;
> @@ -168,7 +168,7 @@
>  myFormat.bitsPerPixel = visbpp;
>  myFormat.depth = visdepth;
>  myFormat.trueColour = 0;
> -    myFormat.bigEndian = (ImageByteOrder(dpy) == MSBFirst);
> +    myFormat.bigEndian = !(*(char *)&endianTest);      /* 16.12.03(mr)
X11 converts viewer=>DISPLAY */
>  myFormat.redMax = myFormat.greenMax = myFormat.blueMax = 0;
>  myFormat.redShift = myFormat.greenShift = myFormat.blueShift = 0;
>
> @@ -224,7 +224,7 @@
>  myFormat.bitsPerPixel = visbpp;
>  myFormat.depth = visdepth;
>  myFormat.trueColour = 1;
> -    myFormat.bigEndian = (ImageByteOrder(dpy) == MSBFirst);
> +    myFormat.bigEndian = !(*(char *)&endianTest);      /* 16.12.03(mr)
X11 converts viewer=>DISPLAY */
>  myFormat.redShift = ffs(vis->red_mask) - 1;
>  myFormat.greenShift = ffs(vis->green_mask) - 1;
>  myFormat.blueShift = ffs(vis->blue_mask) - 1;
>
> Ooof
>
> -- 
>
> Regards,  Mark.
> _______________________________________________
> VNC-List mailing list
> [EMAIL PROTECTED]
> To remove yourself from the list visit:
> http://www.realvnc.com/mailman/listinfo/vnc-list
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to