diff options
author | Pierre Ossman <ossman@cendio.se> | 2009-04-20 09:44:17 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2009-04-20 09:44:17 +0000 |
commit | 07893cbb127acfdb4879fbc596aea9c89df3f753 (patch) | |
tree | 8baf91be1d858af4ea8f699accec5e087780e2ea | |
parent | 5e6c57fea23b3cfd3bda77e6c66fed087ea08546 (diff) | |
download | tigervnc-07893cbb127acfdb4879fbc596aea9c89df3f753.tar.gz tigervnc-07893cbb127acfdb4879fbc596aea9c89df3f753.zip |
Fix generation of native pixel format so the that internal state is correct.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3783 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | unix/tx/TXImage.cxx | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/unix/tx/TXImage.cxx b/unix/tx/TXImage.cxx index 95cd2b70..0a50791a 100644 --- a/unix/tx/TXImage.cxx +++ b/unix/tx/TXImage.cxx @@ -304,28 +304,34 @@ static int depth2bpp(Display* dpy, int depth) void TXImage::getNativePixelFormat(Visual* vis, int depth) { + int bpp; + int trueColour, bigEndian; + int redShift, greenShift, blueShift; + int redMax, greenMax, blueMax; + cube = 0; - nativePF.depth = depth; - nativePF.bpp = depth2bpp(dpy, depth); - nativePF.bigEndian = (ImageByteOrder(dpy) == MSBFirst); - nativePF.trueColour = (vis->c_class == TrueColor); + + bpp = depth2bpp(dpy, depth); + bigEndian = (ImageByteOrder(dpy) == MSBFirst); + trueColour = (vis->c_class == TrueColor); vlog.info("Using default colormap and visual, %sdepth %d.", (vis->c_class == TrueColor) ? "TrueColor, " : ((vis->c_class == PseudoColor) ? "PseudoColor, " : ""), depth); - if (nativePF.trueColour) { + redShift = ffs(vis->red_mask) - 1; + greenShift = ffs(vis->green_mask) - 1; + blueShift = ffs(vis->blue_mask) - 1; + redMax = vis->red_mask >> redShift; + greenMax = vis->green_mask >> greenShift; + blueMax = vis->blue_mask >> blueShift; - nativePF.redShift = ffs(vis->red_mask) - 1; - nativePF.greenShift = ffs(vis->green_mask) - 1; - nativePF.blueShift = ffs(vis->blue_mask) - 1; - nativePF.redMax = vis->red_mask >> nativePF.redShift; - nativePF.greenMax = vis->green_mask >> nativePF.greenShift; - nativePF.blueMax = vis->blue_mask >> nativePF.blueShift; - - } else { + nativePF = PixelFormat(bpp, depth, bigEndian, trueColour, + redMax, greenMax, blueMax, + redShift, greenShift, blueShift); + if (!trueColour) { XColor xc[256]; cube = new rfb::ColourCube(6,6,6); int r; |