From: enikey Date: Fri, 19 Dec 2008 04:54:49 +0000 (+0000) Subject: [Developement] Added protected getColorModel8, getColorModel24, getColor256 methods... X-Git-Tag: v0.0.90~272 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b3e19f79964c3ea2dfdd465fcf46c042bbb035f2;p=tigervnc.git [Developement] Added protected getColorModel8, getColorModel24, getColor256 methods to access private static members (cm8, cm24, color256). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3412 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/java/src/com/tightvnc/decoder/RawDecoder.java b/java/src/com/tightvnc/decoder/RawDecoder.java index 46d22f7f..8272d3b4 100644 --- a/java/src/com/tightvnc/decoder/RawDecoder.java +++ b/java/src/com/tightvnc/decoder/RawDecoder.java @@ -9,11 +9,17 @@ import java.awt.image.DirectColorModel; import java.awt.image.MemoryImageSource; import java.awt.Color; +// +// This is base decoder class. +// Other classes will be childs of RawDecoder. +// public class RawDecoder { public RawDecoder(Graphics g, RfbInputStream is) { setGraphics(g); setRfbInputStream(is); + // FIXME: cm24 created in getColorModel24. + // Remove if no bugs cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF); } @@ -22,6 +28,8 @@ public class RawDecoder { setGraphics(g); setRfbInputStream(is); setFrameBufferSize(frameBufferW, frameBufferH); + // FIXME: cm24 created in getColorModel24. + // Remove if no bugs cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF); } @@ -37,6 +45,10 @@ public class RawDecoder { bytesPerPixel = bpp; } + // + // FIXME: This method may be useless in future, remove if so + // + public int getBPP() { return bytesPerPixel; } @@ -46,6 +58,36 @@ public class RawDecoder { framebufferHeight = h; } + // + // Private static members access methdos + // + + protected ColorModel getColorModel8() { + if (cm8 == null) { + cm8 = cm8 = new DirectColorModel(8, 7, (7 << 3), (3 << 6)); + } + return cm8; + } + + protected ColorModel getColorModel24() { + if (cm24 == null) { + cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF); + } + return cm24; + } + + protected Color[]getColor256() { + if (color256 == null) { + color256 = new Color[256]; + for (int i = 0; i < 256; i++) + color256[i] = new Color(cm8.getRGB(i)); + } + return color256; + } + + // + // Unique data for every decoder (? maybe not ?) + // protected int bytesPerPixel = 4; protected int framebufferWidth = 0; protected int framebufferHeight = 0; @@ -53,11 +95,17 @@ public class RawDecoder { protected Graphics graphics = null; protected RecordInterface rec = null; + // + // This data must be shared between decoders + // protected static byte []pixels8 = null; protected static int []pixels24 = null; protected static MemoryImageSource pixelsSource = null; protected static Image rawPixelsImage = null; + // + // Access to this static members only though protected methods + // private static ColorModel cm8 = null; private static ColorModel cm24 = null; private static Color []color256 = null;