Hi, 
Here's for review. This, I hope, should fix some bugs related to
ImageObserver. On doing a Graphics.drawImage() the observer gets too
many imageUpdate() calls, and this causes too many repaints when the
ImageObserver in question is a Component.


2005-03-24  Sven de Marothy  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/GdkGraphics.java:
        (drawImage): Don't notify the image observer for offscreen images.
        * gnu/java/awt/peer/gtk/GtkImagePainter.java:
        (setPixels): Don't notify the image observer if all
        pixels are set at once.

Index: gnu/java/awt/peer/gtk/GdkGraphics.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java,v
retrieving revision 1.37
diff -u -r1.37 GdkGraphics.java
--- gnu/java/awt/peer/gtk/GdkGraphics.java	16 Feb 2005 13:59:03 -0000	1.37
+++ gnu/java/awt/peer/gtk/GdkGraphics.java	23 Mar 2005 22:52:42 -0000
@@ -147,11 +147,6 @@
         int height = img.getHeight (null);
 	copyPixmap (img.getGraphics (), 
 		    x, y, width, height);
-        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
-        if (observer != null)
-          observer.imageUpdate (img,
-                                ImageObserver.FRAMEBITS,
-                                x, y, width, height);
 	return true;
       }
 
@@ -171,12 +166,6 @@
         int height = img.getHeight (null);
 	copyPixmap (img.getGraphics (), 
 		    x, y, width, height);
-
-        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
-        if (observer != null)
-          observer.imageUpdate (img,
-                                ImageObserver.FRAMEBITS,
-                                x, y, width, height);
 	return true;
       }
 
@@ -197,11 +186,6 @@
         copyAndScalePixmap (img.getGraphics (), false, false,
                             0, 0, img.getWidth (null), img.getHeight (null), 
                             x, y, width, height);
-        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
-        if (observer != null)
-          observer.imageUpdate (img,
-                                ImageObserver.FRAMEBITS,
-                                x, y, width, height);
         return true;
       }
 
@@ -286,12 +270,6 @@
         copyAndScalePixmap (img.getGraphics (), x_flip, y_flip,
                             sx_start, sy_start, s_width, s_height, 
                             dx_start, dy_start, d_width, d_height);
-
-        // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
-        if (observer != null)
-          observer.imageUpdate (img,
-                                ImageObserver.FRAMEBITS,
-                                dx_start, dy_start, d_width, d_height);
         return true;
       }
 
Index: gnu/java/awt/peer/gtk/GtkImagePainter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkImagePainter.java,v
retrieving revision 1.12
diff -u -r1.12 GtkImagePainter.java
--- gnu/java/awt/peer/gtk/GtkImagePainter.java	1 Dec 2004 16:22:44 -0000	1.12
+++ gnu/java/awt/peer/gtk/GtkImagePainter.java	23 Mar 2005 22:52:42 -0000
@@ -185,7 +185,7 @@
 		width, height, convertPixels (pixels, model), offset,
 		scansize, affine);
 
-    if (observer != null)
+    if (observer != null && (height*scansize) < pixels.length)
       observer.imageUpdate (image,
 			    ImageObserver.SOMEBITS,
 			    x, y, width, height);
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to