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 de...@apache.org on 2005/07/29 03:18:49 UTC

svn commit: r226318 - in /xmlgraphics/batik/branches/svg11/sources/org/apache/batik: bridge/URIResolver.java dom/svg/AbstractSVGMatrix.java util/RunnableQueue.java

Author: deweese
Date: Thu Jul 28 18:18:35 2005
New Revision: 226318

URL: http://svn.apache.org/viewcvs?rev=226318&view=rev
Log:
1) SVGMatrix.rotate now takes deg rather than radians.
2) Small tweak to URI resolver.
3) Change to RunnableQueue to avoid deadlocks from 
   RunHandler callbacks.

Modified:
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/URIResolver.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/util/RunnableQueue.java

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/URIResolver.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/URIResolver.java?rev=226318&r1=226317&r2=226318&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/URIResolver.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/URIResolver.java Thu Jul 28 18:18:35 2005
@@ -95,8 +95,7 @@
         String baseURI = XMLBaseSupport.getCascadedXMLBase(ref);
         // System.err.println("baseURI: " + baseURI);
         // System.err.println("URI: " + uri);
-        if ((baseURI == null) &&
-            (uri.startsWith("#")))
+        if ((baseURI == null) && (uri.charAt(0) == '#'))
             return document.getElementById(uri.substring(1));
 
         ParsedURL purl = new ParsedURL(baseURI, uri);

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java?rev=226318&r1=226317&r2=226318&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java Thu Jul 28 18:18:35 2005
@@ -229,7 +229,7 @@
      */
     public SVGMatrix rotate(float angle) {
         AffineTransform tr = (AffineTransform)getAffineTransform().clone();
-        tr.rotate(angle);
+        tr.rotate(Math.PI * angle / 180);
         return new SVGOMMatrix(tr);
     }
 

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/util/RunnableQueue.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/util/RunnableQueue.java?rev=226318&r1=226317&r2=226318&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/util/RunnableQueue.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/util/RunnableQueue.java Thu Jul 28 18:18:35 2005
@@ -137,36 +137,40 @@
         Runnable rable;
         try {
             while (!HaltingThread.hasBeenHalted()) {
-
+                boolean callSuspended = false;
+                boolean callResumed   = false;
                 // Mutex for suspention work.
                 synchronized (stateLock) {
-                    if (state == RUNNING) {
+                    if (state != RUNNING) {
+                        state = SUSPENDED;
+                        callSuspended = true;
+                    }
+                }
+                if (callSuspended)
+                    executionSuspended();
 
-                        if (wasResumed) {
-                            wasResumed = false;
-                            executionResumed();
-                        }
-                    } else {
+                synchronized (stateLock) {
+                    while (state != RUNNING) {
+                        state = SUSPENDED;
                         
-                        while (state != RUNNING) {
-                            state = SUSPENDED;
-
-                            // notify suspendExecution in case it is
-                            // waiting til we shut down.
-                            stateLock.notifyAll();
-
-                            executionSuspended();
-
-                            // Wait until resumeExecution called.
-                            try {
-                                stateLock.wait();
-                            } catch(InterruptedException ie) { }
-                        }
+                        // notify suspendExecution in case it is
+                        // waiting til we shut down.
+                        stateLock.notifyAll();
+                        
+                        // Wait until resumeExecution called.
+                        try {
+                            stateLock.wait();
+                        } catch(InterruptedException ie) { }
+                    }
 
+                    if (wasResumed) {
                         wasResumed = false;
-                        executionResumed();
+                        callResumed = true;
                     }
                 }
+
+                if (callResumed)
+                    executionResumed();
 
                 // The following seriously stress tests the class
                 // for stuff happening between the two sync blocks.