summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2012-12-06 02:25:49 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2012-12-06 02:25:49 +0000
commitb03679610960d7250621b5f5c188208ef378eb8b (patch)
treeafd5bd0c572b689326c841d44f0320ba38ca1e8b
parent04628cde5684017d459c84c4c71634d7671c51de (diff)
downloadtigervnc-b03679610960d7250621b5f5c188208ef378eb8b.tar.gz
tigervnc-b03679610960d7250621b5f5c188208ef378eb8b.zip
fixed bug where IndexColorModel was reset when switching to 8bpp from another depth
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5016 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--java/com/tigervnc/rfb/PixelBuffer.java7
-rw-r--r--java/com/tigervnc/vncviewer/BIPixelBuffer.java2
2 files changed, 4 insertions, 5 deletions
diff --git a/java/com/tigervnc/rfb/PixelBuffer.java b/java/com/tigervnc/rfb/PixelBuffer.java
index 88b3a89e..4627318d 100644
--- a/java/com/tigervnc/rfb/PixelBuffer.java
+++ b/java/com/tigervnc/rfb/PixelBuffer.java
@@ -41,13 +41,12 @@ public class PixelBuffer {
case 6:
// Fall-through to depth 8
case 8:
+ if (cm != null && cm instanceof IndexColorModel)
+ break;
int rmask = pf.redMax << pf.redShift;
int gmask = pf.greenMax << pf.greenShift;
int bmask = pf.blueMax << pf.blueShift;
- if (pf.trueColour)
- cm = new DirectColorModel(8, rmask, gmask, bmask);
- else
- cm = new IndexColorModel(8, 256, new byte[256], new byte[256], new byte[256]);
+ cm = new DirectColorModel(8, rmask, gmask, bmask);
break;
case 16:
cm = new DirectColorModel(32, 0xF800, 0x07C0, 0x003E, (0xff << 24));
diff --git a/java/com/tigervnc/vncviewer/BIPixelBuffer.java b/java/com/tigervnc/vncviewer/BIPixelBuffer.java
index 6690c79f..ae38302c 100644
--- a/java/com/tigervnc/vncviewer/BIPixelBuffer.java
+++ b/java/com/tigervnc/vncviewer/BIPixelBuffer.java
@@ -38,7 +38,7 @@ public class BIPixelBuffer extends PlatformPixelBuffer implements ImageObserver
}
public void updateColourMap() {
- cm = new IndexColorModel(8, nColours, reds, greens, blues);
+ super.updateColourMap();
createImage(width_, height_);
}