From: Brian Hinz Date: Sun, 26 Aug 2012 18:22:24 +0000 (+0000) Subject: Remove the AWTPixelBuffer class. After switching to using rasters in BIPixelBuffer... X-Git-Tag: v1.2.90~124 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e43140a66affcffd2df0778c64fb3e362411a72;p=tigervnc.git Remove the AWTPixelBuffer class. After switching to using rasters in BIPixelBuffer, we can no longer find a case in which AWTPixelBuffer performs faster. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4961 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/java/com/tigervnc/vncviewer/AWTPixelBuffer.java b/java/com/tigervnc/vncviewer/AWTPixelBuffer.java deleted file mode 100644 index 3b7ebbd0..00000000 --- a/java/com/tigervnc/vncviewer/AWTPixelBuffer.java +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (C) 2012 Brian P. Hinz - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -package com.tigervnc.vncviewer; - -import java.awt.*; -import java.awt.image.*; - -import com.tigervnc.rfb.*; -import com.tigervnc.rfb.Exception; - -public class AWTPixelBuffer extends PlatformPixelBuffer -{ - public AWTPixelBuffer(int w, int h, CConn cc_, DesktopWindow desktop_) { - super(w, h, cc_, desktop_); - } - - public void setPF(PixelFormat pf) { - super.setPF(pf); - if (source != null) - source.newPixels(data, cm, 0, width_); - } - - public void updateColourMap() { - cm = new IndexColorModel(8, nColours, reds, greens, blues); - if (source != null) - source.newPixels(data, cm, 0, width_); - } - - // resize() resizes the image, preserving the image data where possible. - public void resize(int w, int h) { - if (w == width() && h == height()) return; - - int rowsToCopy = h < height() ? h : height(); - int copyWidth = w < width() ? w : width(); - int[] oldData = data; - - width_ = w; - height_ = h; - - data = new int[width() * height()]; - for (int i = 0; i < rowsToCopy; i++) - System.arraycopy(oldData, copyWidth * i, - data, width_ * i, copyWidth); - - source = new MemoryImageSource(w, h, cm, data, 0, w); - source.setAnimated(true); - source.setFullBufferUpdates(false); - image = desktop.createImage(source); - source.newPixels(data, cm, 0, width_); - } - - public void fillRect(int x, int y, int w, int h, int pix) { - super.fillRect(x, y, w, h, pix); - source.newPixels(x, y, w, h, true); - } - - public void imageRect(int x, int y, int w, int h, Object pix) { - if (pix instanceof Image) { - PixelGrabber pg = - new PixelGrabber((Image)pix, 0, 0, w, h, data, (width_ * y) + x, width_); - try { - pg.grabPixels(0); - } catch (InterruptedException e) { - vlog.error("Tight Decoding: Wrong JPEG data recieved"); - } - } else { - for (int j = 0; j < h; j++) - System.arraycopy(pix, (w*j), data, width_ * (y + j) + x, w); - } - source.newPixels(x, y, w, h, true); - } - - public void copyRect(int x, int y, int w, int h, int srcX, int srcY) { - super.copyRect(x, y, w, h, srcX, srcY); - source.newPixels(x, y, w, h, true); - } - - public Image getImage() { - return (Image)image; - } - - Image image; - MemoryImageSource source; - - static LogWriter vlog = new LogWriter("AWTPixelBuffer"); -} diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java index 27d1dce7..bc73143e 100644 --- a/java/com/tigervnc/vncviewer/DesktopWindow.java +++ b/java/com/tigervnc/vncviewer/DesktopWindow.java @@ -66,11 +66,10 @@ class DesktopWindow extends JPanel implements if (bufCaps.isPageFlipping() || bufCaps.isMultiBufferAvailable() || imgCaps.isAccelerated()) { vlog.debug("GraphicsDevice supports HW acceleration."); - im = new BIPixelBuffer(width, height, cc, this); } else { vlog.debug("GraphicsDevice does not support HW acceleration."); - im = new AWTPixelBuffer(width, height, cc, this); } + im = new BIPixelBuffer(width, height, cc, this); cursor = new Cursor(); cursorBacking = new ManagedPixelBuffer();