annotate src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java @ 2:e046eb8a3ac1

succeed to repaint another viewer
author YU
date Sat, 13 Sep 2014 07:09:27 +0900
parents
children 9a24e36d8ed7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
1 package jp.ac.u_ryukyu.alicevnc;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
3 import com.glavsoft.exceptions.TransportException;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
4 import com.glavsoft.rfb.encoding.decoder.DecodeInfo;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
5 import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
6 import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
7
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
8 import alice.codesegment.CodeSegment;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
9 import alice.datasegment.CommandType;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
10 import alice.datasegment.Receiver;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
11
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
12 public class ReceiveUpdateRectangle extends CodeSegment{
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
13
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
14 private Receiver info = ids.create(CommandType.PEEK);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
15 private Receiver info1 = ids.create(CommandType.TAKE);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
16
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
17 public ReceiveUpdateRectangle(){
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
18 info.setKey("Holder");
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
19 info1.setKey("decodeInfo");
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
20 }
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
21
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
22 public void run() {
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
23 ZRLEDecoder decoder = new ZRLEDecoder();
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
24 RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
25 DecodeInfo decodeInfo = info1.asClass(DecodeInfo.class);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
26
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
27 try {
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
28 decoder.decode(decodeInfo, holder.renderer);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
29 FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle();
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
30 rect.x = decodeInfo.x;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
31 rect.y = decodeInfo.y;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
32 rect.height = decodeInfo.height;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
33 rect.width = decodeInfo.width;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
34 rect.encodingType = decodeInfo.encodingType;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
35
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
36 holder.repaintController.repaintBitmap(rect);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
37 } catch (TransportException e) {
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
38 e.printStackTrace();
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
39 }
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
40
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
41 new ReceiveUpdateRectangle();
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
42
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
43 }
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
44
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
45 }