diff options
author | Jeremias Maerki <jeremias@apache.org> | 2011-06-14 12:58:55 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2011-06-14 12:58:55 +0000 |
commit | 860ebd14107d5288d95360b04cb8e3a375922f7b (patch) | |
tree | 13a1f602c6953515b52c491f1232e42dbf6e8f2f /src/java/org/apache/fop/svg/PDFGraphics2D.java | |
parent | 59f99b381a9dd4bc2c978a80cd301a3a47179197 (diff) | |
download | xmlgraphics-fop-860ebd14107d5288d95360b04cb8e3a375922f7b.tar.gz xmlgraphics-fop-860ebd14107d5288d95360b04cb8e3a375922f7b.zip |
Fixed regression introduced with rev 1095887:
Painting state was not properly handled when painting text runs which could lead to missing color setters and therefore wrong font colors.
Removed save/restoreGraphicsState from PDFTextUtil as that doesn't update the painting state. Instead the code is now using equivalent methods from PDFGraphics2D.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1135540 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/svg/PDFGraphics2D.java')
-rw-r--r-- | src/java/org/apache/fop/svg/PDFGraphics2D.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 740de84a0..4ae8e72d7 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -624,8 +624,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand && !trans.isIdentity(); if (newClip || newTransform) { - currentStream.write("q\n"); - paintingState.save(); + saveGraphicsState(); if (newTransform) { concatMatrix(tranvals); } @@ -650,8 +649,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand applyUnknownPaint(paint, ss); if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } return; } @@ -662,8 +660,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand processPathIterator(iter); doDrawing(false, true, false); if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } } @@ -1613,8 +1610,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand && !trans.isIdentity(); if (newClip || newTransform) { - currentStream.write("q\n"); - paintingState.save(); + saveGraphicsState(); if (newTransform) { concatMatrix(tranvals); } @@ -1637,8 +1633,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand applyUnknownPaint(paint, s); if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } return; } @@ -1658,11 +1653,20 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand iter.getWindingRule() == PathIterator.WIND_EVEN_ODD); } if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } } + void saveGraphicsState() { + currentStream.write("q\n"); + paintingState.save(); + } + + void restoreGraphicsState() { + currentStream.write("Q\n"); + paintingState.restore(); + } + /** Checks whether the use of transparency is allowed. */ protected void checkTransparencyAllowed() { pdfDoc.getProfile().verifyTransparencyAllowed("Java2D graphics"); |