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.
diff --git a/common/rfb/HextileDecoder.cxx b/common/rfb/HextileDecoder.cxx
index dbf75c9..9b335fe 100644
--- a/common/rfb/HextileDecoder.cxx
+++ b/common/rfb/HextileDecoder.cxx
@@ -16,6 +16,7 @@
* USA.
*/
#include <rfb/CMsgReader.h>
+#include <rfb/CConnection.h>
#include <rfb/CMsgHandler.h>
#include <rfb/HextileDecoder.h>
@@ -31,7 +32,7 @@
#include <rfb/hextileDecode.h>
#undef BPP
-HextileDecoder::HextileDecoder(CMsgReader* reader) : Decoder(reader)
+HextileDecoder::HextileDecoder(CConnection* conn) : Decoder(conn)
{
}
@@ -41,9 +42,9 @@
void HextileDecoder::readRect(const Rect& r, CMsgHandler* handler)
{
- rdr::InStream* is = reader->getInStream();
- rdr::U8* buf = reader->getImageBuf(16 * 16 * 4);
- switch (reader->bpp()) {
+ rdr::InStream* is = conn->getInStream();
+ rdr::U8* buf = conn->reader()->getImageBuf(16 * 16 * 4);
+ switch (conn->cp.pf().bpp) {
case 8: hextileDecode8 (r, is, (rdr::U8*) buf, handler); break;
case 16: hextileDecode16(r, is, (rdr::U16*)buf, handler); break;
case 32: hextileDecode32(r, is, (rdr::U32*)buf, handler); break;