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

asf-gitbox-commits 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 8be66d8  PDFBOX-6263: replace optimized code with more elegant code by 
ChatGPT
8be66d8 is described below

commit 8be66d844ac19360cb2da2dbdf0f129fc38c585f
Author: Tilman Hausherr <[email protected]>
AuthorDate: Sun Sep 13 20:19:30 2026 +0200

    PDFBOX-6263: replace optimized code with more elegant code by ChatGPT
---
 .../org/apache/pdfbox/jbig2/segments/SymbolDictionary.java     | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git 
a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java 
b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
index d819bb4..eb9264c 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
@@ -553,16 +553,12 @@ public class SymbolDictionary implements Dictionary
         int startColumn = 0;
         for (int i = heightClassFirstSymbol; i < amountOfDecodedSymbols; i++)
         {
-            if (i > heightClassFirstSymbol)
-            {
-                startColumn += newSymbolsWidths[i - 1];
-            }
-
-            final Rectangle roi = new Rectangle(startColumn, 0, 
newSymbolsWidths[i],
-                    heightClassHeight);
+            final int symbolWidth = newSymbolsWidths[i];
+            final Rectangle roi = new Rectangle(startColumn, 0, symbolWidth, 
heightClassHeight);
             final Bitmap symbolBitmap = Bitmaps.extract(roi, 
heightClassCollectiveBitmap);
             newSymbols[i] = symbolBitmap;
             sbSymbols.add(symbolBitmap);
+            startColumn += symbolWidth;
         }
     }
 

Reply via email to