Author: tilman Date: Wed Aug 27 18:52:30 2025 New Revision: 1928051 Log: PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #225
Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java ============================================================================== --- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java Wed Aug 27 18:47:08 2025 (r1928050) +++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java Wed Aug 27 18:52:30 2025 (r1928051) @@ -287,17 +287,18 @@ public abstract class PDFStreamEngine PDResources parent = pushResources(charProc); Deque<PDGraphicsState> savedStack = saveGraphicsStack(); + PDGraphicsState graphicsState = getGraphicsState(); // replace the CTM with the TRM - getGraphicsState().setCurrentTransformationMatrix(textRenderingMatrix); + graphicsState.setCurrentTransformationMatrix(textRenderingMatrix); // transform the CTM using the stream's matrix (this is the FontMatrix) textRenderingMatrix.concatenate(charProc.getMatrix()); // note: we don't clip to the BBox as it is often wrong, see PDFBOX-1917 - getGraphicsState().setTextMatrix(new Matrix()); - getGraphicsState().setTextLineMatrix(new Matrix()); + graphicsState.setTextMatrix(new Matrix()); + graphicsState.setTextLineMatrix(new Matrix()); try {