IntegerGraphicsState.java (getClip): Clone clip before returning, handle null clip.
authorScott Gilbertson <scottg@mantatest.com>
Thu, 23 Feb 2006 20:50:49 +0000 (20:50 +0000)
committerScott Gilbertson <sgilbertson@gcc.gnu.org>
Thu, 23 Feb 2006 20:50:49 +0000 (20:50 +0000)
2006-02-23  Scott Gilbertson  <scottg@mantatest.com>

* gnu/awt/j2d/IntegerGraphicsState.java (getClip): Clone clip
before returning, handle null clip.
(getClipBounds): Handle null clip.
* gnu/awt/j2d/Graphics2DImpl.java (clipRect): Handle null clip.
* gnu/awt/xlib/XCanvasPeer.java ():
(getLocationOnScreen): Implement.
* classpath/gnu/java/awt/peer/GLightweightPeer.java
(repaint): Merged with Classpath.
* classpath/java/awt/Graphics.java (hitClip): Merged with
Classpath.

From-SVN: r111395

libjava/ChangeLog
libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
libjava/classpath/java/awt/Graphics.java
libjava/gnu/awt/j2d/Graphics2DImpl.java
libjava/gnu/awt/j2d/IntegerGraphicsState.java
libjava/gnu/awt/xlib/XCanvasPeer.java

index d96d0316a4105141ce4f6d627145fdbee2539b69..6804217ce4fceb5f44f2a10becb6f4a3cf10d682 100644 (file)
@@ -1,3 +1,16 @@
+2006-02-23  Scott Gilbertson  <scottg@mantatest.com>
+
+       * gnu/awt/j2d/IntegerGraphicsState.java (getClip): Clone clip
+       before returning, handle null clip.
+       (getClipBounds): Handle null clip.
+       * gnu/awt/j2d/Graphics2DImpl.java (clipRect): Handle null clip.
+       * gnu/awt/xlib/XCanvasPeer.java (): 
+       (getLocationOnScreen): Implement.
+       * classpath/gnu/java/awt/peer/GLightweightPeer.java
+       (repaint): Merged with Classpath.
+       * classpath/java/awt/Graphics.java (hitClip): Merged with
+       Classpath.
+
 2006-02-21  Robert Schuster  <robertschuster@fsfe.org>
 
        * link.cc: Added variant of create_error_method that
index 5252e80f1e05a03a27947dd908c069d793d2a0ae..25735bb745ff7ca62d9f4069fc6b4c0dec33294f 100644 (file)
@@ -227,7 +227,12 @@ public class GLightweightPeer
 
   public void print(Graphics graphics) {}
 
-  public void repaint(long tm, int x, int y, int width, int height) {}
+  public void repaint(long tm, int x, int y, int width, int height)
+  {
+    Component p = comp.getParent ();
+    if(p != null)
+      p.repaint(tm,x+comp.getX(),y+comp.getY(),width,height);
+  }
 
   public void requestFocus() {}
 
index a28ca7e428c84420693acdde4d56ca91bc061df0..09bf7cacffad9076d3c72c58b46372e33a421cdc 100644 (file)
@@ -617,6 +617,9 @@ public abstract class Graphics
    */
   public boolean hitClip(int x, int y, int width, int height)
   {
+    Shape clip = getClip();
+    if (clip == null)
+      return true;
     return getClip().intersects(x, y, width, height);
   }
 
index dd46e7fe410f3e9e178eec4f6da713cfe43ef5e9..5091af69f690b5fae7a9fb0de7f2371cbf5eefc9 100644 (file)
@@ -175,6 +175,12 @@ public class Graphics2DImpl extends Graphics2D implements Cloneable
   public void clipRect(int x, int y, int width, int height)
   {
     Shape clip = state.getClip();
+    if (clip == null)
+    {
+      clip = new Rectangle (x,y,width,height);
+      setClip (clip);
+      return;
+    }
     if (clip instanceof Rectangle)
       {
        Rectangle clipRect = (Rectangle) clip;
index 4eb4c6182b12c94b6a38471c6181636b5d5e30e3..bcfacd008f068637a7fd45d8d8ebfd6f336d21b4 100644 (file)
@@ -132,9 +132,11 @@ public class IntegerGraphicsState extends AbstractGraphicsState
 
   public Shape getClip()
   {
+    if (clip == null)
+      return null;
     if (clip instanceof Rectangle)
       {
-       Rectangle clipRect = (Rectangle) clip;
+       Rectangle clipRect = (Rectangle) ((Rectangle) clip).clone();
        clipRect.x -= tx;
        clipRect.y -= ty;
        return clipRect;
@@ -149,6 +151,8 @@ public class IntegerGraphicsState extends AbstractGraphicsState
 
   public Rectangle getClipBounds()
   {
+    if (clip == null)
+      return null;
     Rectangle clipRect = clip.getBounds();
     
     clipRect.x -= tx;
index 74e0dc2121271dbf7cf541fc80342b1e63769192..097ad0e47d26e92fcb69a61c6301309d93402878 100644 (file)
@@ -247,10 +247,12 @@ public class XCanvasPeer implements CanvasPeer
     gfx2d.setColor(component.getBackground());
     return gfx2d;
   }
-    
+
+  private Rectangle locationBounds;
   public Point getLocationOnScreen()
   {
-    throw new UnsupportedOperationException("FIXME, not implemented");
+    locationBounds = window.getBounds (locationBounds);
+    return new Point (locationBounds.x,locationBounds.y);
   }
 
   public Dimension getMinimumSize ()