]> source.dussan.org Git - tigervnc.git/commitdiff
Fixed pixel format to make it compatible with VNC Reflector, for
authorConstantin Kaplinsky <const@tightvnc.com>
Mon, 20 May 2002 13:10:44 +0000 (13:10 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Mon, 20 May 2002 13:10:44 +0000 (13:10 +0000)
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

index 76ee6b988073d6ce027c3c64ef472d1ae06d3330..2fe0f476335a5002b609bcbd7574646405387e64 100644 (file)
@@ -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();