changeset 587:b2bcfcfbfc1c

fix
author riono <e165729@ie.u-ryukyu.ac.jp>
date Wed, 12 Feb 2020 17:18:24 +0900
parents 06c41278c783
children 11ae87fed30d
files src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java
diffstat 1 files changed, 6 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java	Sun Feb 09 17:24:57 2020 +0900
+++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java	Wed Feb 12 17:18:24 2020 +0900
@@ -56,7 +56,6 @@
 		private int prevoffset;
 		private Deflater deflater;
 		private int flushOffset;
-		private int tileHeight;
 
 		/**
 		 * Multicast framebufferUpdate to children.
@@ -191,30 +190,28 @@
 				flushMuticast(rfb, bytes);
 				return;
 			}
-			//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
+					deflater.deflate(c1,Deflater.FULL_FLUSH);
 					flushRectangle(c1rect);
 					c1.position((c1.position()+16)); // make next header space
-					c1rect = new FramebufferUpdateRectangle(rect.x,c1rect.y+tileHeight,0,0);
+					c1rect = new FramebufferUpdateRectangle(rect.x,c1rect.y+tileH,0,0);
 				}
 			} else {  // phase 1
 				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;
+					width = tileH;
 					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 = new FramebufferUpdateRectangle(c1rect.x, c1rect.y, 0, c1rect.height);
-						c1rect = new FramebufferUpdateRectangle(rect.x, c1rect.y,0,0);
+						c0rect = c1rect;
+						c1rect = new FramebufferUpdateRectangle(rect.x, c1rect.y, width, tileH);
 					}
-					width = 0;
 					prevLineOffset = offset;
 				}
 			}
@@ -235,10 +232,6 @@
 			}
 		}
 
-		public void setTileHeight(int tileHeight) {
-			this.tileHeight = tileHeight;
-		}
-
 		private void bufdump(byte[] bytes,int beigin, int end) {
 			ReceiverTask.dump("in  ",bytes,beigin,8); ReceiverTask.dump("... ",bytes,end,8);
 			System.out.println();
@@ -323,7 +316,6 @@
 				int tileHeight = Math.min(maxY - tileY, MAX_TILE_SIZE);
 				if (tileloop.blocking) {
 					tileloop.c1rect.height += tileHeight;
-					tileloop.setTileHeight(tileHeight);
 				}
 				for (int tileX = rect.x; tileX < maxX; tileX += MAX_TILE_SIZE) {
 					int tileWidth = Math.min(maxX - tileX, MAX_TILE_SIZE);