From 2258f12177ce539ff8162553821d97c8a5523f5a Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Mon, 20 May 2002 13:10:44 +0000 Subject: Fixed pixel format to make it compatible with VNC Reflector, for RRE and CoRRE encodings. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2503 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/src/com/tightvnc/rfbplayer/VncCanvas.java | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/java/src/com/tightvnc/rfbplayer/VncCanvas.java b/java/src/com/tightvnc/rfbplayer/VncCanvas.java index 76ee6b98..2fe0f476 100644 --- a/java/src/com/tightvnc/rfbplayer/VncCanvas.java +++ b/java/src/com/tightvnc/rfbplayer/VncCanvas.java @@ -276,18 +276,25 @@ class VncCanvas extends Canvas { case RfbProto.EncodingRRE: { + byte[] buf = new byte[4]; + int rx = rfb.updateRectX, ry = rfb.updateRectY; int rw = rfb.updateRectW, rh = rfb.updateRectH; int nSubrects = rfb.is.readInt(); int x, y, w, h; - Color pixel; - pixel = new Color(0xFF000000 | rfb.is.readInt()); + rfb.is.readFully(buf); + Color pixel = new Color((buf[2] & 0xFF) << 16 | + (buf[1] & 0xFF) << 8 | + (buf[0] & 0xFF)); memGraphics.setColor(pixel); memGraphics.fillRect(rx, ry, rw, rh); for (int j = 0; j < nSubrects; j++) { - pixel = new Color(0xFF000000 | rfb.is.readInt()); + rfb.is.readFully(buf); + pixel = new Color((buf[2] & 0xFF) << 16 | + (buf[1] & 0xFF) << 8 | + (buf[0] & 0xFF)); x = rx + rfb.is.readUnsignedShort(); y = ry + rfb.is.readUnsignedShort(); w = rfb.is.readUnsignedShort(); @@ -303,18 +310,25 @@ class VncCanvas extends Canvas { case RfbProto.EncodingCoRRE: { + byte[] buf = new byte[4]; + int rx = rfb.updateRectX, ry = rfb.updateRectY; int rw = rfb.updateRectW, rh = rfb.updateRectH; int nSubrects = rfb.is.readInt(); int x, y, w, h; - Color pixel; - pixel = new Color(0xFF000000 | rfb.is.readInt()); + rfb.is.readFully(buf); + Color pixel = new Color((buf[2] & 0xFF) << 16 | + (buf[1] & 0xFF) << 8 | + (buf[0] & 0xFF)); memGraphics.setColor(pixel); memGraphics.fillRect(rx, ry, rw, rh); for (int j = 0; j < nSubrects; j++) { - pixel = new Color(0xFF000000 | rfb.is.readInt()); + rfb.is.readFully(buf); + pixel = new Color((buf[2] & 0xFF) << 16 | + (buf[1] & 0xFF) << 8 | + (buf[0] & 0xFF)); x = rx + rfb.is.readUnsignedByte(); y = ry + rfb.is.readUnsignedByte(); w = rfb.is.readUnsignedByte(); -- cgit v1.2.3