diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-03-17 14:35:51 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-07 14:42:08 +0200 |
commit | 7b5c069d2e7eaa1748507a03697c14900258e507 (patch) | |
tree | 245936793e9607ce98dd89e98c1fdd0ac6b2d3ce /common/rfb/TightEncoder.cxx | |
parent | 65ad3224e920deecb91a3c28e15341c8584a372c (diff) | |
download | tigervnc-7b5c069d2e7eaa1748507a03697c14900258e507.tar.gz tigervnc-7b5c069d2e7eaa1748507a03697c14900258e507.zip |
Push encoding specific formats into the encoders and decoders
Keep the generic stream classes clean and general.
Diffstat (limited to 'common/rfb/TightEncoder.cxx')
-rw-r--r-- | common/rfb/TightEncoder.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx index 622dc3d4..b94b53e3 100644 --- a/common/rfb/TightEncoder.cxx +++ b/common/rfb/TightEncoder.cxx @@ -410,3 +410,21 @@ void TightEncoder::writeSubrect(const Rect& r, bool forceSolid) os->writeBytes(mos.data(), mos.length()); writer->endRect(); } + +void TightEncoder::writeCompact(rdr::OutStream* os, rdr::U32 value) +{ + rdr::U8 b; + b = value & 0x7F; + if (value <= 0x7F) { + os->writeU8(b); + } else { + os->writeU8(b | 0x80); + b = value >> 7 & 0x7F; + if (value <= 0x3FFF) { + os->writeU8(b); + } else { + os->writeU8(b | 0x80); + os->writeU8(value >> 14 & 0xFF); + } + } +} |