# HG changeset patch # User YU # Date 1411042066 -32400 # Node ID 65d989192d63d1fa00471cd166ff1028fb3f4412 # Parent eeacdcc50551929a9d461eed41881ea8788b38d2 change Protocol aliceVNCMessage diff -r eeacdcc50551 -r 65d989192d63 src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java --- a/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java Thu Sep 18 21:06:06 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java Thu Sep 18 21:07:46 2014 +0900 @@ -4,7 +4,7 @@ import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.encoding.EncodingType; -import com.glavsoft.rfb.encoding.decoder.DecodeInfo; +import com.glavsoft.rfb.encoding.decoder.AliceVNCMessage; import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder; @@ -20,38 +20,49 @@ public ReceiveUpdateRectangle(){ info.setKey("Holder"); - info1.setKey("decodeInfo"); + info1.setKey("aliceVNCMessage"); info2.setKey("_CLIST"); } - + @Override public void run() { - ZRLEDecoder decoder = new ZRLEDecoder(); - RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class); - DecodeInfo decodeInfo = info1.asClass(DecodeInfo.class); - try { - decoder.decode(decodeInfo, holder.renderer); - FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle( - decodeInfo.x, decodeInfo.y, decodeInfo.width, decodeInfo.height); + RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class); + AliceVNCMessage message = info1.asClass(AliceVNCMessage.class); + + if (message.getEncodingType() == EncodingType.ZRLE){ + ZRLEDecoder decoder = new ZRLEDecoder(); + decoder.decode(message, holder.getRenderer()); + FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle( + message.x, message.y, message.width, message.height); + + rect.encodingType = EncodingType.byId(message.encodingTypeId); + + holder.getRepaintController().repaintBitmap(rect); + + + } else if (message.getEncodingType() == EncodingType.DESKTOP_SIZE) { - rect.encodingType = EncodingType.byId(decodeInfo.encodingTypeId); + + holder.setRenderer( + holder.getRepaintController().createRenderer(null ,message.width, + message.height, holder.getRenderer().pixelFormat) + ); + + + } - holder.repaintController.repaintBitmap(rect); + @SuppressWarnings("unchecked") + ArrayList clist = info2.asClass(ArrayList.class); + for (String node : clist){ + if (!"parent".equals(node)) + ods.put(node, "aliceVNCMessage", info1.getVal()); + } + new ReceiveUpdateRectangle(); + } catch (TransportException e) { e.printStackTrace(); } - - - @SuppressWarnings("unchecked") - ArrayList clist = info2.asClass(ArrayList.class); - for (String node : clist){ - if (!"parent".equals(node)) - ods.put(node, "decodeInfo", info1.getVal()); - } - - new ReceiveUpdateRectangle(); - } }