Mercurial > hg > Applications > TreeVNC
diff src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java @ 550:9c0cbe119155
fix make rectangle packet in client
author | e165729 <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 27 Jan 2020 14:40:58 +0900 |
parents | 1ba61b57be39 |
children | ff4c1972aa2e |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Sat Jan 04 17:34:01 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Mon Jan 27 14:40:58 2020 +0900 @@ -108,9 +108,8 @@ CheckDelay.checkDelay(c1, rect.x, rect.y, rect.width, rect.height, System.currentTimeMillis(), EncodingType.CHECK_DELAY); c1.put((byte) 0); c1.put((byte) 0); - c1.put((byte) 0); c1.putShort((short) 0); - c1.position(c1.position() + 16); + c1.position(c1.position() + 12); c1.putInt(0); // should be data length prevC1Offset = c1.position(); prevC1LineOffset = prevC1Offset; @@ -190,27 +189,26 @@ if (!deflater.needsInput()) { deflater.finish(); if (offset != prevLineOffset) { - // fix phase1 rectangle header - c1.putShort(prevC1Offset + 0, (short) c1rect.x); - c1.putShort(prevC1Offset + 2, (short) c1rect.y); - c1.putShort(prevC1Offset + 4, (short) c1rect.width); - c1.putShort(prevC1Offset + 6, (short) c1rect.height); - c1.putInt(prevC1Offset + 8, EncodingType.ZRLEE.getId()); - c1.putInt(prevC1Offset + 12, c1.position() - prevC1LineOffset - 12); // data length - c1.putShort(2, (short) (c1.getShort(2) + 1)); // increment rectangle count + //c1.putShort(prevC1Offset - 16, (short) c1rect.x); + //c1.putShort(prevC1Offset - 14, (short) c1rect.y); + //c1.putShort(prevC1Offset - 12, (short) c1rect.width); + //c1.putShort(prevC1Offset - 10, (short) c1rect.height); + //c1.putInt(prevC1Offset - 8, EncodingType.ZRLEE.getId()); + //c1.putInt(prevC1Offset - 4, c1.position() - prevC1LineOffset - 12); // data length + //c1.putShort(2, (short) (c1.getShort(2) + 1)); // increment rectangle count - if (c1rect.x == rect.x) { // phase0 needs no phase1 - // make header space for phase2 - c1.limit(c1.limit() + headerLength); - int pos = c1.position() - 1; - // to make rectangle header shift last bytes - for (int i = 0; i < pos - prevC1LineOffset; i++) { - c1.array()[pos + headerLength - i] = c1.array()[pos - i]; - } - prevC1Offset = prevC1LineOffset; - } + //if (c1rect.x == rect.x) { // phase0 needs no phase1 + // // make header space for phase2 + // c1.limit(c1.limit() + headerLength); + // int pos = c1.position() - 1; + // // to make rectangle header shift last bytes + // for (int i = 0; i < pos - prevC1LineOffset; i++) { + // c1.array()[pos + headerLength - i] = c1.array()[pos - i]; + // } + // prevC1Offset = prevC1LineOffset; + //} } flushRectangle(rect); flushMuticast(rfb); @@ -232,12 +230,12 @@ * send muticast pacate if nessesally */ private void flushRectangle(FramebufferUpdateRectangle rect) { - c1.putShort(prevC1Offset + 0, (short) c1rect.x); - c1.putShort(prevC1Offset + 2, (short) c1rect.y); - c1.putShort(prevC1Offset + 4, (short) c1rect.width); - c1.putShort(prevC1Offset + 6, (short) c1rect.height); - c1.putInt(prevC1Offset + 8, EncodingType.ZRLEE.getId()); - c1.putInt(prevC1Offset + 12, c1.position() - prevC1Offset - 12); // data length + c1.putShort(prevC1Offset - 16, (short) c1rect.x); + c1.putShort(prevC1Offset - 14, (short) c1rect.y); + c1.putShort(prevC1Offset - 12, (short) c1rect.width); + c1.putShort(prevC1Offset - 10, (short) c1rect.height); + c1.putInt(prevC1Offset - 8, EncodingType.ZRLEE.getId()); + c1.putInt(prevC1Offset - 4, c1.position() - prevC1Offset - 12); // data length c1.putShort(2, (short) (c1.getShort(2) + 1)); // increment rectangle count prevC1Offset = c1.position(); @@ -303,7 +301,7 @@ int maxY = rect.y + rect.height; TileLoop tileloop = new TileLoop(zippedLength); - //System.out.println("decode1: "+rect); + //System.out.println("decode1: "+rect.toString()); if (null == palette) { palette = new int[128]; }