comparison src/myVncProxy/MyRfbProto.java @ 156:b570efb0d266

modify
author e085711
date Fri, 07 Oct 2011 16:40:02 +0900
parents 0510022e9e92
children 881e5b87ee42
comparison
equal deleted inserted replaced
155:0510022e9e92 156:b570efb0d266
359 break; 359 break;
360 case RfbProto.EncodingZlib: 360 case RfbProto.EncodingZlib:
361 case RfbProto.EncodingZRLE: 361 case RfbProto.EncodingZRLE:
362 case RfbProto.EncodingZRLEE: 362 case RfbProto.EncodingZRLEE:
363 dataLen = zLen + 20; 363 dataLen = zLen + 20;
364 // is.mark(dataLen); 364 // is.mark(dataLen);
365 break; 365 break;
366 case RfbProto.EncodingXCursor: 366 case RfbProto.EncodingXCursor:
367 case RfbProto.EncodingRichCursor: 367 case RfbProto.EncodingRichCursor:
368 int pixArray = rectW * rectH * 4; 368 int pixArray = rectW * rectH * 4;
369 int u8Array = (int)Math.floor((rectW + 7)/8) * rectH; 369 int u8Array = (int)Math.floor((rectW + 7)/8) * rectH;
381 381
382 void sendDataToClient() throws Exception { 382 void sendDataToClient() throws Exception {
383 regiFramebufferUpdate(); 383 regiFramebufferUpdate();
384 // printFramebufferUpdate(); 384 // printFramebufferUpdate();
385 int dataLen = checkAndMark(); 385 int dataLen = checkAndMark();
386 readSendData(dataLen); 386 readSendData(dataLen);
387 } 387 }
388 388
389 BufferedImage createBufferedImage(Image img) { 389 BufferedImage createBufferedImage(Image img) {
390 BufferedImage bimg = new BufferedImage(img.getWidth(null), 390 BufferedImage bimg = new BufferedImage(img.getWidth(null),
391 img.getHeight(null), BufferedImage.TYPE_INT_RGB); 391 img.getHeight(null), BufferedImage.TYPE_INT_RGB);
595 buf.flip(); 595 buf.flip();
596 outputs.addLast(buf); 596 outputs.addLast(buf);
597 } 597 }
598 return len; 598 return len;
599 } 599 }
600 600
601
602 float maxMag = 1;
601 /** 603 /**
602 * send data to clients 604 * send data to clients
603 * @param dataLen 605 * @param dataLen
604 * @throws IOException 606 * @throws IOException
605 * @throws DataFormatException 607 * @throws DataFormatException
641 ByteBuffer blen = ByteBuffer.allocate(4); blen.putInt(len2); blen.flip(); 643 ByteBuffer blen = ByteBuffer.allocate(4); blen.putInt(len2); blen.flip();
642 bufs.addFirst(blen); 644 bufs.addFirst(blen);
643 645
644 bufs.addFirst(header); 646 bufs.addFirst(header);
645 multicastqueue.put(bufs); 647 multicastqueue.put(bufs);
646
647 // is.reset(); 648 // is.reset();
649
650 /*
651 System.out.println("ZRLE = "+dataLen);
652 System.out.println("ZRLEE = "+(len2+20));
653 float mag = (float)dataLen / (float)(len2 + 20);
654 System.out.println("ZRLE / ZRLEE = "+ mag);
655 if(mag > maxMag) maxMag = mag;
656 System.out.println("maxMag = "+maxMag);
657 */
648 return ; 658 return ;
649 } 659 }
650 bufs.add(header); 660 bufs.add(header);
651 if (dataLen>16) { 661 if (dataLen>16) {
652 ByteBuffer b = ByteBuffer.allocate(dataLen-16); 662 ByteBuffer b = ByteBuffer.allocate(dataLen-16);
663 startTiming();
653 readFully(b.array(),0,dataLen-16); b.limit(dataLen-16); 664 readFully(b.array(),0,dataLen-16); b.limit(dataLen-16);
665 stopTiming();
654 bufs.add(b); 666 bufs.add(b);
655 } 667 }
656 multicastqueue.put(bufs); 668 multicastqueue.put(bufs);
657 // is.reset(); 669 // is.reset();
658 return ; 670 return ;