]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix: 48453 AFP Renderer: Page Segments not positioned correctly when reference...
authorChris Bowditch <cbowditch@apache.org>
Tue, 29 Dec 2009 11:00:41 +0000 (11:00 +0000)
committerChris Bowditch <cbowditch@apache.org>
Tue, 29 Dec 2009 11:00:41 +0000 (11:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@894350 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/afp/DataStream.java
src/java/org/apache/fop/render/afp/AFPPainter.java
src/java/org/apache/fop/render/afp/AFPRenderer.java
status.xml

index b8da317ef01ffff4f19b1703c02154600cf1313b..c39e0f77e62d1c91bd14c1110f079882d94859e8 100644 (file)
@@ -512,23 +512,27 @@ public class DataStream {
      *            the x coordinate for the overlay
      * @param y
      *            the y coordinate for the overlay
+     * @param width
+     *            the width of the image
+     * @param height
+     *            the height of the image
      */
-    public void createIncludePageSegment(String name, int x, int y) {
+    public void createIncludePageSegment(String name, int x, int y, int width, int height) {
         int xOrigin;
         int yOrigin;
         int orientation = paintingState.getRotation();
         switch (orientation) {
         case 90:
-            xOrigin = currentPage.getWidth() - y;
-            yOrigin = x;
+            xOrigin = x - height;
+            yOrigin = y;
             break;
         case 180:
-            xOrigin = currentPage.getWidth() - x;
-            yOrigin = currentPage.getHeight() - y;
+            xOrigin = x - width;
+            yOrigin = y - height;
             break;
         case 270:
-            xOrigin = y;
-            yOrigin = currentPage.getHeight() - x;
+            xOrigin = x;
+            yOrigin = y - height;
             break;
         default:
             xOrigin = x;
index 7fcd0b3d1a14b8fe587d4781c923779d885f8ffa..22a5e0a58e8fe3703e23d102b5e0cf059cd02f2d 100644 (file)
@@ -187,7 +187,10 @@ public class AFPPainter extends AbstractIFPainter {
         if (name != null) {
             float[] srcPts = {rect.x, rect.y};
             int[] coords = unitConv.mpts2units(srcPts);
-            getDataStream().createIncludePageSegment(name, coords[X], coords[Y]);
+            int width = Math.round(unitConv.mpt2units(rect.width));
+            int height = Math.round(unitConv.mpt2units(rect.height));
+
+            getDataStream().createIncludePageSegment(name, coords[X], coords[Y], width, height);
         } else {
             drawImageUsingURI(uri, rect);
         }
index 250ff96246ac6b624da2e0e3e3d1e73c0417aa3c..2118ac2bcac16455281cc092fd3d626b299311e5 100644 (file)
@@ -468,9 +468,11 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust
 
         String name = (String)pageSegmentMap.get(uri);
         if (name != null) {
-            float[] srcPts = {x, y};
+            float[] srcPts = {x, y, posInt.width,  posInt.height};
             int[] coords = unitConv.mpts2units(srcPts);
-            dataStream.createIncludePageSegment(name, coords[X], coords[Y]);
+            int width = Math.round(unitConv.mpt2units(posInt.width));
+            int height = Math.round(unitConv.mpt2units(posInt.height));
+            dataStream.createIncludePageSegment(name, coords[X], coords[Y], width, height);
         } else {
             ImageManager manager = userAgent.getFactory().getImageManager();
             ImageInfo info = null;
index 45145f6bf2fdfa63f2cf170908ce5f3138bd770f..35b0618fb2cedb1487691d9c6c635f9a5113b428 100644 (file)
@@ -58,6 +58,9 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="CB" type="fix" fixes-bug="48453">
+        Bugfix: AFP Renderer: Page Segments not positioned correctly when reference-orientation != 0
+      </action>
       <action context="Fonts" dev="JM" type="add">
         Added support for TrueType fonts with symbol character maps (like "Wingdings" and "Symbol").
         Character for these fonts are usually found in the 0xF020 to 0xF0FF range