[Refactoring, cleanup] Write encoding ID of real decoders in decoders classes. Pseudo encoding ID still writes in RfbProto class. ZlibDecoder recoding enabled. ZRLEDecoder recoding still not working.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3455 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/decoder/RawDecoder.java b/java/src/com/tightvnc/decoder/RawDecoder.java
index 9025e9e..affdc67 100644
--- a/java/src/com/tightvnc/decoder/RawDecoder.java
+++ b/java/src/com/tightvnc/decoder/RawDecoder.java
@@ -85,6 +85,15 @@
   //
 
   public void handleRect(int x, int y, int w, int h) throws IOException, Exception {
+
+    //
+    // Write encoding ID to record output stream
+    //
+
+    if ((dos != null) && (enableEncodingRecordWritting)) {
+      dos.writeInt(RawDecoder.EncodingRaw);
+    }
+
     if (bytesPerPixel == 1) {
       for (int dy = y; dy < y + h; dy++) {
         if (pixels8 != null) {
@@ -189,6 +198,17 @@
   }
 
   //
+  // This method will be used by HextileDecoder to disable
+  // double writting encoding id to record stream.
+  //
+  // FIXME: Try to find better solution than this.
+  //
+
+  protected void enableEncodingRecordWritting(boolean enable) {
+    enableEncodingRecordWritting = enable;
+  }
+
+  //
   // Unique data for every decoder (? maybe not ?)
   //
 
@@ -199,6 +219,7 @@
   protected Graphics graphics = null;
   protected RecordInterface rec = null;
   protected DataOutput dos = null;
+  protected boolean enableEncodingRecordWritting = true;
 
   //
   // This data must be shared between decoders