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
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()];
189
f381159e38f3 fix readSendData.
oc
parents: 186
diff changeset
29 reader.reset();
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
30 if (rfb.hasViewer()) {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
31 ZRLEDecoder decoder = new ZRLEDecoder();
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
32 if (rfb.isTreeManager()) {
264
83d0256a8808 add fixing display filter.
oc
parents: 239
diff changeset
33 rfb.readSendData(dataLen, reader, bytes, rect);
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
34 decoder.decode1(renderer, rect, bytes, 0);
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
35 return;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
36 } else if (!rfb.getCuiVersion()) {
264
83d0256a8808 add fixing display filter.
oc
parents: 239
diff changeset
37 rfb.readSendData(dataLen, reader, null, rect);
185
feefc1e58153 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 184
diff changeset
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
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
40 decoder.decode(reader, renderer, rect);
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
41 return;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
42 }
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
43 }
264
83d0256a8808 add fixing display filter.
oc
parents: 239
diff changeset
44 rfb.readSendData(dataLen, reader, bytes, rect);
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
45 }
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
46
239
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
47 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader)
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
48 throws TransportException {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
49 int zrleLength = 0;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
50 if (rect.getEncodingType() == EncodingType.ZRLE
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
51 || rect.getEncodingType() == EncodingType.ZRLEE
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
52 || rect.getEncodingType() == EncodingType.ZLIB) {
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
53 zrleLength = reader.readInt32();
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
54 }
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
55 return zrleLength + 20;
d655db005535 create sendCheckDelay Socket.
oc
parents: 232
diff changeset
56 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
57
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
58 }