[cp-patches] FYI: RepaintManager fixlet
This fixes a Mauve tests. Besides that it hasn't much impact as these methods aren't used in Swing itself. 2006-07-26 Roman Kennke [EMAIL PROTECTED] * javax/swing/RepaintManager.java (markCompletelyDirty): Add dirty region with Integer.MAX_VALUE for the component. (isCompletelyDirty): Consider a component completely dirty when it has a dirty region with Integer.MAX_VALUE. /Roman Index: javax/swing/RepaintManager.java === RCS file: /cvsroot/classpath/classpath/javax/swing/RepaintManager.java,v retrieving revision 1.42 diff -u -1 -2 -r1.42 RepaintManager.java --- javax/swing/RepaintManager.java 19 Jul 2006 19:37:18 - 1.42 +++ javax/swing/RepaintManager.java 26 Jul 2006 21:14:28 - @@ -453,26 +453,25 @@ * Mark a component as dirty over its entire bounds. * * @param component The component to mark as dirty * * @see #dirtyComponents * @see #addDirtyRegion * @see #getDirtyRegion * @see #isCompletelyDirty * @see #markCompletelyClean */ public void markCompletelyDirty(JComponent component) { -Rectangle r = component.getBounds(); -addDirtyRegion(component, 0, 0, r.width, r.height); +addDirtyRegion(component, 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE); } /** * Remove all dirty regions for a specified component * * @param component The component to mark as clean * * @see #dirtyComponents * @see #addDirtyRegion * @see #getDirtyRegion * @see #isCompletelyDirty * @see #markCompletelyDirty @@ -492,31 +491,29 @@ * @param component The component to check for complete dirtyness * * @return Whether the component is completely dirty * * @see #dirtyComponents * @see #addDirtyRegion * @see #getDirtyRegion * @see #isCompletelyDirty * @see #markCompletelyClean */ public boolean isCompletelyDirty(JComponent component) { -boolean retVal = false; -if (dirtyComponents.containsKey(component)) - { -Rectangle dirtyRegion = (Rectangle) dirtyComponents.get(component); -retVal = dirtyRegion.equals(SwingUtilities.getLocalBounds(component)); - } -return retVal; +boolean dirty = false; +Rectangle r = getDirtyRegion(component); +if(r.width == Integer.MAX_VALUE r.height == Integer.MAX_VALUE) + dirty = true; +return dirty; } /** * Validate all components which have been marked invalid in the [EMAIL PROTECTED] * #invalidComponents} vector. */ public void validateInvalidComponents() { // We don't use an iterator here because that would fail when there are // components invalidated during the validation of others, which happens // quite frequently. Instead we synchronize the access a little more. while (invalidComponents.size() 0)
[cp-patches] FYI: RepaintManager fixlet
This fixes a thinko of mine. 2006-06-15 Roman Kennke [EMAIL PROTECTED] PR 28037 * javax/swing/RepaintManager.java (blitBuffer): Substract coordinates the other way around. /Roman -- “Improvement makes straight roads, but the crooked roads, without Improvement, are roads of Genius.” - William Blake Index: javax/swing/RepaintManager.java === RCS file: /cvsroot/classpath/classpath/javax/swing/RepaintManager.java,v retrieving revision 1.39 diff -u -1 -0 -r1.39 RepaintManager.java --- javax/swing/RepaintManager.java 14 Jun 2006 16:11:57 - 1.39 +++ javax/swing/RepaintManager.java 15 Jun 2006 13:41:20 - @@ -704,21 +704,21 @@ { bufferRoot = SwingUtilities.getWindowAncestor(bufferRoot); SwingUtilities.convertRectangleToAncestor(root, rootRect, bufferRoot); } Graphics g = root.getGraphics(); Image buffer = (Image) offscreenBuffers.get(bufferRoot); // Make sure we have a sane clip at this point. g.clipRect(rootRect.x, rootRect.y, rootRect.width, rootRect.height); -g.drawImage(buffer, rootRect.x - bufferRect.x, rootRect.y - bufferRect.y, +g.drawImage(buffer, bufferRect.x - rootRect.x, bufferRect.y - rootRect.y, root); g.dispose(); } /** * Finds and returns the nearest heavyweight parent for the specified * component. If the component isn't contained inside a heavyweight parent, * this returns null. * signature.asc Description: Dies ist ein digital signierter Nachrichtenteil
[cp-patches] FYI: RepaintManager fixlet
In the RepaintManager we are using the Graphics.drawImage() method, that takes 11 parameters to paint a part of the buffer to a part of the screen. Looking at the native code this seems rather inefficient (there are 1-2 temporary images created there, a scaling is performed etc, which is all unnecessary). I replaced this by the simple 4-argument drawImage() call and let the clipping sort out the rest. 2006-03-27 Roman Kennke [EMAIL PROTECTED] * javax/swing/RepaintManager.java (commitBuffer): Use simple drawImage() method instead of the scaling version. /Roman -- “Improvement makes straight roads, but the crooked roads, without Improvement, are roads of Genius.” - William Blake Index: javax/swing/RepaintManager.java === RCS file: /cvsroot/classpath/classpath/javax/swing/RepaintManager.java,v retrieving revision 1.28 diff -u -1 -0 -r1.28 RepaintManager.java --- javax/swing/RepaintManager.java 3 Mar 2006 10:06:10 - 1.28 +++ javax/swing/RepaintManager.java 27 Mar 2006 14:54:08 - @@ -36,21 +36,20 @@ exception statement from your version. */ package javax.swing; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; -import java.awt.Window; import java.awt.image.VolatileImage; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; @@ -407,21 +406,20 @@ * @see #getDirtyRegion * @see #isCompletelyDirty * @see #markCompletelyClean * @see #markCompletelyDirty */ public void addDirtyRegion(JComponent component, int x, int y, int w, int h) { if (w = 0 || h = 0 || !component.isShowing()) return; - component.computeVisibleRect(rectCache); SwingUtilities.computeIntersection(x, y, w, h, rectCache); if (! rectCache.isEmpty()) { if (dirtyComponents.containsKey(component)) { SwingUtilities.computeUnion(rectCache.x, rectCache.y, rectCache.width, rectCache.height, (Rectangle) dirtyComponents.get(component)); @@ -656,22 +654,21 @@ //when a component is inside a JViewport, and the component has //a size that would reach beyond the window size. // 2. Graphics.drawImage() should not behave strange when trying //to draw regions outside the image. int bufferWidth = buffer.getWidth(root); int bufferHeight = buffer.getHeight(root); dx1 = Math.min(bufferWidth, dx1); dy1 = Math.min(bufferHeight, dy1); dx2 = Math.min(bufferWidth, dx2); dy2 = Math.min(bufferHeight, dy2); -g.drawImage(buffer, dx1, dy1, dx2, dy2, -dx1, dy1, dx2, dy2, root); +g.drawImage(buffer, 0, 0, root); g.dispose(); } // Otherwise queue this request up, until all the RepaintManager work // is done. else { if (commitRequests.containsKey(root)) SwingUtilities.computeUnion(area.x, area.y, area.width, area.height, (Rectangle) commitRequests.get(root)); signature.asc Description: Dies ist ein digital signierter Nachrichtenteil
[cp-patches] FYI: RepaintManager fixlet
In RepaintManager.addInvalidComponent we should really also consider the component itself and ask if it is a validateRoot. Up to now we started with the component's parent. 2006-02-22 Roman Kennke [EMAIL PROTECTED] * javax/swing/RepaintManager.java (addInvalidComponent): Also consider the component itself. /Roman Index: javax/swing/RepaintManager.java === RCS file: /cvsroot/classpath/classpath/javax/swing/RepaintManager.java,v retrieving revision 1.24 diff -u -r1.24 RepaintManager.java --- javax/swing/RepaintManager.java 13 Feb 2006 22:29:04 - 1.24 +++ javax/swing/RepaintManager.java 22 Feb 2006 09:51:06 - @@ -343,7 +343,7 @@ */ public void addInvalidComponent(JComponent component) { -Component ancestor = component.getParent(); +Component ancestor = component; while (ancestor != null (! (ancestor instanceof JComponent)