Commit cbb5e201 by Scott Gilbertson Committed by Scott Gilbertson

IntegerGraphicsState.java (getClip): Clone clip before returning, handle null clip.

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
parent 072b06f2
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
......
......@@ -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() {}
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment