Stupid copy+paste error in the ChangeLog entry. Heres the corrected one:
2005-10-10 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/JComponent.java
(rectCache): New field. Caches Rectangle objects for reuse.
(paintChildren): Changed to reuse cached Rectangle object.
/Roman
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.65
diff -u -r1.65 JComponent.java
--- javax/swing/JComponent.java 7 Oct 2005 11:21:41 -0000 1.65
+++ javax/swing/JComponent.java 10 Oct 2005 08:52:01 -0000
@@ -380,6 +380,13 @@
private TransferHandler transferHandler;
+ /**
+ * A cached Rectangle object to be reused. Be careful when you use that,
+ * so that it doesn't get modified in another context within the same
+ * method call chain.
+ */
+ private static transient Rectangle rectCache;
+
/**
* A lock held during recursive painting; this is used to serialize
* access to the double buffer, and also to select the "top level"
@@ -1514,7 +1521,7 @@
protected void paintChildren(Graphics g)
{
Shape originalClip = g.getClip();
- Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle());
+ Rectangle inner = SwingUtilities.calculateInnerArea(this, rectCache);
g.clipRect(inner.x, inner.y, inner.width, inner.height);
Component[] children = getComponents();
for (int i = children.length - 1; i >= 0; --i)
@@ -1522,18 +1529,17 @@
if (!children[i].isVisible())
continue;
- Rectangle bounds = children[i].getBounds();
+ Rectangle bounds = children[i].getBounds(rectCache);
Rectangle oldClip = g.getClipBounds();
if (oldClip == null)
oldClip = bounds;
- Rectangle clip = oldClip.intersection(bounds);
- if (clip.isEmpty())
+ if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
continue;
boolean translated = false;
try
{
- g.setClip(clip.x, clip.y, clip.width, clip.height);
+ g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.translate(bounds.x, bounds.y);
translated = true;
children[i].paint(g);
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches