Mercurial > hg > Applications > AliceVNC
annotate src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java @ 33:6f5986d8ecd5
prevent video feedback
author | sugi |
---|---|
date | Sun, 09 Nov 2014 17:33:43 +0900 |
parents | 7d65ad341cc9 |
children | 1fa4b7b8d19f |
rev | line source |
---|---|
2 | 1 package jp.ac.u_ryukyu.alicevnc; |
2 | |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
3 import java.util.ArrayList; |
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
4 |
32 | 5 import jp.ac.u_ryukyu.ie.cr.DecodeInfomation; |
6 | |
2 | 7 import com.glavsoft.exceptions.TransportException; |
4 | 8 import com.glavsoft.rfb.encoding.EncodingType; |
2 | 9 import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; |
12 | 10 import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder; |
2 | 11 import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder; |
12 | |
13 import alice.codesegment.CodeSegment; | |
14 import alice.datasegment.CommandType; | |
15 import alice.datasegment.Receiver; | |
16 | |
17 public class ReceiveUpdateRectangle extends CodeSegment{ | |
18 | |
19 private Receiver info = ids.create(CommandType.PEEK); | |
17 | 20 private Receiver info1 = ids.create(CommandType.TAKE); // AliceVNC Message |
21 private Receiver info2 = ids.create(CommandType.TAKE); | |
22 private Receiver info3 = ids.create(CommandType.PEEK); | |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
23 |
2 | 24 public ReceiveUpdateRectangle(){ |
31 | 25 info.setKey("holder"); |
32 | 26 info1.setKey("updateRectangle"); |
27 info2.setKey("pixelData"); | |
17 | 28 info3.setKey("_CLIST"); |
2 | 29 } |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
30 |
10 | 31 @Override |
2 | 32 public void run() { |
17 | 33 // send other node |
34 @SuppressWarnings("unchecked") | |
35 ArrayList<String> clist = info3.asClass(ArrayList.class); | |
36 for (String node : clist){ | |
31 | 37 if (!info1.from.equals(node)) { |
17 | 38 // not need send data comes from |
31 | 39 // Data Segment from other node is already serialized |
32 | 40 ods.put(node, "updateRectangle", info1.getReceiveData()); |
20 | 41 //ods.setCompressFlag(true); |
32 | 42 ods.put(node, "pixelData", info2.getReceiveData()); |
19 | 43 ods.setCompressFlag(false); |
17 | 44 } |
31 | 45 |
17 | 46 } |
31 | 47 |
2 | 48 try { |
10 | 49 RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class); |
32 | 50 DecodeInfomation message = info1.asClass(DecodeInfomation.class); |
10 | 51 |
19 | 52 if (message.getEncodingType() == EncodingType.ZRLEE){ |
10 | 53 ZRLEDecoder decoder = new ZRLEDecoder(); |
54 FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle( | |
55 message.x, message.y, message.width, message.height); | |
12 | 56 rect.encodingType = message.getEncodingType(); |
17 | 57 byte[] buf = info2.asClass(byte[].class); |
31 | 58 |
17 | 59 // this method name is wrong. |
19 | 60 decoder.decode(holder.getRenderer(), rect, buf, 0); |
10 | 61 holder.getRepaintController().repaintBitmap(rect); |
62 | |
31 | 63 } else if (message.getEncodingType() == EncodingType.DESKTOP_SIZE) { |
10 | 64 holder.setRenderer( |
31 | 65 holder.getRepaintController().createRenderer(null, message.width, |
11 | 66 message.height, message.getPixelFormat()) |
10 | 67 ); |
33 | 68 boolean visible = true; |
69 if ("local".equals(info2.from)) { | |
70 visible = false; | |
71 } | |
72 holder.getViewerWindow().setVisible(visible); | |
12 | 73 } else if (message.getEncodingType() == EncodingType.RICH_CURSOR) { |
17 | 74 byte[] buf = info2.asClass(byte[].class); |
75 RichCursorDecoder.getInstance().decode(holder.getRenderer(), message, buf); | |
12 | 76 holder.getRepaintController().repaintCursor(); |
31 | 77 |
12 | 78 } |
79 this.recycle(); | |
10 | 80 |
2 | 81 } catch (TransportException e) { |
82 e.printStackTrace(); | |
83 } | |
84 } | |
85 | |
86 } |