From c0397269fcab67e9acd4fdcbc29f24d79ed0ef39 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 14 Mar 2014 15:59:46 +0100 Subject: 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. --- common/rfb/SMsgWriter.cxx | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'common/rfb/SMsgWriter.cxx') 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); -- cgit v1.2.3