summaryrefslogtreecommitdiffstats
path: root/common/rfb/RawEncoder.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/RawEncoder.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/RawEncoder.cxx')
-rw-r--r--common/rfb/RawEncoder.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/rfb/RawEncoder.cxx b/common/rfb/RawEncoder.cxx
index 2fc5741c..f7a4f3b8 100644
--- a/common/rfb/RawEncoder.cxx
+++ b/common/rfb/RawEncoder.cxx
@@ -19,11 +19,12 @@
#include <rfb/TransImageGetter.h>
#include <rfb/encodings.h>
#include <rfb/SMsgWriter.h>
+#include <rfb/SConnection.h>
#include <rfb/RawEncoder.h>
using namespace rfb;
-RawEncoder::RawEncoder(SMsgWriter* writer) : Encoder(writer)
+RawEncoder::RawEncoder(SConnection* conn) : Encoder(conn)
{
}
@@ -38,16 +39,16 @@ void RawEncoder::writeRect(const Rect& r, TransImageGetter* ig)
int w = r.width();
int h = r.height();
int nPixels;
- rdr::U8* imageBuf = writer->getImageBuf(w, w*h, &nPixels);
- int bytesPerRow = w * (writer->bpp() / 8);
- writer->startRect(r, encodingRaw);
+ rdr::U8* imageBuf = conn->writer()->getImageBuf(w, w*h, &nPixels);
+ int bytesPerRow = w * (conn->cp.pf().bpp / 8);
+ conn->writer()->startRect(r, encodingRaw);
while (h > 0) {
int nRows = nPixels / w;
if (nRows > h) nRows = h;
ig->getImage(imageBuf, Rect(x, y, x+w, y+nRows));
- writer->getOutStream()->writeBytes(imageBuf, nRows * bytesPerRow);
+ conn->getOutStream()->writeBytes(imageBuf, nRows * bytesPerRow);
h -= nRows;
y += nRows;
}
- writer->endRect();
+ conn->writer()->endRect();
}