2
|
1 package jp.ac.u_ryukyu.alicevnc;
|
|
2
|
|
3 import com.glavsoft.exceptions.TransportException;
|
|
4 import com.glavsoft.rfb.encoding.decoder.DecodeInfo;
|
|
5 import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle;
|
|
6 import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder;
|
|
7
|
|
8 import alice.codesegment.CodeSegment;
|
|
9 import alice.datasegment.CommandType;
|
|
10 import alice.datasegment.Receiver;
|
|
11
|
|
12 public class ReceiveUpdateRectangle extends CodeSegment{
|
|
13
|
|
14 private Receiver info = ids.create(CommandType.PEEK);
|
|
15 private Receiver info1 = ids.create(CommandType.TAKE);
|
|
16
|
|
17 public ReceiveUpdateRectangle(){
|
|
18 info.setKey("Holder");
|
|
19 info1.setKey("decodeInfo");
|
|
20 }
|
|
21
|
|
22 public void run() {
|
|
23 ZRLEDecoder decoder = new ZRLEDecoder();
|
|
24 RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class);
|
|
25 DecodeInfo decodeInfo = info1.asClass(DecodeInfo.class);
|
|
26
|
|
27 try {
|
|
28 decoder.decode(decodeInfo, holder.renderer);
|
|
29 FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle();
|
|
30 rect.x = decodeInfo.x;
|
|
31 rect.y = decodeInfo.y;
|
|
32 rect.height = decodeInfo.height;
|
|
33 rect.width = decodeInfo.width;
|
|
34 rect.encodingType = decodeInfo.encodingType;
|
|
35
|
|
36 holder.repaintController.repaintBitmap(rect);
|
|
37 } catch (TransportException e) {
|
|
38 e.printStackTrace();
|
|
39 }
|
|
40
|
|
41 new ReceiveUpdateRectangle();
|
|
42
|
|
43 }
|
|
44
|
|
45 }
|