int height = is.readUnsignedShort();
int encodingType = is.readInt();
// Process rectangle
Rect rect;
switch (encodingType) {
case RfbConstants.ENCODING_RAW: {
rect = new RawRect(screen, x, y, width, height, is);
break;
}
case RfbConstants.ENCODING_COPY_RECT: {
rect = new CopyRect(x, y, width, height, is);
break;
}
case RfbConstants.ENCODING_DESKTOP_SIZE: {
rect = new FrameBufferSizeChangeRequest(canvas, width, height);
if (this.clientListener != null)
this.clientListener.onFramebufferSizeChange(width, height);
break;
}
default:
throw new RuntimeException("Unsupported ecnoding: " + encodingType);
}
paint(rect, canvas);
if (this.clientListener != null)
this.clientListener.onFramebufferUpdate(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
}
}