Mercurial > hg > Applications > TreeVNC
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 275:0f9b3de45fb2
set main display size.
author | oc |
---|---|
date | Tue, 06 Jan 2015 19:07:27 +0900 |
parents | 83d0256a8808 |
children | f2b835466a24 |
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()]; |
189 | 29 reader.reset(); |
239 | 30 if (rfb.hasViewer()) { |
31 ZRLEDecoder decoder = new ZRLEDecoder(); | |
32 if (rfb.isTreeManager()) { | |
264 | 33 rfb.readSendData(dataLen, reader, bytes, rect); |
239 | 34 decoder.decode1(renderer, rect, bytes, 0); |
35 return; | |
36 } else if (!rfb.getCuiVersion()) { | |
264 | 37 rfb.readSendData(dataLen, reader, null, rect); |
185 | 38 reader.reset(); |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
39 reader.skip(16); |
239 | 40 decoder.decode(reader, renderer, rect); |
41 return; | |
42 } | |
43 } | |
264 | 44 rfb.readSendData(dataLen, reader, bytes, rect); |
239 | 45 } |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
46 |
239 | 47 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader) |
48 throws TransportException { | |
49 int zrleLength = 0; | |
50 if (rect.getEncodingType() == EncodingType.ZRLE | |
51 || rect.getEncodingType() == EncodingType.ZRLEE | |
52 || rect.getEncodingType() == EncodingType.ZLIB) { | |
53 zrleLength = reader.readInt32(); | |
54 } | |
55 return zrleLength + 20; | |
56 } | |
66 | 57 |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
58 } |