annotate Paper/src/decode.java @ 13:628722dc83bb

update
author riono <e165729@ie.u-ryukyu.ac.jp>
date Thu, 07 May 2020 21:46:04 +0900
parents c9d0d3e1a82f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 public void decode(Renderer renderer, ByteBuffer header, FramebufferUpdateRectangle rect, ByteBuffer buf, int zippedLength, TreeRFBProto rfbProto) throws TransportException {
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 int offset = zippedLength;
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 int maxX = rect.x + rect.width;
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 int maxY = rect.y + rect.height;
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 byte[] bytes = buf.array();
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 WifiMulticast = rfbProto;
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 TileLoop tileloop = new TileLoop(rfbProto, zippedLength);
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 if (WifiMulticast) {
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 tileloop.zrleeBlocking(rfbProto, header, rect, bytes);
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 for (int tileY = rect.y; tileY < maxY; tileY += MAX_TILE_SIZE) {
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 int tileHeight = Math.min(maxY - tileY, MAX_TILE_SIZE);
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 if (tileloop.blocking) {
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 tileloop.c1rect.height += tileHeight;
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 for (int tileX = rect.x; tileX < maxX; tileX += MAX_TILE_SIZE) {
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 int tileWidth = Math.min(maxX - tileX, MAX_TILE_SIZE);
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 offset += decodePacked(bytes, offset, renderer, paletteSize, tileX, tileY, tileWidth, tileHeight);
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 if (WifiMulticast) {
11
c9d0d3e1a82f add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
21 tileloop.multicastPut(rfbProto, false, bytes, offset, tileWidth, tileHeight, tileX, tileY);
10
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 }
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 }
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }
d2644d8f7893 add code
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 }