You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2002/08/02 02:18:35 UTC
cvs commit: xml-batik/sources/org/apache/batik/swing/svg JSVGComponent.java
deweese 2002/08/01 17:18:35
Modified: sources/org/apache/batik/swing/gvt JGVTComponent.java
TextSelectionManager.java
sources/org/apache/batik/swing/svg JSVGComponent.java
Log:
Now uses repaint instead of paintImmediately when double buffering is
turned on. This eliminates the flickering under Mac OS X when viewing
dynamic documents.
Revision Changes Path
1.29 +16 -11 xml-batik/sources/org/apache/batik/swing/gvt/JGVTComponent.java
Index: JGVTComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/JGVTComponent.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- JGVTComponent.java 12 Jun 2002 12:22:15 -0000 1.28
+++ JGVTComponent.java 2 Aug 2002 00:18:35 -0000 1.29
@@ -414,15 +414,21 @@
public void immediateRepaint() {
if (EventQueue.isDispatchThread()) {
Dimension dim = getSize();
- paintImmediately(0, 0, dim.width, dim.height);
+ if (doubleBufferedRendering)
+ repaint(0, 0, dim.width, dim.height);
+ else
+ paintImmediately(0, 0, dim.width, dim.height);
} else {
try {
EventQueue.invokeAndWait(new Runnable() {
- public void run() {
- Dimension dim = getSize();
- paintImmediately(0, 0, dim.width, dim.height);
- }
- });
+ public void run() {
+ Dimension dim = getSize();
+ if (doubleBufferedRendering)
+ repaint(0, 0, dim.width, dim.height);
+ else
+ paintImmediately(0, 0, dim.width, dim.height);
+ }
+ });
} catch (Exception e) {
}
}
@@ -704,14 +710,13 @@
final Thread thisThread = this;
try {
while (!isInterrupted()) {
- EventQueue.invokeAndWait(new Runnable() {
+ EventQueue.invokeLater(new Runnable() {
public void run() {
if (progressivePaintThread ==
thisThread) {
Dimension dim = getSize();
- paintImmediately(0, 0,
- dim.width,
- dim.height);
+ repaint(0, 0, dim.width,
+ dim.height);
}
}
});
1.17 +8 -8 xml-batik/sources/org/apache/batik/swing/gvt/TextSelectionManager.java
Index: TextSelectionManager.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/TextSelectionManager.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- TextSelectionManager.java 3 Apr 2002 04:58:22 -0000 1.16
+++ TextSelectionManager.java 2 Aug 2002 00:18:35 -0000 1.17
@@ -91,8 +91,8 @@
protected Color selectionOverlayStrokeColor = new Color(255, 255, 255, 255);
/**
- * A flag bit that indicates whether or not the selection overlay is painted
- * in XOR mode.
+ * A flag bit that indicates whether or not the selection overlay is
+ * painted in XOR mode.
*/
protected boolean xorMode = false;
@@ -201,7 +201,7 @@
if (selectionHighlight != null) {
Rectangle r = getHighlightBounds();
selectionHighlight = null;
- component.paintImmediately(r);
+ component.repaint(r);
}
}
}
@@ -258,7 +258,7 @@
if (selectionHighlight != null) {
Rectangle r = getHighlightBounds();
selectionHighlight = null;
- component.paintImmediately(r);
+ component.repaint(r);
}
}
public void selectionChanged(SelectionEvent e) {
@@ -273,12 +273,12 @@
if (selectionHighlight != null) {
if (r != null) {
Rectangle r2 = getHighlightBounds();
- component.paintImmediately(r.union(r2));
+ component.repaint(r.union(r2));
} else {
- component.paintImmediately(getHighlightBounds());
+ component.repaint(getHighlightBounds());
}
} else if (r != null) {
- component.paintImmediately(r);
+ component.repaint(r);
}
}
1.57 +16 -14 xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
Index: JSVGComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- JSVGComponent.java 24 Jul 2002 00:02:28 -0000 1.56
+++ JSVGComponent.java 2 Aug 2002 00:18:35 -0000 1.57
@@ -1231,19 +1231,18 @@
* Called when an update was completed.
*/
public void updateCompleted(final UpdateManagerEvent e) {
+ // IMPORTANT:
+ // ==========
+ //
+ // The following call is 'invokeAndWait' and not
+ // 'invokeLater' because it is essential that the
+ // UpdateManager thread (which invokes this
+ // 'updateCompleted' method, blocks until the repaint
+ // has completed. Otherwise, there is a possibility
+ // that internal buffers would get updated in the
+ // middle of a swing repaint.
+ //
try {
- //
- // IMPORTANT:
- // ==========
- //
- // The following call is 'invokeAndWait' and not
- // 'invokeLater' because it is essential that the
- // UpdateManager thread (which invokes this
- // 'updateCompleted' method, blocks until the repaint
- // has completed. Otherwise, there is a possibility
- // that internal buffers would get updated in the
- // middle of a swing repaint.
- //
EventQueue.invokeAndWait(new Runnable() {
public void run() {
image = e.getImage();
@@ -1261,7 +1260,10 @@
Iterator i = l.iterator();
while (i.hasNext()) {
Rectangle r = (Rectangle)i.next();
- paintImmediately(r);
+ if (doubleBufferedRendering)
+ repaint(r);
+ else
+ paintImmediately(r);
}
}
suspendInteractions = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org