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 2005/02/14 23:09:31 UTC
cvs commit: xml-batik/sources/org/apache/batik/swing/svg JSVGComponent.java
deweese 2005/02/14 14:09:30
Modified: sources/org/apache/batik/swing/svg JSVGComponent.java
Log:
GVT Render requests are now compressed. This helps the resize problem.
Revision Changes Path
1.100 +66 -12 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.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- JSVGComponent.java 18 Nov 2004 01:47:01 -0000 1.99
+++ JSVGComponent.java 14 Feb 2005 22:09:30 -0000 1.100
@@ -959,21 +959,75 @@
}
// Area of interest computation.
- AffineTransform inv;
+ AffineTransform inv = null;
try {
inv = renderingTransform.createInverse();
} catch (NoninvertibleTransformException e) {
- throw new InternalError(e.getMessage());
}
- final Shape s =
- inv.createTransformedShape(visRect);
-
- updateManager.getUpdateRunnableQueue().invokeLater
- (new Runnable() { public void run() {
- updateManager.updateRendering(renderingTransform,
- doubleBufferedRendering, true, s,
- visRect.width, visRect.height);
- }});
+ final Shape s;
+ if (inv == null) s = visRect;
+ else s = inv.createTransformedShape(visRect);
+
+ class UpdateRenderingRunnable implements Runnable {
+ AffineTransform at;
+ boolean doubleBuf;
+ boolean clearPaintTrans;
+ Shape aoi;
+ int width;
+ int height;
+
+ boolean active;
+
+ public UpdateRenderingRunnable(AffineTransform at,
+ boolean doubleBuf,
+ boolean clearPaintTrans,
+ Shape aoi,
+ int width, int height) {
+ updateInfo(at, doubleBuf, clearPaintTrans, aoi, width, height);
+ active = true;
+ }
+
+ public void updateInfo(AffineTransform at,
+ boolean doubleBuf,
+ boolean clearPaintTrans,
+ Shape aoi,
+ int width, int height) {
+ this.at = at;
+ this.doubleBuf = doubleBuf;
+ this.clearPaintTrans = clearPaintTrans;
+ this.aoi = aoi;
+ this.width = width;
+ this.height = height;
+ active = true;
+ }
+
+ public void deactivate() {
+ active = false;
+ }
+ public void run() {
+ if (!active) return;
+
+ updateManager.updateRendering
+ (at, doubleBuf, clearPaintTrans, aoi, width, height);
+ }
+ }
+ RunnableQueue rq = updateManager.getUpdateRunnableQueue();
+
+ // Events compression.
+ synchronized (rq.getIteratorLock()) {
+ Iterator it = rq.iterator();
+ while (it.hasNext()) {
+ Object next = it.next();
+ if (next instanceof UpdateRenderingRunnable) {
+ ((UpdateRenderingRunnable)next).deactivate();
+ }
+ }
+ }
+
+ rq.invokeLater(new UpdateRenderingRunnable
+ (renderingTransform,
+ doubleBufferedRendering, true, s,
+ visRect.width, visRect.height));
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org