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 2007/02/21 02:12:30 UTC

svn commit: r509851 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: dom/util/SAXDocumentFactory.java dom/util/SAXIOException.java ext/awt/image/rendered/TileRed.java

Author: deweese
Date: Tue Feb 20 17:12:30 2007
New Revision: 509851

URL: http://svn.apache.org/viewvc?view=rev&rev=509851
Log:
1) Fix for at least one of the Mac Rendering bugs.
2) Added a wrapper for the SAX Exceptions which would allow for
   line/column reporting for parse errors.

Added:
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java   (with props)
Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXDocumentFactory.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TileRed.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXDocumentFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXDocumentFactory.java?view=diff&rev=509851&r1=509850&r2=509851
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXDocumentFactory.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXDocumentFactory.java Tue Feb 20 17:12:30 2007
@@ -315,7 +315,7 @@
             if (ex != null && ex instanceof InterruptedIOException) {
                 throw (InterruptedIOException) ex;
             }
-            throw new IOException(e.getMessage());
+            throw new SAXIOException(e);
         }
         currentNode = null;
         Document ret = document;
@@ -434,7 +434,7 @@
             if (ex != null && ex instanceof InterruptedIOException) {
                 throw (InterruptedIOException)ex;
             }
-            throw new IOException(e.getMessage());
+            throw new SAXIOException(e);
         }
 
         currentNode  = null;

Added: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java?view=auto&rev=509851
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java (added)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java Tue Feb 20 17:12:30 2007
@@ -0,0 +1,43 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.batik.dom.util;
+
+import org.xml.sax.SAXException;
+import java.io.IOException;
+
+/**
+ * Wrapper for SAX Exceptions which would make it possible to
+ * include line and column information with SAX parse errors.
+ *
+ * @author <a href="mailto:deweese@apache.org>deweese</a>
+ * @version $Id: skel.el,v 1.1 2003/05/13 21:04:46 deweese Exp $
+ */
+public class SAXIOException extends IOException {
+
+    protected SAXException saxe;
+
+    public SAXIOException( SAXException saxe) {
+        super(saxe.getMessage());
+        this.saxe = saxe;
+    }
+
+    public SAXException getSAXException() { return saxe; }
+    public Throwable    getCause() { return saxe; }
+};

Propchange: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TileRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TileRed.java?view=diff&rev=509851&r1=509850&r2=509851
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TileRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TileRed.java Tue Feb 20 17:12:30 2007
@@ -60,7 +60,6 @@
     private RenderingHints  hints;
 
     final boolean is_INT_PACK;
-    final boolean alphaPremult;
 
     /**
      * Tile
@@ -103,12 +102,11 @@
         this.xStep        = xStep;
         this.yStep        = yStep;
         this.hints        = hints;
-        this.alphaPremult = false;
 
         SampleModel sm = fixSampleModel(tile, xStep, yStep, 
                                         tiledRegion.width,
                                         tiledRegion.height);
-        ColorModel cm  = fixColorModel(tile, alphaPremult);
+        ColorModel cm  = tile.getColorModel();
 
         double smSz   = AbstractTiledRed.getDefaultTileSize();
         smSz = smSz*smSz;
@@ -285,7 +283,10 @@
         count %= colors.length;
 
         g.fillRect(0, 0, maxX, maxY);*/
-        GraphicsUtil.coerceData(wr, src.getColorModel(), alphaPremult);
+
+        // Don't coerceData since it will be in the proper alpha state
+        // due to the drawing.
+        // GraphicsUtil.coerceData(wr, src.getColorModel(), alphaPremult);
         return wr;
     }
 
@@ -395,12 +396,6 @@
         }
     }
 
-    protected static ColorModel fixColorModel(RenderedImage src,
-                                              boolean alphaPremult) {
-        return GraphicsUtil.coerceColorModel(src.getColorModel(), 
-                                             alphaPremult);
-    }
-    
     /**
      * This function 'fixes' the source's sample model.
      * right now it just ensures that the sample model isn't