Mercurial > hg > Applications > TreeVNC
changeset 594:2ff55462c12d
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 13 Feb 2020 21:52:36 +0900 |
parents | 32c104c11767 |
children | 68d73c074d28 |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java |
diffstat | 2 files changed, 9 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Thu Feb 13 13:43:34 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Thu Feb 13 21:52:36 2020 +0900 @@ -164,14 +164,13 @@ // packet full flushDeflator(); int bytesRead = (int)deflater.getBytesRead(); - ReceiverTask.dump("get bytesRead ",bytes, flushOffset+bytesRead - 8, 20); - System.out.println(); prevoffset = flushOffset+bytesRead; assert(prevoffset==offset); System.out.println("od prevOffset = "+prevoffset+" span = "+(prevoffset-flushOffset)); if (c0rect!=null) { // finish pahse 1 flushRectangle(c0rect); - moveNext(); + c1.position(c1.position()+16); // header space + prevC1Offset = c1.position(); } flushRectangle(c1rect); // phase 2 flushMuticast(rfb, bytes); @@ -192,7 +191,7 @@ prevoffset = offset; if (last) { flushDeflator(); - if (c0rect!=null) { flushRectangle(c0rect); moveNext(); } + if (c0rect!=null) flushRectangle(c0rect); flushRectangle(c1rect); flushMuticast(rfb, bytes); return; @@ -203,7 +202,8 @@ if (c1rect.x + c1rect.width >= rect.x + rect.width) { // end of phase 0 deflater.deflate(c1,Deflater.FULL_FLUSH); flushRectangle(c1rect); - c1.position((c1.position()+16)); // make next header space + c1.position(c1.position()+16); // header space + prevC1Offset = c1.position(); c1rect = new FramebufferUpdateRectangle(rect.x,c1rect.y+tileH,0,0); width = 0; } @@ -222,12 +222,6 @@ } } - public void moveNext() { - // previous rectangle is finished, make next header space and copy already compressed part - c1.limit(c1.limit()+16); - System.arraycopy(c1.array(),prevC1LineOffset,16,prevC1LineOffset+16,c1.position()-prevC1LineOffset); - } - private void flushDeflator() { c1.limit(c1.limit() + MARGIN); deflater.deflate(c1, Deflater.FULL_FLUSH); @@ -256,7 +250,6 @@ c1.putInt(prevC1Offset - 8, EncodingType.ZRLEE.getId()); c1.putInt(prevC1Offset - 4, c1.position() - prevC1Offset ); // data length c1.putShort(2, (short) (c1.getShort(2) + 1)); // increment rectangle count - prevC1Offset = c1.position(); } private void flushMuticast(TreeRFBProto rfb, byte[] bytes) {
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Feb 13 13:43:34 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Feb 13 21:52:36 2020 +0900 @@ -386,8 +386,10 @@ int numberOfRectangeles = in.readInt16(); if (true) { in.mark(c1.limit() - 4); - while(numberOfRectangeles-- > 0 ) { + int n = numberOfRectangeles; + while(n-- > 0 ) { rect.fill(in); + System.out.println("check rect " + rect); if (rect.getEncodingType() == EncodingType.ZRLEE) { int length = rect.width * rect.height * renderer.getBytesPerPixel(); int zippedLength = (int) in.readUInt32(); @@ -400,7 +402,6 @@ } while (numberOfRectangeles-- > 0) { rect.fill(in); - System.out.println("check rect " + rect); if (rect.getEncodingType() == EncodingType.ZRLEE) { Decoder decoder = new ZRLEDecoder(); decoder.decode(in,new NullRenderer(context.getPixelFormat().bitsPerPixel/8, context.getFbWidth(), context.getFbHeight(), context.getPixelFormat()),rect); @@ -415,7 +416,7 @@ int span = flushEnd - flushOffset; if (buf.remaining() == span) { - }else { + } else { System.out.println("Bytes is not equal length "+buf.remaining()+" - "+span + " = " + (buf.remaining() - span)); } dump("in ",bytes,flushOffset,8); dump("... ",bytes,flushEnd-8,8);