]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Expanded the vertical/horizontal background image position calculations (motivation...
authorAdrian Cumiskey <acumiskey@apache.org>
Wed, 27 Aug 2008 09:46:50 +0000 (09:46 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Wed, 27 Aug 2008 09:46:50 +0000 (09:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@689428 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/TraitSetter.java

index d1146375ec21b471f045f6789fee3e144a57d6fc..c6939d9ffcd9c1c48a1d5fd489ecfaefd76d2cd7 100644 (file)
@@ -394,12 +394,15 @@ public class TraitSetter {
                         int width = area.getIPD();
                         width += backProps.getPaddingStart(false, context);
                         width += backProps.getPaddingEnd(false, context);
-                        back.setHoriz(backProps.backgroundPositionHorizontal.getValue(
-                                new SimplePercentBaseContext(context,
-                                    LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL,
-                                    (width - back.getImageInfo().getSize().getWidthMpt())
-                                )
-                            ));
+                        int imageWidthMpt = back.getImageInfo().getSize().getWidthMpt();
+                        int lengthBaseValue = (width - imageWidthMpt);
+                        SimplePercentBaseContext simplePercentBaseContext
+                            = new SimplePercentBaseContext(context,
+                            LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL,
+                            lengthBaseValue);
+                        int horizontal = backProps.backgroundPositionHorizontal.getValue(
+                                simplePercentBaseContext);
+                        back.setHoriz(horizontal);
                     } else {
                         //TODO Area IPD has to be set for this to work
                         log.warn("Horizontal background image positioning ignored"
@@ -415,12 +418,15 @@ public class TraitSetter {
                         int height = area.getBPD();
                         height += backProps.getPaddingBefore(false, context);
                         height += backProps.getPaddingAfter(false, context);
-                        back.setVertical(backProps.backgroundPositionVertical.getValue(
-                                new SimplePercentBaseContext(context,
-                                     LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL,
-                                     (height - back.getImageInfo().getSize().getHeightMpt())
-                                )
-                            ));
+                        int imageHeightMpt = back.getImageInfo().getSize().getHeightMpt();
+                        int lengthBaseValue = (height - imageHeightMpt);
+                        SimplePercentBaseContext simplePercentBaseContext
+                            = new SimplePercentBaseContext(context,
+                                LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL,
+                                lengthBaseValue);
+                        int vertical = backProps.backgroundPositionVertical.getValue(
+                                simplePercentBaseContext);
+                        back.setVertical(vertical);
                     } else {
                         //TODO Area BPD has to be set for this to work
                         log.warn("Vertical background image positioning ignored"