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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
b31903e5b02d rename myRFBProto
oc
parents: 204
diff changeset
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
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
13
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
14 private TreeRFBProto rfb;
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
15
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
16 public ZRLEESender(TreeRFBProto rfb) {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
17 this.rfb = rfb;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
18 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
19
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
20 public ZRLEESender() {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
21 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
22
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
23 @Override
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
24 public void decode(Reader reader, Renderer renderer,
275
0f9b3de45fb2 set main display size.
oc
parents: 264
diff changeset
25 FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException {
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
26 // TreeVNC handling
185
feefc1e58153 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
27 int dataLen = getZrleLength(rect, reader);
190
6aa1c0f4ab2e fix readSendData.
oc
parents: 189
diff changeset
28 byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()];
319
f2b835466a24 fix send initData
oc
parents: 275
diff changeset
29 // byte[] bytes = new byte[renderer.getWidth() * renderer.getHeight() * renderer.getBytesPerPixel()];
189
f381159e38f3 fix readSendData.
oc
parents: 186
diff changeset
30 reader.reset();
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
31 if (rfb.hasViewer()) {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
32 ZRLEDecoder decoder = new ZRLEDecoder();
381
47c018aed50e Change condition to ZRLEESender.decode method
innparusu
parents: 380
diff changeset
33 if (rect.getEncodingType() == EncodingType.ZRLE) {
47c018aed50e Change condition to ZRLEESender.decode method
innparusu
parents: 380
diff changeset
34 // ReadSendData convert ZRLE to ZRLEE
47c018aed50e Change condition to ZRLEESender.decode method
innparusu
parents: 380
diff changeset
35 // unzipped data in the bytes
264
83d0256a8808 add fixing display filter.
oc
parents: 239
diff changeset
36 rfb.readSendData(dataLen, reader, bytes, rect);
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
37 decoder.decode1(renderer, rect, bytes, 0);
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
38 return;
381
47c018aed50e Change condition to ZRLEESender.decode method
innparusu
parents: 380
diff changeset
39 } else {
47c018aed50e Change condition to ZRLEESender.decode method
innparusu
parents: 380
diff changeset
40 // no reencoding is required
47c018aed50e Change condition to ZRLEESender.decode method
innparusu
parents: 380
diff changeset
41 // readSend does not peform unzip, do the fullrecoding
264
83d0256a8808 add fixing display filter.
oc
parents: 239
diff changeset
42 rfb.readSendData(dataLen, reader, null, rect);
380
aef5cbdd84ab Fix compare SerialNumber flag
innparusu
parents: 378
diff changeset
43 reader.reset();
aef5cbdd84ab Fix compare SerialNumber flag
innparusu
parents: 378
diff changeset
44 reader.skip(16);
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
45 decoder.decode(reader, renderer, rect);
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
46 return;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
47 }
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
48 }
380
aef5cbdd84ab Fix compare SerialNumber flag
innparusu
parents: 378
diff changeset
49 rfb.readSendData(dataLen, reader, bytes, rect);
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
50 }
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
51
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
52 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader)
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
53 throws TransportException {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
54 int zrleLength = 0;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
55 if (rect.getEncodingType() == EncodingType.ZRLE
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
56 || rect.getEncodingType() == EncodingType.ZRLEE
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
57 || rect.getEncodingType() == EncodingType.ZLIB) {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
58 zrleLength = reader.readInt32();
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
59 }
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
60 return zrleLength + 20;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
61 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
62
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
63 }