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/RREEncoder.cxx b/common/rfb/RREEncoder.cxx
index dc2d74e..a7af25d 100644
--- a/common/rfb/RREEncoder.cxx
+++ b/common/rfb/RREEncoder.cxx
@@ -19,6 +19,7 @@
 #include <rfb/TransImageGetter.h>
 #include <rfb/encodings.h>
 #include <rfb/SMsgWriter.h>
+#include <rfb/SConnection.h>
 #include <rfb/RREEncoder.h>
 
 using namespace rfb;
@@ -33,7 +34,7 @@
 #include <rfb/rreEncode.h>
 #undef BPP
 
-RREEncoder::RREEncoder(SMsgWriter* writer) : RawEncoder(writer)
+RREEncoder::RREEncoder(SConnection* conn) : RawEncoder(conn)
 {
 }
 
@@ -45,13 +46,13 @@
 {
   int w = r.width();
   int h = r.height();
-  rdr::U8* imageBuf = writer->getImageBuf(w*h);
+  rdr::U8* imageBuf = conn->writer()->getImageBuf(w*h);
   ig->getImage(imageBuf, r);
 
   mos.clear();
 
   int nSubrects = -1;
-  switch (writer->bpp()) {
+  switch (conn->cp.pf().bpp) {
   case 8:  nSubrects = rreEncode8(imageBuf, w, h, &mos);  break;
   case 16: nSubrects = rreEncode16(imageBuf, w, h, &mos); break;
   case 32: nSubrects = rreEncode32(imageBuf, w, h, &mos); break;
@@ -62,9 +63,9 @@
     return;
   }
 
-  writer->startRect(r, encodingRRE);
-  rdr::OutStream* os = writer->getOutStream();
+  conn->writer()->startRect(r, encodingRRE);
+  rdr::OutStream* os = conn->getOutStream();
   os->writeU32(nSubrects);
   os->writeBytes(mos.data(), mos.length());
-  writer->endRect();
+  conn->writer()->endRect();
 }