summaryrefslogtreecommitdiffstats
path: root/common/rfb/RawDecoder.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-01-31 12:37:32 +0100
committerPierre Ossman <ossman@cendio.se>2014-07-07 14:50:28 +0200
commit668468b3d43d5ea1562ebc0be8de0c98c5601a60 (patch)
tree80bbb90fb5f00335a7e85c297eadd40b0780dc92 /common/rfb/RawDecoder.cxx
parentfdba3fe884d5b43e07d7d49033c83f2f11bf524c (diff)
downloadtigervnc-668468b3d43d5ea1562ebc0be8de0c98c5601a60.tar.gz
tigervnc-668468b3d43d5ea1562ebc0be8de0c98c5601a60.zip
Encoders/decoders should track the connection object
The connection object is a much more appropriate object for the decoders and encoders to keep track of. Besides the streams, it also contains state like connection parameters.
Diffstat (limited to 'common/rfb/RawDecoder.cxx')
-rw-r--r--common/rfb/RawDecoder.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/rfb/RawDecoder.cxx b/common/rfb/RawDecoder.cxx
index eab92e53..6ca02026 100644
--- a/common/rfb/RawDecoder.cxx
+++ b/common/rfb/RawDecoder.cxx
@@ -17,12 +17,13 @@
*/
#include <rdr/InStream.h>
#include <rfb/CMsgReader.h>
+#include <rfb/CConnection.h>
#include <rfb/CMsgHandler.h>
#include <rfb/RawDecoder.h>
using namespace rfb;
-RawDecoder::RawDecoder(CMsgReader* reader) : Decoder(reader)
+RawDecoder::RawDecoder(CConnection* conn) : Decoder(conn)
{
}
@@ -37,12 +38,12 @@ void RawDecoder::readRect(const Rect& r, CMsgHandler* handler)
int w = r.width();
int h = r.height();
int nPixels;
- rdr::U8* imageBuf = reader->getImageBuf(w, w*h, &nPixels);
- int bytesPerRow = w * (reader->bpp() / 8);
+ rdr::U8* imageBuf = conn->reader()->getImageBuf(w, w*h, &nPixels);
+ int bytesPerRow = w * (conn->cp.pf().bpp / 8);
while (h > 0) {
int nRows = nPixels / w;
if (nRows > h) nRows = h;
- reader->getInStream()->readBytes(imageBuf, nRows * bytesPerRow);
+ conn->getInStream()->readBytes(imageBuf, nRows * bytesPerRow);
handler->imageRect(Rect(x, y, x+w, y+nRows), imageBuf);
h -= nRows;
y += nRows;