Mercurial > hg > Applications > TreeVNC
changeset 559:3481a187687f
correct bytesPerPixcel in NullRenderer
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 30 Jan 2020 23:20:00 +0900 |
parents | 8e507ce09187 |
children | bdd659ce8e64 |
files | src/main/java/com/glavsoft/rfb/protocol/NullRenderer.java src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java |
diffstat | 3 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/NullRenderer.java Thu Jan 30 17:34:22 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/NullRenderer.java Thu Jan 30 23:20:00 2020 +0900 @@ -8,6 +8,12 @@ public class NullRenderer extends Renderer { + private int bytePerPixcel; + + NullRenderer(int bytePerPixcel) { + this.bytePerPixcel = bytePerPixcel; + } + @Override public void drawJpegImage(byte[] bytes, int offset, int jpegBufferLength, FramebufferUpdateRectangle rect) { @@ -36,8 +42,7 @@ @Override public int getBytesPerPixel() { - // TODO Auto-generated method stub - return 0; + return bytePerPixcel; } @Override
--- a/src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java Thu Jan 30 17:34:22 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java Thu Jan 30 23:20:00 2020 +0900 @@ -37,7 +37,7 @@ @Override public Renderer createRenderer(Reader reader, int width, int height, PixelFormat pixelFormat) { - return new NullRenderer(); + return new NullRenderer(pixelFormat.bitsPerPixel/8); } @Override
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jan 30 17:34:22 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jan 30 23:20:00 2020 +0900 @@ -98,6 +98,8 @@ cp.setSingleHeight(context.getFbHeight()); } renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(), context.getPixelFormat()); + } else { + renderer = new NullRenderer(context.getPixelFormat().bitsPerPixel/8); } if(rfb.isTreeManager()) { fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(cp.getX(), cp.getY(), cp.getSingleWidth(), cp.getSingleHeight(), false); @@ -382,7 +384,7 @@ } rect.fill(in); Decoder decoder = decoders.getDecoderByType(rect.getEncodingType()); - decoder.decode(in,new NullRenderer(),rect); + decoder.decode(in,new NullRenderer(context.getPixelFormat().bitsPerPixel/8),rect); } catch (Exception e) { ; }