Mercurial > hg > Applications > AliceVNC
annotate src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java @ 12:66c06ebbced1
refactor
author | YU |
---|---|
date | Tue, 23 Sep 2014 16:13:23 +0900 |
parents | aff2d0bb9c50 |
children | f4ecd1f01f0b |
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 |
2 | 5 import com.glavsoft.exceptions.TransportException; |
4 | 6 import com.glavsoft.rfb.encoding.EncodingType; |
10 | 7 import com.glavsoft.rfb.encoding.decoder.AliceVNCMessage; |
2 | 8 import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; |
12 | 9 import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder; |
2 | 10 import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder; |
11 | |
12 import alice.codesegment.CodeSegment; | |
13 import alice.datasegment.CommandType; | |
14 import alice.datasegment.Receiver; | |
15 | |
16 public class ReceiveUpdateRectangle extends CodeSegment{ | |
17 | |
18 private Receiver info = ids.create(CommandType.PEEK); | |
19 private Receiver info1 = ids.create(CommandType.TAKE); | |
12 | 20 private Receiver info2 = ids.create(CommandType.PEEK); |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
21 |
2 | 22 public ReceiveUpdateRectangle(){ |
23 info.setKey("Holder"); | |
10 | 24 info1.setKey("aliceVNCMessage"); |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
25 info2.setKey("_CLIST"); |
2 | 26 } |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
27 |
10 | 28 @Override |
2 | 29 public void run() { |
30 try { | |
10 | 31 RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class); |
32 AliceVNCMessage message = info1.asClass(AliceVNCMessage.class); | |
33 | |
34 if (message.getEncodingType() == EncodingType.ZRLE){ | |
35 ZRLEDecoder decoder = new ZRLEDecoder(); | |
36 FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle( | |
37 message.x, message.y, message.width, message.height); | |
12 | 38 rect.encodingType = message.getEncodingType(); |
39 byte[] buf = message.buf; | |
40 int offset = message.offset; | |
41 | |
42 decoder.setColorDataOnRenderer(holder.getRenderer(), rect, buf, offset); | |
10 | 43 holder.getRepaintController().repaintBitmap(rect); |
44 | |
45 | |
11 | 46 } else if (message.getEncodingType() == EncodingType.DESKTOP_SIZE) { |
10 | 47 holder.setRenderer( |
48 holder.getRepaintController().createRenderer(null ,message.width, | |
11 | 49 message.height, message.getPixelFormat()) |
10 | 50 ); |
51 | |
12 | 52 } else if (message.getEncodingType() == EncodingType.RICH_CURSOR) { |
53 RichCursorDecoder.getInstance().decode(holder.getRenderer(), message); | |
54 holder.getRepaintController().repaintCursor(); | |
55 } | |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
56 |
10 | 57 @SuppressWarnings("unchecked") |
58 ArrayList<String> clist = info2.asClass(ArrayList.class); | |
59 for (String node : clist){ | |
60 if (!"parent".equals(node)) | |
61 ods.put(node, "aliceVNCMessage", info1.getVal()); | |
62 } | |
12 | 63 this.recycle(); |
10 | 64 |
2 | 65 } catch (TransportException e) { |
66 e.printStackTrace(); | |
67 } | |
68 } | |
69 | |
70 } |