From 9e9e204234b883d783914aa909e96c57d45ac081 Mon Sep 17 00:00:00 2001 From: Scott Gilbertson Date: Sat, 19 Apr 2003 19:54:39 +0000 Subject: XGraphics.java (XGraphics): Use new GC.create. 2003-04-19 Scott Gilbertson * gnu/awt/xlib/XGraphics.java (XGraphics): Use new GC.create. (dispose): Null metrics. * gnu/awt/xlib/XToolkit.java (sync): Implement. * gnu/gcj/xlib/Clip.java (dispose): Change name of native from finalize. (finalize): Call dispose. * gnu/gcj/xlib/Drawable.java (gcCache): New field. (gcCachedCount): New field. (finalize): New method. (putGCInCache): New method. (getGCFromCache): New method. * gnu/gcj/xlib/GC.java (GC): Make protected. (clone): Get new GC from cache if possible. (create): New static method. (dispose): Save old GC in cache. * gnu/gcj/xlib/natClip.cc (dispose): Check for null before deleting. * gnu/gcj/xlib/natGC.cc (initStructure): Call XCreateGC only if gc is null. * gnu/gcj/xlib/Pixmap.java (Pixmap): Use new GC.create. * java/awt/Container.java (visitChild): Dispose gfx2 when finished. From-SVN: r65827 --- libjava/java/awt/Container.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libjava/java') diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java index caffc50..9ef6add 100644 --- a/libjava/java/awt/Container.java +++ b/libjava/java/awt/Container.java @@ -1,5 +1,5 @@ /* Container.java -- parent container class in AWT - Copyright (C) 1999, 2000, 2002 Free Software Foundation + Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation This file is part of GNU Classpath. @@ -1205,10 +1205,17 @@ public class Container extends Component if (clip.isEmpty()) return; Graphics gfx2 = gfx.create(); - gfx2.setClip(clip.x, clip.y, clip.width, clip.height); - gfx2.translate(bounds.x, bounds.y); + try + { + gfx2.setClip(clip.x, clip.y, clip.width, clip.height); + gfx2.translate(bounds.x, bounds.y); - visitor.visit(comp, gfx2); + visitor.visit(comp, gfx2); + } + finally + { + gfx2.dispose (); + } } void dispatchEventImpl(AWTEvent e) -- cgit v1.1