changeset 586:06c41278c783

fix rectangle
author riono <e165729@ie.u-ryukyu.ac.jp>
date Sun, 09 Feb 2020 17:24:57 +0900
parents f07cae18a806
children b2bcfcfbfc1c
files src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java	Sun Feb 09 04:34:32 2020 +0900
+++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java	Sun Feb 09 17:24:57 2020 +0900
@@ -157,6 +157,7 @@
 			if (!blocking) return;
 			int span = offset - prevoffset;
 			deflater.setInput(bytes, prevoffset, span);
+			width += tileW;
 			do {
 				deflater.deflate(c1, Deflater.SYNC_FLUSH);
 				if (!deflater.needsInput()) {
@@ -190,12 +191,11 @@
 				flushMuticast(rfb, bytes);
 				return;
 			}
-			width += tileW;
+			//width += tileW;
 			if (c1rect.height==0) c1rect.height = tileH;
 			if (c1rect.x > rect.x) {  // phase 0
 				assert(c0rect==null);
 				if (c1rect.x + c1rect.width >= rect.x + rect.width) {  // end of phase 0
-					c1rect.height = c1rect.height - tileHeight;
 					flushRectangle(c1rect);
 					c1.position((c1.position()+16)); // make next header space
 					c1rect = new FramebufferUpdateRectangle(rect.x,c1rect.y+tileHeight,0,0);
@@ -204,14 +204,15 @@
 				if (width >= rect.width) { // next line
 					int detaSize = deflater.deflate(c1,Deflater.FULL_FLUSH);
 					prevC1LineOffset = c1.position();
-					c1rect.width = rect.width;
+					//c1rect.width = rect.width;
 					if (c0rect!=null) { // extend phase 1
 						c0rect.height += tileH;
+						c0rect.width += tileW;
 						c1rect = new FramebufferUpdateRectangle(rect.x, c0rect.y+c0rect.height,0,0);
 					} else { // first phase 1 case
 						c1rect.height = tileH;
-						c0rect = c1rect;
-						c1rect = new FramebufferUpdateRectangle(rect.x, c1rect.y+c1rect.height,0,0);
+						c0rect = new FramebufferUpdateRectangle(c1rect.x, c1rect.y, 0, c1rect.height);
+						c1rect = new FramebufferUpdateRectangle(rect.x, c1rect.y,0,0);
 					}
 					width = 0;
 					prevLineOffset = offset;