diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-03-13 15:08:36 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-07 13:27:08 +0200 |
commit | 4bca9119848fbafd15dd9dae715ad65162addec5 (patch) | |
tree | bb4fad42f0cd540e0671c2c6f957458adf3ea7a9 /common/rfb/ZRLEEncoder.cxx | |
parent | b8349b73af604448a05d7c0587d862d3e7bd9c8a (diff) | |
download | tigervnc-4bca9119848fbafd15dd9dae715ad65162addec5.tar.gz tigervnc-4bca9119848fbafd15dd9dae715ad65162addec5.zip |
Get rid of unused things in the ZRLE encoder
Get rid of unused shared MemOutStream and variable max length
functionality in the ZRLE encoder.
Diffstat (limited to 'common/rfb/ZRLEEncoder.cxx')
-rw-r--r-- | common/rfb/ZRLEEncoder.cxx | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index 896b83b5..5ef54d26 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -26,9 +26,6 @@ using namespace rfb; -rdr::MemOutStream* ZRLEEncoder::sharedMos = 0; -int ZRLEEncoder::maxLen = 4097 * 1024; // enough for width 16384 32-bit pixels - IntParameter zlibLevel("ZlibLevel","Zlib compression level",-1); #define EXTRA_ARGS ImageGetter* ig @@ -55,33 +52,27 @@ Encoder* ZRLEEncoder::create(SMsgWriter* writer) } ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer_) - : writer(writer_), zos(0,0,zlibLevel) + : writer(writer_), zos(0,0,zlibLevel), mos(129*1024) { - if (sharedMos) - mos = sharedMos; - else - mos = new rdr::MemOutStream(129*1024); } ZRLEEncoder::~ZRLEEncoder() { - if (!sharedMos) - delete mos; } bool ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual) { rdr::U8* imageBuf = writer->getImageBuf(64 * 64 * 4 + 4); - mos->clear(); + mos.clear(); bool wroteAll = true; *actual = r; switch (writer->bpp()) { case 8: - wroteAll = zrleEncode8(r, mos, &zos, imageBuf, maxLen, actual, ig); + wroteAll = zrleEncode8(r, &mos, &zos, imageBuf, actual, ig); break; case 16: - wroteAll = zrleEncode16(r, mos, &zos, imageBuf, maxLen, actual, ig); + wroteAll = zrleEncode16(r, &mos, &zos, imageBuf, actual, ig); break; case 32: { @@ -94,16 +85,16 @@ bool ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual) if ((fitsInLS3Bytes && pf.isLittleEndian()) || (fitsInMS3Bytes && pf.isBigEndian())) { - wroteAll = zrleEncode24A(r, mos, &zos, imageBuf, maxLen, actual, ig); + wroteAll = zrleEncode24A(r, &mos, &zos, imageBuf, actual, ig); } else if ((fitsInLS3Bytes && pf.isBigEndian()) || (fitsInMS3Bytes && pf.isLittleEndian())) { - wroteAll = zrleEncode24B(r, mos, &zos, imageBuf, maxLen, actual, ig); + wroteAll = zrleEncode24B(r, &mos, &zos, imageBuf, actual, ig); } else { - wroteAll = zrleEncode32(r, mos, &zos, imageBuf, maxLen, actual, ig); + wroteAll = zrleEncode32(r, &mos, &zos, imageBuf, actual, ig); } break; } @@ -111,8 +102,8 @@ bool ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual) writer->startRect(*actual, encodingZRLE); rdr::OutStream* os = writer->getOutStream(); - os->writeU32(mos->length()); - os->writeBytes(mos->data(), mos->length()); + os->writeU32(mos.length()); + os->writeBytes(mos.data(), mos.length()); writer->endRect(); return wroteAll; } |