Author: acumiskey
Date: Wed Oct 15 06:28:25 2008
New Revision: 704909

URL: http://svn.apache.org/viewvc?rev=704909&view=rev
Log:
Fix for ps:ps-page-setup-code.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderer.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=704909&r1=704908&r2=704909&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderer.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderer.java Wed 
Oct 15 06:28:25 2008
@@ -40,36 +40,6 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.xmlgraphics.image.loader.ImageException;
-import org.apache.xmlgraphics.image.loader.ImageFlavor;
-import org.apache.xmlgraphics.image.loader.ImageInfo;
-import org.apache.xmlgraphics.image.loader.ImageManager;
-import org.apache.xmlgraphics.image.loader.ImageSessionContext;
-import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawEPS;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
-import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
-import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
-import org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline;
-import org.apache.xmlgraphics.image.loader.util.ImageUtil;
-import org.apache.xmlgraphics.ps.DSCConstants;
-import org.apache.xmlgraphics.ps.ImageEncoder;
-import org.apache.xmlgraphics.ps.PSDictionary;
-import org.apache.xmlgraphics.ps.PSPageDeviceDictionary;
-import org.apache.xmlgraphics.ps.PSDictionaryFormatException;
-import org.apache.xmlgraphics.ps.PSGenerator;
-import org.apache.xmlgraphics.ps.PSImageUtils;
-import org.apache.xmlgraphics.ps.PSProcSets;
-import org.apache.xmlgraphics.ps.PSResource;
-import org.apache.xmlgraphics.ps.PSState;
-import org.apache.xmlgraphics.ps.dsc.DSCException;
-import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
-import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox;
-import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox;
-
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.Area;
@@ -107,6 +77,34 @@
 import org.apache.fop.render.ps.extensions.PSSetupCode;
 import org.apache.fop.util.CharUtilities;
 import org.apache.fop.util.ColorUtil;
+import org.apache.xmlgraphics.image.loader.ImageException;
+import org.apache.xmlgraphics.image.loader.ImageFlavor;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawEPS;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
+import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
+import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
+import org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline;
+import org.apache.xmlgraphics.image.loader.util.ImageUtil;
+import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.ImageEncoder;
+import org.apache.xmlgraphics.ps.PSDictionary;
+import org.apache.xmlgraphics.ps.PSDictionaryFormatException;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSImageUtils;
+import org.apache.xmlgraphics.ps.PSPageDeviceDictionary;
+import org.apache.xmlgraphics.ps.PSProcSets;
+import org.apache.xmlgraphics.ps.PSResource;
+import org.apache.xmlgraphics.ps.PSState;
+import org.apache.xmlgraphics.ps.dsc.DSCException;
+import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox;
 
 /**
  * Renderer that renders to PostScript.
@@ -143,7 +141,7 @@
     /** The application producing the PostScript */
     private int currentPageNumber = 0;
 
-    private boolean enableComments = true;
+    private final boolean enableComments = true;
     private boolean autoRotateLandscape = false;
     private int languageLevel = PSGenerator.DEFAULT_LANGUAGE_LEVEL;
 
@@ -589,12 +587,12 @@
     /** [EMAIL PROTECTED] */
     public void paintImage(RenderedImage image, RendererContext context,
             int x, int y, int width, int height) throws IOException {
-        float fx = (float)x / 1000f;
+        float fx = x / 1000f;
         x += currentIPPosition / 1000f;
-        float fy = (float)y / 1000f;
+        float fy = y / 1000f;
         y += currentBPPosition / 1000f;
-        float fw = (float)width / 1000f;
-        float fh = (float)height / 1000f;
+        float fw = width / 1000f;
+        float fh = height / 1000f;
         PSImageUtils.renderBitmapImage(image, fx, fy, fw, fh, gen);
     }
 
@@ -1235,6 +1233,8 @@
                     PSExtensionAttachment attachment = 
(PSExtensionAttachment)attObj;
                     if (attachment instanceof PSCommentBefore) {
                         gen.commentln("%" + attachment.getContent());
+                    } else if (attachment instanceof PSSetupCode) {
+                        gen.writeln(attachment.getContent());
                     }
                 }
             }

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java?rev=704909&r1=704908&r2=704909&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
 Wed Oct 15 06:28:25 2008
@@ -20,21 +20,20 @@
 package org.apache.fop.render.ps.extensions;
 
 // FOP
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
 
 /**
  * Base class for the PostScript-specific extension elements.
  */
 public abstract class AbstractPSExtensionObject extends FONode {
 
-    private PSSetupCode setupCode = new PSSetupCode();
+    private final PSSetupCode setupCode = new PSSetupCode();
 
     /**
      * Main constructor.
@@ -56,9 +55,10 @@
     /** [EMAIL PROTECTED] */
     protected void characters(char[] data, int start, int length,
                                  PropertyList pList, Locator locator) {
-        if (setupCode.getContent() != null) {
-            StringBuffer sb = new StringBuffer(setupCode.getContent());
-            sb.append(data, start, length - start);
+        String content = setupCode.getContent();
+        if (content != null) {
+            StringBuffer sb = new StringBuffer(content);
+            sb.append(data, start, length);
             setupCode.setContent(sb.toString());
         } else {
             setupCode.setContent(new String(data, start, length));



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to