From 479b18cd1a372eb4e36e737ee43f8fcedba5013e Mon Sep 17 00:00:00 2001 From: enikey Date: Fri, 19 Dec 2008 09:39:40 +0000 Subject: [PATCH] [Refactoring] All methods and members that were used by old tight decode code block is removed. VncCanvas is no more overrides imageUpdate method of ImageObserver interface. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3438 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- .../src/com/tightvnc/vncviewer/VncCanvas.java | 129 +----------------- 1 file changed, 1 insertion(+), 128 deletions(-) diff --git a/java/src/com/tightvnc/vncviewer/VncCanvas.java b/java/src/com/tightvnc/vncviewer/VncCanvas.java index 4aa8d0ab..8f450c77 100644 --- a/java/src/com/tightvnc/vncviewer/VncCanvas.java +++ b/java/src/com/tightvnc/vncviewer/VncCanvas.java @@ -108,16 +108,6 @@ class VncCanvas extends Canvas int zlibBufLen = 0; Inflater zlibInflater; - // Tight encoder's data. - final static int tightZlibBufferSize = 512; - Inflater[] tightInflaters; - - // Since JPEG images are loaded asynchronously, we have to remember - // their position in the framebuffer. Also, this jpegRect object is - // used for synchronization between the rfbThread and a JVM's thread - // which decodes and loads JPEG images. - Rectangle jpegRect; - // True if we process keyboard and mouse events. boolean inputEnabled; @@ -135,8 +125,6 @@ class VncCanvas extends Canvas rfb = viewer.rfb; scalingFactor = viewer.options.scalingFactor; - tightInflaters = new Inflater[4]; - cm8 = new DirectColorModel(8, 7, (7 << 3), (3 << 6)); cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF); @@ -261,31 +249,6 @@ class VncCanvas extends Canvas g.drawImage(memImage, 0, 0, scaledWidth, scaledHeight, null); } - // - // Override the ImageObserver interface method to handle drawing of - // JPEG-encoded data. - // - - public boolean imageUpdate(Image img, int infoflags, - int x, int y, int width, int height) { - if ((infoflags & (ALLBITS | ABORT)) == 0) { - return true; // We need more image data. - } else { - // If the whole image is available, draw it now. - if ((infoflags & ALLBITS) != 0) { - if (jpegRect != null) { - synchronized(jpegRect) { - memGraphics.drawImage(img, jpegRect.x, jpegRect.y, null); - scheduleRepaint(jpegRect.x, jpegRect.y, - jpegRect.width, jpegRect.height); - jpegRect.notify(); - } - } - } - return false; // All image data was processed. - } - } - // // Start/stop receiving mouse events. Keyboard events are received // even in view-only mode, because we want to map the 'r' key to the @@ -605,7 +568,7 @@ class VncCanvas extends Canvas break; case RfbProto.EncodingTight: if (tightDecoder != null) { - statNumRectsTight = tightDecoder.getNumJPEGRects(); + statNumRectsTightJPEG = tightDecoder.getNumJPEGRects(); } handleTightRect(rx, ry, rw, rh); break; @@ -1316,96 +1279,6 @@ class VncCanvas extends Canvas scheduleRepaint(x, y, w, h); } - // - // Decode 1bpp-encoded bi-color rectangle (8-bit and 24-bit versions). - // - - void decodeMonoData(int x, int y, int w, int h, byte[] src, byte[] palette) { - - int dx, dy, n; - int i = y * rfb.framebufferWidth + x; - int rowBytes = (w + 7) / 8; - byte b; - - for (dy = 0; dy < h; dy++) { - for (dx = 0; dx < w / 8; dx++) { - b = src[dy*rowBytes+dx]; - for (n = 7; n >= 0; n--) - pixels8[i++] = palette[b >> n & 1]; - } - for (n = 7; n >= 8 - w % 8; n--) { - pixels8[i++] = palette[src[dy*rowBytes+dx] >> n & 1]; - } - i += (rfb.framebufferWidth - w); - } - } - - void decodeMonoData(int x, int y, int w, int h, byte[] src, int[] palette) { - - int dx, dy, n; - int i = y * rfb.framebufferWidth + x; - int rowBytes = (w + 7) / 8; - byte b; - - for (dy = 0; dy < h; dy++) { - for (dx = 0; dx < w / 8; dx++) { - b = src[dy*rowBytes+dx]; - for (n = 7; n >= 0; n--) - pixels24[i++] = palette[b >> n & 1]; - } - for (n = 7; n >= 8 - w % 8; n--) { - pixels24[i++] = palette[src[dy*rowBytes+dx] >> n & 1]; - } - i += (rfb.framebufferWidth - w); - } - } - - // - // Decode data processed with the "Gradient" filter. - // - - void decodeGradientData (int x, int y, int w, int h, byte[] buf) { - - int dx, dy, c; - byte[] prevRow = new byte[w * 3]; - byte[] thisRow = new byte[w * 3]; - byte[] pix = new byte[3]; - int[] est = new int[3]; - - int offset = y * rfb.framebufferWidth + x; - - for (dy = 0; dy < h; dy++) { - - /* First pixel in a row */ - for (c = 0; c < 3; c++) { - pix[c] = (byte)(prevRow[c] + buf[dy * w * 3 + c]); - thisRow[c] = pix[c]; - } - pixels24[offset++] = - (pix[0] & 0xFF) << 16 | (pix[1] & 0xFF) << 8 | (pix[2] & 0xFF); - - /* Remaining pixels of a row */ - for (dx = 1; dx < w; dx++) { - for (c = 0; c < 3; c++) { - est[c] = ((prevRow[dx * 3 + c] & 0xFF) + (pix[c] & 0xFF) - - (prevRow[(dx-1) * 3 + c] & 0xFF)); - if (est[c] > 0xFF) { - est[c] = 0xFF; - } else if (est[c] < 0x00) { - est[c] = 0x00; - } - pix[c] = (byte)(est[c] + buf[(dy * w + dx) * 3 + c]); - thisRow[dx * 3 + c] = pix[c]; - } - pixels24[offset++] = - (pix[0] & 0xFF) << 16 | (pix[1] & 0xFF) << 8 | (pix[2] & 0xFF); - } - - System.arraycopy(thisRow, 0, prevRow, 0, w * 3); - offset += (rfb.framebufferWidth - w); - } - } - // // Display newly updated area of pixels. // -- 2.39.5