]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fix IF test for color_1.xml.
authorJeremias Maerki <jeremias@apache.org>
Thu, 10 Feb 2011 12:43:14 +0000 (12:43 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 10 Feb 2011 12:43:14 +0000 (12:43 +0000)
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

src/java/org/apache/fop/util/ColorUtil.java

index 4354e7a8a2d6c8ffe9f14e66429cc8950ff65ebc..e1454a5451888a376e8f4c3ef29ff5c6d9a12a95 100644 (file)
@@ -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;