Mercurial > hg > Applications > TreeVNC
changeset 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 |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java |
diffstat | 3 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Mon Jun 23 21:46:04 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Mon Jun 23 22:31:22 2014 +0900 @@ -21,18 +21,24 @@ @Override public void decode(Reader reader, Renderer renderer, FramebufferUpdateRectangle rect) throws TransportException { - int dataLen = getZrleLength(rect, reader); - reader.reset(); - byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()]; // TreeVNC handling - rfb.readSendData(dataLen, reader, bytes); + int dataLen = getZrleLength(rect, reader); if (rfb.hasViewer()) { + reader.reset(); ZRLEDecoder decoder = new ZRLEDecoder(); - if (rfb.isRoot()) + if (rfb.isRoot()) { + byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()]; + rfb.readSendData(dataLen, reader, bytes); decoder.decode1(renderer, rect, bytes, 0); - else if (!rfb.getCuiVersion()) - decoder.decode1(renderer, rect,bytes,0); + return; + } else if (!rfb.getCuiVersion()) { + rfb.readSendData(dataLen, reader, null); + reader.reset(); + decoder.decode(reader, renderer, rect); + return; + } } + reader.skip(dataLen); } private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader)
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Jun 23 21:46:04 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Jun 23 22:31:22 2014 +0900 @@ -262,8 +262,7 @@ rfb.getContext().setInitData(initData); repaintController.updateRemoteDesktopName(rfb.getContext()); reader.reset(); - byte[] bytes = new byte[0]; - rfb.readSendData(length + 20, reader, bytes ); // size of UpdateRectangleMessage with initData. + rfb.readSendData(length + 20, reader, null ); // size of UpdateRectangleMessage with initData. short id = (short) rect.x; visible = (id != rfb.getId()); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Mon Jun 23 21:46:04 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Mon Jun 23 22:31:22 2014 +0900 @@ -494,12 +494,10 @@ ByteBuffer header = multicastqueue.allocate(16); ByteBuffer serial = multicastqueue.allocate(8); if (!isRoot()) { - reader.mark(dataLen+8); // +8 is serialnum reader.readBytes(serial.array(),0,8); serial.limit(8); - } else { - reader.mark(dataLen); } + reader.mark(dataLen); reader.readBytes(header.array(), 0, 16); header.limit(16); if (header.get(0) == FramebufferUpdate) {