Mercurial > hg > Applications > TreeVNC
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 381:47c018aed50e
Change condition to ZRLEESender.decode method
author | innparusu |
---|---|
date | Thu, 03 Sep 2015 19:44:39 +0900 |
parents | aef5cbdd84ab |
children | 3af5f4af2d63 |
rev | line source |
---|---|
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
1 package com.glavsoft.rfb.encoding.decoder; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
2 |
232
6ee4cdca104c
send value of port and localhost in checkdelay framebufferupdate, and get this.
oc
parents:
207
diff
changeset
|
3 import java.io.UnsupportedEncodingException; |
6ee4cdca104c
send value of port and localhost in checkdelay framebufferupdate, and get this.
oc
parents:
207
diff
changeset
|
4 |
207 | 5 import jp.ac.u_ryukyu.treevnc.TreeRFBProto; |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
6 |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
7 import com.glavsoft.drawing.Renderer; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
8 import com.glavsoft.exceptions.TransportException; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
9 import com.glavsoft.rfb.encoding.EncodingType; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
10 import com.glavsoft.transport.Reader; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
11 |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
12 public class ZRLEESender extends Decoder { |
66 | 13 |
239 | 14 private TreeRFBProto rfb; |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
15 |
239 | 16 public ZRLEESender(TreeRFBProto rfb) { |
17 this.rfb = rfb; | |
18 } | |
66 | 19 |
239 | 20 public ZRLEESender() { |
21 } | |
66 | 22 |
239 | 23 @Override |
24 public void decode(Reader reader, Renderer renderer, | |
275 | 25 FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException { |
239 | 26 // TreeVNC handling |
185 | 27 int dataLen = getZrleLength(rect, reader); |
190 | 28 byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()]; |
319 | 29 // byte[] bytes = new byte[renderer.getWidth() * renderer.getHeight() * renderer.getBytesPerPixel()]; |
189 | 30 reader.reset(); |
239 | 31 if (rfb.hasViewer()) { |
32 ZRLEDecoder decoder = new ZRLEDecoder(); | |
381 | 33 if (rect.getEncodingType() == EncodingType.ZRLE) { |
34 // ReadSendData convert ZRLE to ZRLEE | |
35 // unzipped data in the bytes | |
264 | 36 rfb.readSendData(dataLen, reader, bytes, rect); |
239 | 37 decoder.decode1(renderer, rect, bytes, 0); |
38 return; | |
381 | 39 } else { |
40 // no reencoding is required | |
41 // readSend does not peform unzip, do the fullrecoding | |
264 | 42 rfb.readSendData(dataLen, reader, null, rect); |
380 | 43 reader.reset(); |
44 reader.skip(16); | |
239 | 45 decoder.decode(reader, renderer, rect); |
46 return; | |
47 } | |
48 } | |
380 | 49 rfb.readSendData(dataLen, reader, bytes, rect); |
239 | 50 } |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
51 |
239 | 52 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader) |
53 throws TransportException { | |
54 int zrleLength = 0; | |
55 if (rect.getEncodingType() == EncodingType.ZRLE | |
56 || rect.getEncodingType() == EncodingType.ZRLEE | |
57 || rect.getEncodingType() == EncodingType.ZLIB) { | |
58 zrleLength = reader.readInt32(); | |
59 } | |
60 return zrleLength + 20; | |
61 } | |
66 | 62 |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
63 } |