This is an automated email from the ASF dual-hosted git repository.

tilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git


The following commit(s) were added to refs/heads/master by this push:
     new d86c3d9  PDFBOX-6156: improve javadoc, clarify parameters, add comment
d86c3d9 is described below

commit d86c3d90076bac1608b1e579153bdfc25e4dc0a1
Author: Tilman Hausherr <[email protected]>
AuthorDate: Thu Jan 29 21:00:05 2026 +0100

    PDFBOX-6156: improve javadoc, clarify parameters, add comment
---
 .../org/apache/pdfbox/jbig2/image/Bitmaps.java     | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java
index 3842efe..c31b293 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java
@@ -276,7 +276,7 @@ public class Bitmaps
             scaleX = scaleY = 1d;
         }
 
-        ColorModel cm = null;
+        ColorModel cm;
         final boolean isScaled = scaleX != 1 || scaleY != 1;
         if (isScaled)
         {
@@ -493,29 +493,29 @@ public class Bitmaps
      * <b>Hint:</b> Please take a look at ISO/IEC 14492:2001 (E) for detailed 
definition and description of the
      * operators.
      * 
-     * @param value1 - The value that should be combined with value2.
-     * @param value2 - The value that should be combined with value1.
+     * @param oldByte - The old value that should be combined with newByte.
+     * @param newByte - The new value that should be combined with oldByte.
      * @param op - The specified combination operator.
      * 
-     * @return The combination result.
+     * @return The combination result. In the case of {@link 
CombinationOperator#REPLACE}, newValue is returned.
      */
-    public static byte combineBytes(byte value1, byte value2, 
CombinationOperator op)
+    public static byte combineBytes(byte oldByte, byte newByte, 
CombinationOperator op)
     {
 
         switch (op)
         {
         case OR:
-            return (byte) (value2 | value1);
+            return (byte) (newByte | oldByte);
         case AND:
-            return (byte) (value2 & value1);
-        case XOR:
-            return (byte) (value2 ^ value1);
-        case XNOR:
-            return (byte) ~(value1 ^ value2);
+            return (byte) (newByte & oldByte);
+        case XOR: // 0 if equal, 1 if diff
+            return (byte) (newByte ^ oldByte);
+        case XNOR: // 0 if diff, 1 if equal
+            return (byte) ~(oldByte ^ newByte);
         case REPLACE:
         default:
             // Old value is replaced by new value.
-            return value2;
+            return newByte;
         }
     }
 

Reply via email to