Index: gnu/java/awt/ClasspathToolkit.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/ClasspathToolkit.java,v retrieving revision 1.12 diff -U3 -r1.12 ClasspathToolkit.java --- gnu/java/awt/ClasspathToolkit.java 4 Jul 2005 22:31:41 -0000 1.12 +++ gnu/java/awt/ClasspathToolkit.java 14 Aug 2005 20:24:25 -0000 @@ -92,14 +92,6 @@ extends Toolkit { /** - * A map from URLs to previously loaded images, used by address@hidden - * #getImage(java.net.URL)}. For images that were loaded via a path - * to an image file, the map contains a key with a file URL. - */ - private HashMap imageCache; - - - /** * Returns a shared instance of the local, platform-specific * graphics environment. * @@ -109,59 +101,6 @@ */ public abstract GraphicsEnvironment getLocalGraphicsEnvironment(); - - /** - * Determines the current size of the default, primary screen. - * - * @throws HeadlessException if the local graphics environment is - * headless, which means that no screen is attached and no user - * interaction is allowed. - */ - public Dimension getScreenSize() - { - DisplayMode mode; - - // getDefaultScreenDevice throws HeadlessException if the - // local graphics environment is headless. - mode = GraphicsEnvironment.getLocalGraphicsEnvironment() - .getDefaultScreenDevice().getDisplayMode(); - - return new Dimension(mode.getWidth(), mode.getHeight()); - } - - - /** - * Determines the current color model of the default, primary - * screen. - * - * @see GraphicsEnvironment#getDefaultScreenDevice() - * @see java.awt.GraphicsDevice#getDefaultConfiguration() - * @see java.awt.GraphicsConfiguration#getColorModel() - * - * @throws HeadlessException if the local graphics environment is - * headless, which means that no screen is attached and no user - * interaction is allowed. - */ - public ColorModel getColorModel() - { - // getDefaultScreenDevice throws HeadlessException if the - // local graphics environment is headless. - return GraphicsEnvironment.getLocalGraphicsEnvironment() - .getDefaultScreenDevice().getDefaultConfiguration() - .getColorModel(); - } - - /** - * Retrieves the metrics for rendering a font on the screen. - * - * @param font the font whose metrics are requested. - */ - public FontMetrics getFontMetrics(Font font) - { - return ((ClasspathFontPeer) font.getPeer ()).getFontMetrics (font); - } - - /** * Acquires an appropriate address@hidden ClasspathFontPeer}, for use in * classpath's implementation of address@hidden java.awt.Font}. @@ -185,8 +124,8 @@ * Creates a address@hidden Font}, in a platform-specific manner. * * The default implementation simply constructs a address@hidden Font}, but some - * toolkits may wish to override this, to return address@hidden Font} subclasses which - * implement address@hidden java.awt.font.OpenType} or + * toolkits may wish to override this, to return address@hidden Font} subclasses + * which implement address@hidden java.awt.font.OpenType} or * address@hidden java.awt.font.MultipleMaster}. */ public Font getFont (String name, Map attrs) @@ -194,7 +133,6 @@ return new Font (name, attrs); } - /** * Creates a font, reading the glyph definitions from a stream. * @@ -223,137 +161,6 @@ */ public abstract Font createFont(int format, InputStream stream); - - /** - * Returns an image from the specified file, which must be in a - * recognized format. The set of recognized image formats may vary - * from toolkit to toolkit. - * - *

This method maintains a cache for images. If an image has been - * loaded from the same path before, the cached copy will be - * returned. The implementation may hold cached copies for an - * indefinite time, which can consume substantial resources with - * large images. Users are therefore advised to use address@hidden - * #createImage(java.lang.String)} instead. - * - *

The default implementation creates a file URL for the - * specified path and invokes address@hidden #getImage(URL)}. - * - * @param path A path to the image file. - * - * @return IllegalArgumentException if path does not - * designate a valid path. - */ - public Image getImage(String path) - { - try - { - return getImage(new File(path).toURL()); - } - catch (MalformedURLException muex) - { - throw (IllegalArgumentException) new IllegalArgumentException(path) - .initCause(muex); - } - } - - - /** - * Loads an image from the specified URL. The image data must be in - * a recognized format. The set of recognized image formats may vary - * from toolkit to toolkit. - * - *

This method maintains a cache for images. If an image has been - * loaded from the same URL before, the cached copy will be - * returned. The implementation may hold cached copies for an - * indefinite time, which can consume substantial resources with - * large images. Users are therefore advised to use address@hidden - * #createImage(java.net.URL)} instead. - * - * @param url the URL from where the image is read. - */ - public Image getImage(URL url) - { - Image result; - - synchronized (this) - { - // Many applications never call getImage. Therefore, we lazily - // create the image cache when it is actually needed. - if (imageCache == null) - imageCache = new HashMap(); - else - { - result = (Image) imageCache.get(url); - if (result != null) - return result; - } - - // The createImage(URL) method, which is specified by - // java.awt.Toolkit, is not implemented by this abstract class - // because it is platform-dependent. Once Classpath has support - // for the javax.imageio package, it might be worth considering - // that toolkits provide native stream readers. Then, the class - // ClasspathToolkit could provide a general implementation that - // delegates the image format parsing to javax.imageio. - result = createImage(url); - - // It is not clear whether it would be a good idea to use weak - // references here. The advantage would be reduced memory - // consumption, since loaded images would not be kept - // forever. But on VMs that frequently perform garbage - // collection (which includes VMs with a parallel or incremental - // collector), the image might frequently need to be re-loaded, - // possibly over a slow network connection. - imageCache.put(url, result); - - return result; - } - } - - - /** - * Returns an image from the specified file, which must be in a - * recognized format. The set of recognized image formats may vary - * from toolkit to toolkit. - * - *

A new image is created every time this method gets called, - * even if the same path has been passed before. - * - *

The default implementation creates a file URL for the - * specified path and invokes address@hidden #createImage(URL)}. - * - * @param path A path to the file to be read in. - */ - public Image createImage(String path) - { - try - { - // The abstract method createImage(URL) is defined by - // java.awt.Toolkit, but intentionally not implemented by - // ClasspathToolkit because it is platform specific. - return createImage(new File(path).toURL()); - } - catch (MalformedURLException muex) - { - throw (IllegalArgumentException) new IllegalArgumentException(path) - .initCause(muex); - } - } - - /** - * Creates an ImageProducer from the specified URL. The image is assumed - * to be in a recognised format. If the toolkit does not implement the - * image format or the image format is not recognised, null is returned. - * This default implementation is overriden by the Toolkit implementations. - * - * @param url URL to read image data from. - */ - public ImageProducer createImageProducer(URL url) - { - return null; - } - public abstract RobotPeer createRobot (GraphicsDevice screen) throws AWTException; @@ -365,15 +172,8 @@ */ public abstract EmbeddedWindowPeer createEmbeddedWindow (EmbeddedWindow w); - /** - * Used to register ImageIO SPIs provided by the toolkit. - */ - - public void registerImageIOSpis(IIORegistry reg) - { - } - public abstract boolean nativeQueueEmpty(); public abstract void wakeNativeQueue(); public abstract void iterateNativeQueue(EventQueue locked, boolean block); } + Index: gnu/java/awt/peer/gtk/GtkToolkit.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.71 diff -U3 -r1.71 GtkToolkit.java --- gnu/java/awt/peer/gtk/GtkToolkit.java 4 Jul 2005 22:31:41 -0000 1.71 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 14 Aug 2005 20:24:25 -0000 @@ -121,6 +121,9 @@ portableNativeSync = 0; // false gtkInit(portableNativeSync); + + // Register ImageIO SPIs + GdkPixbufDecoder.registerSpis( IIORegistry.getDefaultInstance() ); } public GtkToolkit () @@ -639,11 +642,6 @@ public RobotPeer createRobot (GraphicsDevice screen) throws AWTException { return new GdkRobotPeer (screen); - } - - public void registerImageIOSpis(IIORegistry reg) - { - GdkPixbufDecoder.registerSpis(reg); } public native boolean nativeQueueEmpty(); Index: javax/imageio/spi/IIORegistry.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/imageio/spi/IIORegistry.java,v retrieving revision 1.6 diff -U3 -r1.6 IIORegistry.java --- javax/imageio/spi/IIORegistry.java 2 Jul 2005 20:32:45 -0000 1.6 +++ javax/imageio/spi/IIORegistry.java 14 Aug 2005 20:24:26 -0000 @@ -39,7 +39,6 @@ package javax.imageio.spi; import gnu.classpath.ServiceFactory; -import gnu.java.awt.ClasspathToolkit; import java.awt.Toolkit; import java.util.HashMap; @@ -82,8 +81,6 @@ // XXX: Register built-in Spis here. Toolkit toolkit = Toolkit.getDefaultToolkit(); - if (toolkit instanceof ClasspathToolkit) - ((ClasspathToolkit)toolkit).registerImageIOSpis(this); registerApplicationClasspathSpis(); }