[Developement] Added update() method to RawDecoder class. This method must be called when framebuffer is resized or BPP is changed.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3413 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/decoder/RawDecoder.java b/java/src/com/tightvnc/decoder/RawDecoder.java
index 8272d3b..c1b2ca1 100644
--- a/java/src/com/tightvnc/decoder/RawDecoder.java
+++ b/java/src/com/tightvnc/decoder/RawDecoder.java
@@ -8,6 +8,7 @@
 import java.awt.image.DirectColorModel;
 import java.awt.image.MemoryImageSource;
 import java.awt.Color;
+import java.awt.Toolkit;
 
 //
 // This is base decoder class.
@@ -59,6 +60,33 @@
   }
 
   //
+  // Updates pixels data.
+  // This methods must be called when framebuffer is resized
+  // or BPP is changed.
+  //
+
+  public void update() {
+    // Images with raw pixels should be re-allocated on every change
+    // of geometry or pixel format.
+    int fbWidth = framebufferWidth;
+    int fbHeight = framebufferHeight;
+
+    if (bytesPerPixel == 1) {
+      pixels24 = null;
+      pixels8 = new byte[fbWidth * fbHeight];
+      pixelsSource = new MemoryImageSource(fbWidth, fbHeight, getColorModel8(),
+                                           pixels8, 0, fbWidth);
+    } else {
+      pixels8 = null;
+      pixels24 = new int[fbWidth * fbHeight];
+      pixelsSource =
+        new MemoryImageSource(fbWidth, fbHeight, cm24, pixels24, 0, fbWidth);
+    }
+    pixelsSource.setAnimated(true);
+    rawPixelsImage = Toolkit.getDefaultToolkit().createImage(pixelsSource);
+  }
+
+  //
   // Private static members access methdos
   //