comparison src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java @ 501:57ee5c26e8eb

fix multicastput
author oshiro
date Sun, 17 Feb 2019 18:39:28 +0900
parents 5455c62a3775
children b9e73589202c
comparison
equal deleted inserted replaced
500:6609174beafe 501:57ee5c26e8eb
768 public void multicastPut(FramebufferUpdateRectangle rect, byte[] bytes, int prevoffset, int offset, int tilex, int tiley) { 768 public void multicastPut(FramebufferUpdateRectangle rect, byte[] bytes, int prevoffset, int offset, int tilex, int tiley) {
769 int span = offset - prevoffset; 769 int span = offset - prevoffset;
770 int x = rect.x, y = rect.y, w = 0, h = 0, w0 = 0, h0 = 0; 770 int x = rect.x, y = rect.y, w = 0, h = 0, w0 = 0, h0 = 0;
771 deflater.setInput(bytes,prevoffset,span); 771 deflater.setInput(bytes,prevoffset,span);
772 c1rect.height = tiley; 772 c1rect.height = tiley;
773 if (c1.remaining() < span || x + tilex >= rect.x + rect.width ) { 773 if (c1.remaining() < span || c1rect.x + c1rect.width + tilex >= rect.x + rect.width ) {
774 deflater.deflate(c1, Deflater.FULL_FLUSH); 774 deflater.deflate(c1, Deflater.FULL_FLUSH);
775 c1.flip(); 775 c1.flip();
776 try { 776 try {
777 writeUpdateRectangleWithHeader(c1,header,c1.remaining(), c1rect.x, c1rect.y, c1rect.width, c1rect.height); 777 writeUpdateRectangleWithHeader(c1,header,c1.remaining(), c1rect.x, c1rect.y, c1rect.width, c1rect.height);
778 } catch (InterruptedException e) { 778 } catch (InterruptedException e) {
779 e.printStackTrace(); 779 e.printStackTrace();
780 } 780 }
781 c1rect.x += c1rect.width;
782 if (c1rect.x >= rect.x + rect.width) {
783 c1rect.x = rect.x;
784 c1rect.y += tiley;
785 }
786 c1rect.width = 0;
781 c1 = multicastqueue.allocate(deflate_size); 787 c1 = multicastqueue.allocate(deflate_size);
782 } else { 788 } else {
783 deflater.deflate(c1, Deflater.SYNC_FLUSH); 789 deflater.deflate(c1, Deflater.SYNC_FLUSH);
784 } 790 }
785 c1rect.width += tilex; 791 c1rect.width += tilex;
786 if (c1rect.width >= rect.width) {
787 c1rect.width = 0;
788 c1rect.x = 0;
789 c1rect.y += tiley;
790 }
791 } 792 }
792 793
793 private void writeUpdateRectangleWithHeader(ByteBuffer c1, ByteBuffer header, int len2, int x, int y, int w, int h) throws InterruptedException { 794 private void writeUpdateRectangleWithHeader(ByteBuffer c1, ByteBuffer header, int len2, int x, int y, int w, int h) throws InterruptedException {
794 LinkedList<ByteBuffer> bufs = new LinkedList<ByteBuffer>(); 795 LinkedList<ByteBuffer> bufs = new LinkedList<ByteBuffer>();
795 bufs.add(c1); 796 bufs.add(c1);