You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2006/12/20 13:54:22 UTC

svn commit: r489075 - /xmlgraphics/batik/trunk/sources/org/apache/batik/swing/gvt/TextSelectionManager.java

Author: dvholten
Date: Wed Dec 20 04:54:21 2006
New Revision: 489075

URL: http://svn.apache.org/viewvc?view=rev&rev=489075
Log:
reduce garbage rectangles

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/swing/gvt/TextSelectionManager.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/swing/gvt/TextSelectionManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/swing/gvt/TextSelectionManager.java?view=diff&rev=489075&r1=489074&r2=489075
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/swing/gvt/TextSelectionManager.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/swing/gvt/TextSelectionManager.java Wed Dec 20 04:54:21 2006
@@ -25,6 +25,7 @@
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.awt.Shape;
+import java.awt.BasicStroke;
 import java.awt.geom.AffineTransform;
 
 import org.apache.batik.gvt.Selectable;
@@ -92,7 +93,7 @@
     /**
      * The color of the outline of the selection overlay.
      */
-    protected Color selectionOverlayStrokeColor = new Color(255, 255, 255, 255);
+    protected Color selectionOverlayStrokeColor = Color.white;
 
     /**
      * A flag bit that indicates whether or not the selection overlay is
@@ -143,7 +144,7 @@
      * @param color the new color of the selection overlay
      */
     public void setSelectionOverlayColor(Color color) {
-        this.selectionOverlayColor = color;
+        selectionOverlayColor = color;
     }
 
     /**
@@ -160,7 +161,7 @@
      * @param color the new color of the outline of the selection overlay
      */
     public void setSelectionOverlayStrokeColor(Color color) {
-        this.selectionOverlayStrokeColor = color;
+        selectionOverlayStrokeColor = color;
     }
 
     /**
@@ -177,7 +178,7 @@
      * @param state true implies the selection overlay will be in XOR mode
      */
     public void setSelectionOverlayXORMode(boolean state) {
-        this.xorMode = state;
+        xorMode = state;
     }
 
     /**
@@ -297,7 +298,8 @@
             if (selectionHighlight != null) {
                 if (r != null) {
                     Rectangle r2 = getHighlightBounds();
-                    component.repaint(r.union(r2));
+                    r2.add( r );   // r2 = r2 union r
+                    component.repaint( r2 );
                 } else {
                     component.repaint(getHighlightBounds());
                 }
@@ -347,7 +349,7 @@
                     g2d.setColor(selectionOverlayColor);
                     g2d.fill(s);
                     if (selectionOverlayStrokeColor != null) {
-                        g2d.setStroke(new java.awt.BasicStroke(1.0f));
+                        g2d.setStroke(new BasicStroke(1.0f));
                         g2d.setColor(selectionOverlayStrokeColor);
                         g2d.draw(s);
                     }