view 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
line wrap: on
line source

public void decode(Renderer renderer, ByteBuffer header, FramebufferUpdateRectangle rect, ByteBuffer buf, int zippedLength, TreeRFBProto rfbProto) throws TransportException {
  int offset = zippedLength;
  int maxX = rect.x + rect.width;
  int maxY = rect.y + rect.height;
  byte[] bytes = buf.array();
  WifiMulticast = rfbProto;

  TileLoop tileloop = new TileLoop(rfbProto, zippedLength);
  if (WifiMulticast) {
    tileloop.zrleeBlocking(rfbProto, header, rect, bytes);
  }
  for (int tileY = rect.y; tileY < maxY; tileY += MAX_TILE_SIZE) {
    int tileHeight = Math.min(maxY - tileY, MAX_TILE_SIZE);
    if (tileloop.blocking) {
      tileloop.c1rect.height += tileHeight;
    }
    for (int tileX = rect.x; tileX < maxX; tileX += MAX_TILE_SIZE) {
      int tileWidth = Math.min(maxX - tileX, MAX_TILE_SIZE);
      offset += decodePacked(bytes, offset, renderer, paletteSize, tileX, tileY, tileWidth, tileHeight);
      if (WifiMulticast) {
        tileloop.multicastPut(rfbProto, false, bytes, offset, tileWidth, tileHeight, tileX, tileY);
      }
    }
  }
}