aboutsummaryrefslogtreecommitdiffstats
path: root/java/com/tigervnc/rfb/RawDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/tigervnc/rfb/RawDecoder.java')
-rw-r--r--java/com/tigervnc/rfb/RawDecoder.java33
1 files changed, 15 insertions, 18 deletions
diff --git a/java/com/tigervnc/rfb/RawDecoder.java b/java/com/tigervnc/rfb/RawDecoder.java
index b2219a24..71b79607 100644
--- a/java/com/tigervnc/rfb/RawDecoder.java
+++ b/java/com/tigervnc/rfb/RawDecoder.java
@@ -18,28 +18,25 @@
package com.tigervnc.rfb;
+import com.tigervnc.rdr.*;
+
public class RawDecoder extends Decoder {
- public RawDecoder(CMsgReader reader_) { reader = reader_; }
+ public RawDecoder() { super(DecoderFlags.DecoderPlain); }
- public void readRect(Rect r, CMsgHandler handler) {
- int x = r.tl.x;
- int y = r.tl.y;
- int w = r.width();
- int h = r.height();
- int[] imageBuf = new int[w*h];
- int nPixels = imageBuf.length;
- int bytesPerRow = w * (reader.bpp() / 8);
- while (h > 0) {
- int nRows = nPixels / w;
- if (nRows > h) nRows = h;
- reader.getInStream().readPixels(imageBuf, nPixels, (reader.bpp() / 8), handler.cp.pf().bigEndian);
- handler.imageRect(new Rect(x, y, x+w, y+nRows), imageBuf);
- h -= nRows;
- y += nRows;
- }
+ public void readRect(Rect r, InStream is,
+ ConnParams cp, OutStream os)
+ {
+ os.copyBytes(is, r.area() * cp.pf().bpp/8);
}
- CMsgReader reader;
static LogWriter vlog = new LogWriter("RawDecoder");
+ public void decodeRect(Rect r, Object buffer,
+ int buflen, ConnParams cp,
+ ModifiablePixelBuffer pb)
+ {
+ assert(buflen >= r.area() * cp.pf().bpp/8);
+ pb.imageRect(cp.pf(), r, (byte[])buffer);
+ }
+
}