pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1827080 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color: PDCIEDictionaryBasedColorSpace.java PDCalGray.java PDCalRGB.java
Date Sat, 17 Mar 2018 12:31:49 GMT
Author: msahyoun
Date: Sat Mar 17 12:31:49 2018
New Revision: 1827080

URL: http://svn.apache.org/viewvc?rev=1827080&view=rev
Log:
PDFBOX-4134: use Float.compare, move common code to superclass

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalGray.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java?rev=1827080&r1=1827079&r2=1827080&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
Sat Mar 17 12:31:49 2018
@@ -64,6 +64,18 @@ public abstract class PDCIEDictionaryBas
         fillWhitepointCache(getWhitepoint());
     }
 
+    /**
+     * Tests if the current point is the white point.
+     *
+     * @return true if the current point is the white point.
+     */
+    protected boolean isWhitePoint()
+    {
+        return  Float.compare(wpX, 1) == 0 &&
+                Float.compare(wpY, 1) == 0 && 
+                Float.compare(wpZ, 1)  == 0;
+    }
+
     private void fillWhitepointCache(PDTristimulus whitepoint)
     {
         wpX = whitepoint.getX();

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalGray.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalGray.java?rev=1827080&r1=1827079&r2=1827080&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalGray.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalGray.java
Sat Mar 17 12:31:49 2018
@@ -85,7 +85,7 @@ public final class PDCalGray extends PDC
     public float[] toRGB(float[] value)
     {
         // see implementation of toRGB in PDCalRGB, and PDFBOX-2971
-        if (wpX == 1 && wpY == 1 && wpZ == 1)
+        if (isWhitePoint())
         {
             float a = value[0];
             float[] result = map1.get(a);

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java?rev=1827080&r1=1827079&r2=1827080&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
Sat Mar 17 12:31:49 2018
@@ -77,7 +77,7 @@ public class PDCalRGB extends PDCIEDicti
     @Override
     public float[] toRGB(float[] value)
     {
-        if (wpX == 1 && wpY == 1 && wpZ == 1)
+        if (isWhitePoint())
         {
             float a = value[0];
             float b = value[1];



Mime
View raw message