xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r377680 - in /xmlgraphics/fop/branches/Temp_API_Finalization: src/java/org/apache/fop/apps/ src/java/org/apache/fop/area/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/fo/properties/ src/java/org/apach...
Date Tue, 14 Feb 2006 10:02:15 GMT
Author: jeremias
Date: Tue Feb 14 02:02:11 2006
New Revision: 377680

URL: http://svn.apache.org/viewcvs?rev=377680&view=rev
Log:
Attaching the ImageFactory to the FopFactory. To have a cache effect between multiple rendering
runs the FopFactory would have to be reused after this change. Multiple FopFactories = Multiple
image caches.

Modified:
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FopFactory.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/area/AreaTreeParser.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/FOTreeBuilder.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageFactory.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageLoader.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/pdf/PDFRenderer.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/ps/PSRenderer.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/rtf/RTFHandler.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FopFactory.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FopFactory.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FopFactory.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FopFactory.java
Tue Feb 14 02:02:11 2006
@@ -31,6 +31,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.fop.fo.ElementMapping;
 import org.apache.fop.fo.ElementMappingRegistry;
+import org.apache.fop.image.ImageFactory;
 import org.apache.fop.layoutmgr.LayoutManagerMaker;
 import org.apache.fop.render.RendererFactory;
 import org.apache.fop.render.XMLHandlerRegistry;
@@ -67,6 +68,8 @@
     private ContentHandlerFactoryRegistry contentHandlerFactoryRegistry 
                 = new ContentHandlerFactoryRegistry();
     
+    private ImageFactory imageFactory = new ImageFactory();
+
     /** user configuration */
     private Configuration userConfig = null;
 
