This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] [PATCH] GtkImagePainter fixes


Hello,

I'm committing the following patch to the java-gui-branch.  It fixes two
small things in GtkImagePainter.

-David Jee

2004-05-05  David Jee  <djee@redhat.com>

        * gnu/java/awt/peer/gtk/GtkImagePainter.java
        (convertPixels): If either pixels or model is null, return null.
        * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
        (Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels): If jpixels
        is null, do nothing and return.


Index: gnu/java/awt/peer/gtk/GtkImagePainter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java,v
retrieving revision 1.2
diff -u -r1.2 GtkImagePainter.java
--- gnu/java/awt/peer/gtk/GtkImagePainter.java	13 Jul 2003 15:09:20 -0000	1.2
+++ gnu/java/awt/peer/gtk/GtkImagePainter.java	5 May 2004 18:32:24 -0000
@@ -119,6 +119,11 @@
   static int[] 
   convertPixels (int[] pixels, ColorModel model)
   {
+    if (pixels == null || model == null)
+    {
+      return null;
+    }
+
     if (model.equals (ColorModel.getRGBdefault ()))
       return pixels;
     
@@ -133,6 +138,11 @@
   static int[]
   convertPixels (byte[] pixels, ColorModel model)
   {
+    if (pixels == null || model == null)
+    {
+      return null;
+    }
+
     int ret[] = new int[pixels.length];
 
     for (int i = 0; i < pixels.length; i++)
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,v
retrieving revision 1.2
diff -u -r1.2 gnu_java_awt_peer_gtk_GtkImagePainter.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c	8 Oct 2003 15:49:33 -0000	1.2
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c	5 May 2004 18:32:26 -0000
@@ -58,6 +58,9 @@
 
   g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
 
+  if (!jpixels)
+    return;
+
   elems = (*env)->GetIntArrayElements (env, jpixels, NULL);
   num_pixels = (*env)->GetArrayLength (env, jpixels);
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]