Mercurial > hg > Applications > TreeVNC
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 204:d9d234715853
TreeManager for each interface
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 27 Jun 2014 21:37:20 +0900 |
parents | 6aa1c0f4ab2e |
children | b31903e5b02d |
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); |
190 | 26 byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()]; |
189 | 27 reader.reset(); |
178
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
166
diff
changeset
|
28 if (rfb.hasViewer()) { |
182 | 29 ZRLEDecoder decoder = new ZRLEDecoder(); |
204
d9d234715853
TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
190
diff
changeset
|
30 if (rfb.isTreeManager()) { |
185 | 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(); | |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
37 reader.skip(16); |
185 | 38 decoder.decode(reader, renderer, rect); |
39 return; | |
40 } | |
33
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
41 } |
190 | 42 rfb.readSendData(dataLen, reader, bytes); |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
43 } |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
44 |
66 | 45 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader) |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
46 throws TransportException { |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
47 int zrleLength = 0; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
48 if (rect.getEncodingType() == EncodingType.ZRLE |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
49 || rect.getEncodingType() == EncodingType.ZRLEE |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
50 || rect.getEncodingType() == EncodingType.ZLIB) { |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
51 zrleLength = reader.readInt32(); |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
52 } |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
53 return zrleLength + 20; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
54 } |
66 | 55 |
56 public void readCheckDelay(Reader reader) { | |
57 try { | |
58 reader.reset(); | |
59 rfb.readCheckDelay(reader); | |
60 } catch (TransportException e) { | |
61 e.printStackTrace(); | |
62 } | |
63 } | |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
64 } |