From 6570b03ade8b4ba798730d7ba129e528f7db491c Mon Sep 17 00:00:00 2001 From: Tilman Hausherr Date: Fri, 28 Jul 2023 18:14:41 +0000 Subject: [PATCH] PDFBOX-5636: optimize, as suggested by Timo Boehme git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1911330 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java index b05fc2ec926..cbe97e5f668 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java @@ -65,7 +65,7 @@ public PDLineDashPattern(COSArray array, int phase) sum2 *= 2; if (sum2 > 0) { - phase += (Math.floor(-phase / sum2) + 1) * sum2; + phase += (-phase < sum2) ? sum2 : (Math.floor(-phase / sum2) + 1) * sum2; } else {