From dce8e04bb068a61ff085bc3ea936e43bc329434e Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Wed, 15 Oct 2008 13:27:06 +0000 Subject: [PATCH] More readable. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@704907 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/layoutmgr/TraitSetter.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java index 9366c6dc7..f34c68a6c 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java @@ -393,12 +393,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" @@ -414,12 +417,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" -- 2.39.5