diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-03-14 15:59:46 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-14 16:03:42 +0200 |
commit | c0397269fcab67e9acd4fdcbc29f24d79ed0ef39 (patch) | |
tree | 41ac251e5a595a37b832a61626723a89258bb018 /common/rfb/SMsgWriter.cxx | |
parent | a088f1ab3923482998174b9db8949cf06d0761af (diff) | |
download | tigervnc-c0397269fcab67e9acd4fdcbc29f24d79ed0ef39.tar.gz tigervnc-c0397269fcab67e9acd4fdcbc29f24d79ed0ef39.zip |
Move image encoding logic into a central EncodeManager class
This allows us to apply a lot more server logic
independently of which encoder is in use.
Most of this class are things moved over from the
Tight encoder.
Diffstat (limited to 'common/rfb/SMsgWriter.cxx')
-rw-r--r-- | common/rfb/SMsgWriter.cxx | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx index 46c41388..3698cb6c 100644 --- a/common/rfb/SMsgWriter.cxx +++ b/common/rfb/SMsgWriter.cxx @@ -34,12 +34,11 @@ using namespace rfb; static LogWriter vlog("SMsgWriter"); SMsgWriter::SMsgWriter(ConnParams* cp_, rdr::OutStream* os_) - : imageBufIdealSize(0), cp(cp_), os(os_), currentEncoding(0), + : cp(cp_), os(os_), currentEncoding(0), nRectsInUpdate(0), nRectsInHeader(0), needSetDesktopSize(false), needExtendedDesktopSize(false), needSetDesktopName(false), needSetCursor(false), needSetXCursor(false), - lenBeforeRect(0), updatesSent(0), rawBytesEquivalent(0), - imageBuf(0), imageBufSize(0) + lenBeforeRect(0), updatesSent(0), rawBytesEquivalent(0) { for (int i = 0; i <= encodingMax; i++) { bytesSent[i] = 0; @@ -60,7 +59,6 @@ SMsgWriter::~SMsgWriter() } vlog.info(" raw bytes equivalent %llu, compression ratio %f", rawBytesEquivalent, (double)rawBytesEquivalent / bytes); - delete [] imageBuf; } void SMsgWriter::writeServerInit() @@ -316,26 +314,6 @@ void SMsgWriter::endRect() } } -rdr::U8* SMsgWriter::getImageBuf(int required, int requested, int* nPixels) -{ - int requiredBytes = required * (cp->pf().bpp / 8); - int requestedBytes = requested * (cp->pf().bpp / 8); - int size = requestedBytes; - if (size > imageBufIdealSize) size = imageBufIdealSize; - - if (size < requiredBytes) - size = requiredBytes; - - if (imageBufSize < size) { - imageBufSize = size; - delete [] imageBuf; - imageBuf = new rdr::U8[imageBufSize]; - } - if (nPixels) - *nPixels = imageBufSize / (cp->pf().bpp / 8); - return imageBuf; -} - void SMsgWriter::startMsg(int type) { os->writeU8(type); |