@@ -188,6 +191,11 @@
     /** @return the content handler factory registry */
     public ContentHandlerFactoryRegistry getContentHandlerFactoryRegistry() {
         return this.contentHandlerFactoryRegistry;
+    }
+
+    /** @return the image factory */
+    public ImageFactory getImageFactory() {
+        return this.imageFactory;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/area/AreaTreeParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/area/AreaTreeParser.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/area/AreaTreeParser.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/area/AreaTreeParser.java
Tue Feb 14 02:02:11 2006
@@ -896,7 +896,7 @@
                             if (url != null) {
                                 bkg.setURL(url);
                                 
-                                ImageFactory fact = ImageFactory.getInstance();
+                                ImageFactory fact = userAgent.getFactory().getImageFactory();
                                 FopImage img = fact.getImage(url, userAgent);
                                 if (img == null) {
                                     log.error("Background image not available: " + url);

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/FOTreeBuilder.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/FOTreeBuilder.java
Tue Feb 14 02:02:11 2006
@@ -168,7 +168,8 @@
         foEventHandler.endDocument();
         
         //Notify the image factory that this user agent has expired.
-        ImageFactory.getInstance().removeContext(this.userAgent);
+        ImageFactory imageFactory = userAgent.getFactory().getImageFactory();
+        imageFactory.removeContext(this.userAgent);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/flow/ExternalGraphic.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
Tue Feb 14 02:02:11 2006
@@ -19,6 +19,7 @@
 package org.apache.fop.fo.flow;
 
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
@@ -60,8 +61,9 @@
         
         //Additional processing: preload image
         url = ImageFactory.getURL(getSrc());
-        ImageFactory fact = ImageFactory.getInstance();
-        fopimage = fact.getImage(url, getUserAgent());
+        FOUserAgent userAgent = getUserAgent();
+        ImageFactory fact = userAgent.getFactory().getImageFactory();
+        fopimage = fact.getImage(url, userAgent);
         if (fopimage == null) {
             getLogger().error("Image not available: " + getSrc());
         } else {

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
Tue Feb 14 02:02:11 2006
@@ -18,6 +18,7 @@
 
 package org.apache.fop.fo.properties;
 
+import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.PercentBaseContext;
@@ -158,8 +159,9 @@
             
             //Additional processing: preload image
             String url = ImageFactory.getURL(backgroundImage);
-            ImageFactory fact = ImageFactory.getInstance();
-            fopimage = fact.getImage(url, fobj.getUserAgent());
+            FOUserAgent userAgent = fobj.getUserAgent();
+            ImageFactory fact = userAgent.getFactory().getImageFactory();
+            fopimage = fact.getImage(url, userAgent);
             if (fopimage == null) {
                 fobj.getLogger().error("Background image not available: " + backgroundImage);
             } else {

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageFactory.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageFactory.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageFactory.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageFactory.java
Tue Feb 14 02:02:11 2006
@@ -50,13 +50,13 @@
      */
     protected static Log log = LogFactory.getLog(FopImage.class);
     
-    private static ImageFactory factory = new ImageFactory();
+    //private static ImageFactory factory = new ImageFactory();
 
     private HashMap imageMimeTypes = new HashMap();
     
     private ImageCache cache = new ContextImageCache(true);
 
-    private ImageFactory() {
+    public ImageFactory() {
         /* @todo The mappings set up below of image mime types to implementing
          * classes should be made externally configurable
          */
@@ -121,15 +121,6 @@
         imt = new ImageMimeType("image/emf");
         imageMimeTypes.put(imt.getMimeType(), imt);
         imt.addProvider(emfImage);
-    }
-
-    /**
-     * Get static image factory instance.
-     *
-     * @return the image factory instance
-     */
-    public static ImageFactory getInstance() {
-        return factory;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageLoader.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageLoader.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageLoader.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/image/ImageLoader.java
Tue Feb 14 02:02:11 2006
@@ -51,7 +51,8 @@
         if (!valid || image != null) {
             return image;
         }
-        image = ImageFactory.getInstance().loadImage(url, userAgent);
+        ImageFactory imageFactory = userAgent.getFactory().getImageFactory();
+        image = imageFactory.loadImage(url, userAgent);
         if (image == null) {
             cache.invalidateImage(url, userAgent);
             valid = false;

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
Tue Feb 14 02:02:11 2006
@@ -1058,7 +1058,7 @@
         int y = currentBPPosition;
         String url = ImageFactory.getURL(pUrl);
 
-        ImageFactory fact = ImageFactory.getInstance();
+        ImageFactory fact = userAgent.getFactory().getImageFactory();
         FopImage fopimage = fact.getImage(url, userAgent);
 
         if (fopimage == null) {

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/pdf/PDFRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/pdf/PDFRenderer.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/pdf/PDFRenderer.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/pdf/PDFRenderer.java
Tue Feb 14 02:02:11 2006
@@ -1251,7 +1251,7 @@
         }
 
         url = ImageFactory.getURL(url);
-        ImageFactory fact = ImageFactory.getInstance();
+        ImageFactory fact = userAgent.getFactory().getImageFactory();
         FopImage fopimage = fact.getImage(url, userAgent);
         if (fopimage == null) {
             return;

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/ps/PSRenderer.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/ps/PSRenderer.java
Tue Feb 14 02:02:11 2006
@@ -268,7 +268,7 @@
     protected void drawImage(String url, Rectangle2D pos) {
         endTextObject();
         url = ImageFactory.getURL(url);
-        ImageFactory fact = ImageFactory.getInstance();
+        ImageFactory fact = userAgent.getFactory().getImageFactory();
         FopImage fopimage = fact.getImage(url, userAgent);
         if (fopimage == null) {
             return;

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/rtf/RTFHandler.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/rtf/RTFHandler.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/rtf/RTFHandler.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/render/rtf/RTFHandler.java
Tue Feb 14 02:02:11 2006
@@ -1102,8 +1102,9 @@
             String url = eg.getURL();
 
             //set image data
-            ImageFactory fact = ImageFactory.getInstance();
-            FopImage fopimage = fact.getImage(url, eg.getUserAgent());
+            FOUserAgent userAgent = eg.getUserAgent();
+            ImageFactory fact = userAgent.getFactory().getImageFactory();
+            FopImage fopimage = fact.getImage(url, userAgent);
             if (fopimage == null) {
                 log.error("Image could not be found: " + url);
                 return;

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java?rev=377680&r1=377679&r2=377680&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java
(original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java
Tue Feb 14 02:02:11 2006
@@ -79,12 +79,13 @@
     }
     
     private void innerTestFO1(boolean withStream) throws Exception {
+        FOUserAgent ua = new FOUserAgent();
+
         //Reset the image caches to force URI resolution!
-        ImageFactory.getInstance().clearCaches();
+        ua.getFactory().getImageFactory().clearCaches();
         
         File foFile = new File(getBaseDir(), "test/xml/uri-resolution1.fo");
         
-        FOUserAgent ua = new FOUserAgent();
         MyURIResolver resolver = new MyURIResolver(withStream); 
         ua.setURIResolver(resolver);
         ua.setBaseURL(foFile.getParentFile().toURL().toString());



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message