Hi,

On Mon, 2006-02-27 at 14:05 +0100, Roman Kennke wrote:
> 2006-02-27  Roman Kennke  <[EMAIL PROTECTED]>
> 
>         * javax/swing/JViewport.java
>         (static_init): Changed default scrollmode to BLIT.
>         (paintSimple): Added some clipping to avoid painting problems.
>         (paintBlit): Added some clipping to avoid painting problems.

Just for the record, this change was missing the actual patch.
So here it is for the list.

Nice that this works smoothly now!

Cheers,

Mark
Index: javax/swing/JViewport.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- javax/swing/JViewport.java	19 Feb 2006 12:26:46 -0000	1.44
+++ javax/swing/JViewport.java	27 Feb 2006 13:02:34 -0000	1.45
@@ -48,6 +48,7 @@
 import java.awt.LayoutManager;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Shape;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
 import java.io.Serializable;
@@ -265,7 +266,7 @@
   {
     String scrollModeProp =
       SystemProperties.getProperty("gnu.javax.swing.JViewport.scrollMode",
-                         "BACKINGSTORE");
+                         "BLIT");
     if (scrollModeProp.equalsIgnoreCase("simple"))
       defaultScrollMode = SIMPLE_SCROLL_MODE;
     else if (scrollModeProp.equalsIgnoreCase("backingstore"))
@@ -808,6 +809,8 @@
 
     Point pos = getViewPosition();
     Component view = getView();
+    Shape oldClip = g.getClip();
+    g.clipRect(0, 0, getWidth(), getHeight());
     boolean translated = false;
     try
       {
@@ -819,6 +822,7 @@
       {
         if (translated)
           g.translate (pos.x, pos.y);
+        g.setClip(oldClip);
       }
   }
 
@@ -914,16 +918,22 @@
                    cachedBlitTo.x - cachedBlitFrom.x,
                    cachedBlitTo.y - cachedBlitFrom.y);
         // Now paint the part that becomes newly visible.
-        g.setClip(cachedBlitPaint.x, cachedBlitPaint.y,
+        Shape oldClip = g.getClip();
+        g.clipRect(cachedBlitPaint.x, cachedBlitPaint.y,
                   cachedBlitPaint.width, cachedBlitPaint.height);
-        paintSimple(g);
+        try
+          {
+            paintSimple(g);
+          }
+        finally
+          {
+            g.setClip(oldClip);
+          }
       }
     // If blitting is not possible for some reason, fall back to repainting
     // everything.
     else
-      {
-        paintSimple(g);
-      }
+      paintSimple(g);
     lastPaintPosition.setLocation(getViewPosition());
   }
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to