This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: fix GtkToolkit's image-loading functions
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: libgcj patches <java-patches at gcc dot gnu dot org>
- Date: Fri, 23 Jan 2004 14:05:35 -0500
- Subject: Patch: fix GtkToolkit's image-loading functions
Hello,
This patch fixes some problems that were preventing GtkToolkit from
loading images in the absence of a MediaTracker.
OK to commit?
Tom
2004-01-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkToolkit.java (checkImage): Inform
image observer of image loading status.
(getImage (String)): Start image production.
(getImage (URL)): Likewise.
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.7
diff -u -r1.7 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java 10 Jan 2004 21:32:23 -0000 1.7
+++ gnu/java/awt/peer/gtk/GtkToolkit.java 23 Jan 2004 18:28:34 -0000
@@ -115,7 +115,15 @@
public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
- return ((GtkImage) image).checkImage ();
+ int status = ((GtkImage) image).checkImage ();
+
+ if (observer != null)
+ observer.imageUpdate (image, status,
+ -1, -1,
+ image.getWidth (observer),
+ image.getHeight (observer));
+
+ return status;
}
public Image createImage (String filename)
@@ -166,12 +174,18 @@
public Image getImage (String filename)
{
- return new GtkImage (new GdkPixbufDecoder (filename), null);
+ GdkPixbufDecoder d = new GdkPixbufDecoder (filename);
+ GtkImage image = new GtkImage (d, null);
+ d.startProduction (image);
+ return image;
}
public Image getImage (URL url)
{
- return new GtkImage (new GdkPixbufDecoder (url), null);
+ GdkPixbufDecoder d = new GdkPixbufDecoder (url);
+ GtkImage image = new GtkImage (d, null);
+ d.startProduction (image);
+ return image;
}
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)