diff options
author | Peter Åstrand <astrand@cendio.se> | 2004-12-13 08:00:47 +0000 |
---|---|---|
committer | Peter Åstrand <astrand@cendio.se> | 2004-12-13 08:00:47 +0000 |
commit | bf27e3accae0562a79467a7aecfff929aee0b15a (patch) | |
tree | a86b4f18cee1ad745b4d583210c9506956d8ead5 /rfb | |
parent | fd21d651ed97e25c739c204d7a8dc611c723ba2d (diff) | |
download | tigervnc-bf27e3accae0562a79467a7aecfff929aee0b15a.tar.gz tigervnc-bf27e3accae0562a79467a7aecfff929aee0b15a.zip |
24 bpp "cutZeros" support for copy filter.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@41 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb')
-rw-r--r-- | rfb/tightDecode.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/rfb/tightDecode.h b/rfb/tightDecode.h index bc13a0d8..ac8b0a04 100644 --- a/rfb/tightDecode.h +++ b/rfb/tightDecode.h @@ -59,6 +59,7 @@ void TIGHT_DECODE (const Rect& r, rdr::InStream* is, #endif ) { + rdr::U8 *bytebuf = (rdr::U8*) buf; bool cutZeros = false; const rfb::PixelFormat& myFormat = handler->cp.pf(); #if BPP == 32 @@ -82,9 +83,8 @@ void TIGHT_DECODE (const Rect& r, rdr::InStream* is, if (comp_ctl == rfbTightFill) { PIXEL_T pix; if (cutZeros) { - rdr::U8 *fillColorBuf = (rdr::U8*)buf; - is->readBytes(fillColorBuf, 3); - pix = RGB24_TO_PIXEL32(fillColorBuf[0], fillColorBuf[1], fillColorBuf[2]); + is->readBytes(bytebuf, 3); + pix = RGB24_TO_PIXEL32(bytebuf[0], bytebuf[1], bytebuf[2]); } else { pix = is->READ_PIXEL(); } @@ -142,6 +142,8 @@ void TIGHT_DECODE (const Rect& r, rdr::InStream* is, int bppp = BPP; if (palSize != 0) { bppp = (palSize <= 2) ? 1 : 8; + } else if (cutZeros) { + bppp = 24; } // Determine if the data should be decompressed or just copied. @@ -160,9 +162,16 @@ void TIGHT_DECODE (const Rect& r, rdr::InStream* is, if (palSize == 0) { // Truecolor data if (useGradient) { - FilterGradient(r, input, dataSize, buf, handler); + FilterGradient(r, input, dataSize, buf, handler); } else { - input->readBytes(buf, dataSize); + input->readBytes(buf, dataSize); + if (cutZeros) { + for (int p = r.height() * r.width() - 1; p >= 0; p--) { + buf[p] = RGB24_TO_PIXEL32(bytebuf[p*3], + bytebuf[p*3+1], + bytebuf[p*3+2]); + } + } } } else { int x, y, b, w; |