# HG changeset patch # User riono # Date 1580718807 -32400 # Node ID 2a601e25ce10f0dd3869bc83f1a636fa24cb17e0 # Parent 0751cb6c0715c880bc6f316b197f8c9e1c385da9 debug fix diff -r 0751cb6c0715 -r 2a601e25ce10 src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java --- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Mon Feb 03 16:38:51 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Mon Feb 03 17:33:27 2020 +0900 @@ -160,7 +160,8 @@ int output = deflater.deflate(c1, Deflater.NO_FLUSH); if (output==0 && ! deflater.needsInput() ) { // compression failed - deflater.finish(); + deflater.setInput(bytes, prevoffset, 0); + output = deflater.deflate(c1, Deflater.FULL_FLUSH); flushRectangle(rect); flushMuticast(rfb); if (!last) { @@ -173,6 +174,7 @@ } return ; } + deflater.deflate(c1); prevoffset = offset; width += tileW; if (c1rect.x > rect.x) { // phase 0 diff -r 0751cb6c0715 -r 2a601e25ce10 src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java --- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Feb 03 16:38:51 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Feb 03 17:33:27 2020 +0900 @@ -383,10 +383,14 @@ if (in.readByte() != FRAMEBUFFER_UPDATE) { ; } - rect.fill(in); - Decoder decoder = decoders.getDecoderByType(rect.getEncodingType()); - decoder.decode(in,new NullRenderer(context.getPixelFormat().bitsPerPixel/8),rect); - } catch (Exception e) { + in.readByte(); + int numberOfRectangeles = in.readInt16(); + while (numberOfRectangeles-- > 0) { + rect.fill(in); + Decoder decoder = decoders.getDecoderByType(rect.getEncodingType()); + decoder.decode(in,new NullRenderer(context.getPixelFormat().bitsPerPixel/8),rect); + } + } catch (Exception e) { ; } }