From: Jeremias Maerki Date: Thu, 10 Feb 2011 12:43:14 +0000 (+0000) Subject: Fix IF test for color_1.xml. X-Git-Tag: fop-1_1rc1old~290^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4f3ab56159ac8a61c19894abb83eca1ffad1b307;p=xmlgraphics-fop.git Fix IF test for color_1.xml. The round-trip for the rgb() was not working with ColorUtil.isSameColor() as that checks deeper than just Color.equals(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@1069366 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/util/ColorUtil.java b/src/java/org/apache/fop/util/ColorUtil.java index 4354e7a8a..e1454a545 100644 --- a/src/java/org/apache/fop/util/ColorUtil.java +++ b/src/java/org/apache/fop/util/ColorUtil.java @@ -238,7 +238,11 @@ public final class ColorUtil { float red = parseComponent255(args[0], value); float green = parseComponent255(args[1], value); float blue = parseComponent255(args[2], value); - parsedColor = new Color(red, green, blue); + //Convert to ints to synchronize the behaviour with toRGBFunctionCall() + int r = (int)(red * 255 + 0.5); + int g = (int)(green * 255 + 0.5); + int b = (int)(blue * 255 + 0.5); + parsedColor = new Color(r, g, b); } catch (PropertyException pe) { //simply re-throw throw pe;