In the RepaintManager we used to merge regions of different components
to one when blitting the buffer on the screen. However, this proves to
cause painting artifacts. This happens when different distinct regions
of the screen get updated simultanously (especially when using Timers
and/or multiple Threads). Then these (possibly small) regions get merged
and all the area between them gets blitted to screen too, even if it
contains garbage (like, when some component has been removed in that
area). This is what happened to some apps on my box.

I disabled this feature and might need to rework it, or remove it. Gotta
make up my mind about this.

2006-06-14  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/RepaintManager.java
        (MERGE_REGIONS): New constant flag.
        (commitBuffer): Exclude the merging of regions by default. This
        was causing painting artifacts in some applications, especially
        when different areas of the GUI are updated synchronously.

/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.38
diff -u -1 -0 -r1.38 RepaintManager.java
--- javax/swing/RepaintManager.java	14 Jun 2006 11:01:25 -0000	1.38
+++ javax/swing/RepaintManager.java	14 Jun 2006 16:06:28 -0000
@@ -31,21 +31,20 @@
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package javax.swing;
 
-import java.applet.Applet;
 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.HashMap;
 import java.util.HashSet;
@@ -71,20 +70,26 @@
  * @author Audrius Meskauskas ([EMAIL PROTECTED])
  */
 public class RepaintManager
 {
   /**
    * The current repaint managers, indexed by their ThreadGroups.
    */
   static WeakHashMap currentRepaintManagers;
 
   /**
+   * Used to disable merging of regions in commitBuffer(). This has caused
+   * problems and may either need to be reworked or removed.
+   */
+  private static final boolean MERGE_REGIONS = false;
+
+  /**
    * A rectangle object to be reused in damaged regions calculation.
    */
   private static Rectangle rectCache = new Rectangle();
 
   /**
    * <p>A helper class which is placed into the system event queue at
    * various times in order to facilitate repainting and layout. There is
    * typically only one of these objects active at any time. When the
    * [EMAIL PROTECTED] RepaintManager} is told to queue a repaint, it checks to see if
    * a [EMAIL PROTECTED] RepaintWorker} is "live" in the system event queue, and if
@@ -654,21 +659,21 @@
     Component root = getHeavyweightParent(comp);
     // FIXME: Optimize this.
     Rectangle rootRect = SwingUtilities.convertRectangle(comp, area, root);
 
     // We synchronize on dirtyComponents here because that is what
     // paintDirtyRegions also synchronizes on while painting.
     synchronized (dirtyComponents)
       {
         // If the RepaintManager is not currently painting, then directly
         // blit the requested buffer on the screen.
-        if (! repaintUnderway)
+        if (! MERGE_REGIONS || ! repaintUnderway)
           {
             blitBuffer(root, rootRect);
           }
 
         // Otherwise queue this request up, until all the RepaintManager work
         // is done.
         else
           {
             if (commitRequests.containsKey(root))
               SwingUtilities.computeUnion(rootRect.x, rootRect.y,

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to