I tried the Swing demo vs. Java2D (Cairo). This gave me some NPEs that are fixed by this patch. It adds a check in GdkGraphics2D.getClipBounds() so it does not throw an NPE when accessing a null clip and it adds a check in JComponent.paint() so when a null clip is encountered it sets the clip to the componenents bounds. 2005-09-24 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/JComponent.java
(paint): Check if clip == null and if so set it to the
component's
bounds.
* gnu/java/awt/peer/gtk/GdkGraphics2D.java
(getClipBounds): Added null check so that null is returned when
clip == null, instead of throwing an NPE while accessing
null.getBounds2D().
/Roman
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.60
diff -u -r1.60 JComponent.java
--- javax/swing/JComponent.java 24 Sep 2005 20:40:21 -0000 1.60
+++ javax/swing/JComponent.java 24 Sep 2005 21:58:45 -0000
@@ -1469,6 +1469,8 @@
paintDoubleBuffered(g);
else
{
+ if (g.getClip() == null)
+ g.setClip(0, 0, getWidth(), getHeight());
paintComponent(g);
paintBorder(g);
paintChildren(g);
Index: gnu/java/awt/peer/gtk/GdkGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java,v
retrieving revision 1.49
diff -u -r1.49 GdkGraphics2D.java
--- gnu/java/awt/peer/gtk/GdkGraphics2D.java 23 Sep 2005 21:36:42 -0000 1.49
+++ gnu/java/awt/peer/gtk/GdkGraphics2D.java 24 Sep 2005 21:58:47 -0000
@@ -966,7 +966,10 @@
public Shape getClip()
{
- return clip.getBounds2D(); //getClipInDevSpace();
+ if (clip == null)
+ return null;
+ else
+ return clip.getBounds2D(); //getClipInDevSpace();
}
public Rectangle getClipBounds()
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Classpath-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath-patches
