Mercurial > hg > Applications > TreeVNC
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 185:feefc1e58153
minor fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 23 Jun 2014 22:31:22 +0900 |
parents | 032b1bcc6ab4 |
children | f76ee760c2d2 |
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 |
32 | 3 import jp.ac.u_ryukyu.treevnc.MyRfbProto; |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
4 |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
5 import com.glavsoft.drawing.Renderer; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
6 import com.glavsoft.exceptions.TransportException; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
7 import com.glavsoft.rfb.encoding.EncodingType; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
8 import com.glavsoft.transport.Reader; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
9 |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
10 public class ZRLEESender extends Decoder { |
66 | 11 |
29 | 12 private MyRfbProto rfb; |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
13 |
29 | 14 public ZRLEESender(MyRfbProto rfb) { |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
15 this.rfb = rfb; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
16 } |
66 | 17 |
18 public ZRLEESender() { | |
28 | 19 } |
66 | 20 |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
21 @Override |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
22 public void decode(Reader reader, Renderer renderer, |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
23 FramebufferUpdateRectangle rect) throws TransportException { |
135
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
24 // TreeVNC handling |
185 | 25 int dataLen = getZrleLength(rect, reader); |
178
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
166
diff
changeset
|
26 if (rfb.hasViewer()) { |
185 | 27 reader.reset(); |
182 | 28 ZRLEDecoder decoder = new ZRLEDecoder(); |
185 | 29 if (rfb.isRoot()) { |
30 byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()]; | |
31 rfb.readSendData(dataLen, reader, bytes); | |
184 | 32 decoder.decode1(renderer, rect, bytes, 0); |
185 | 33 return; |
34 } else if (!rfb.getCuiVersion()) { | |
35 rfb.readSendData(dataLen, reader, null); | |
36 reader.reset(); | |
37 decoder.decode(reader, renderer, rect); | |
38 return; | |
39 } | |
33
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
40 } |
185 | 41 reader.skip(dataLen); |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
42 } |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
43 |
66 | 44 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader) |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
45 throws TransportException { |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
46 int zrleLength = 0; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
47 if (rect.getEncodingType() == EncodingType.ZRLE |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
48 || rect.getEncodingType() == EncodingType.ZRLEE |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
49 || rect.getEncodingType() == EncodingType.ZLIB) { |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
50 zrleLength = reader.readInt32(); |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
51 } |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
52 return zrleLength + 20; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
53 } |
66 | 54 |
55 public void readCheckDelay(Reader reader) { | |
56 try { | |
57 reader.reset(); | |
58 rfb.readCheckDelay(reader); | |
59 } catch (TransportException e) { | |
60 e.printStackTrace(); | |
61 } | |
62 } | |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
63 } |