From bff76cd4a3e2cbb48238154abb968e6773301834 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Mon, 14 Jul 2014 21:24:52 +0000 Subject: [PATCH] Rename toWriteableString into output and added StringBuilder parameter git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1610537 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/pdf/PDFFunction.java | 4 +++- src/java/org/apache/fop/render/gradient/Function.java | 3 +-- .../org/apache/fop/render/ps/svg/PSSVGGraphics2D.java | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/fop/pdf/PDFFunction.java b/src/java/org/apache/fop/pdf/PDFFunction.java index be74dfc10..ed2d1d16c 100644 --- a/src/java/org/apache/fop/pdf/PDFFunction.java +++ b/src/java/org/apache/fop/pdf/PDFFunction.java @@ -118,7 +118,9 @@ public class PDFFunction extends PDFObject { out.append(pdfFunctions.get(functionIndex).referencePDF()); } }; - return encode(function.toWriteableString(subFunctionRenderer)); + StringBuilder out = new StringBuilder(); + function.output(out, subFunctionRenderer); + return encode(out.toString()); } /** {@inheritDoc} */ diff --git a/src/java/org/apache/fop/render/gradient/Function.java b/src/java/org/apache/fop/render/gradient/Function.java index e83f6dc05..220c5f791 100644 --- a/src/java/org/apache/fop/render/gradient/Function.java +++ b/src/java/org/apache/fop/render/gradient/Function.java @@ -338,8 +338,7 @@ public class Function { return cOne; } - public String toWriteableString(SubFunctionRenderer subFunctionRenderer) { - StringBuilder out = new StringBuilder(256); + public String output(StringBuilder out, SubFunctionRenderer subFunctionRenderer) { out.append("<<\n/FunctionType " + functionType + "\n"); outputDomain(out); if (this.functionType == 0) { diff --git a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java index b8ddc20d8..a89b16bde 100644 --- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java @@ -121,7 +121,7 @@ public class PSSVGGraphics2D extends PSGraphics2D { return p.toString(); } - private void outputShading(StringBuilder p, Shading shading) { + private void outputShading(StringBuilder out, Shading shading) { final Function function = shading.getFunction(); Shading.FunctionRenderer functionRenderer = new Shading.FunctionRenderer() { @@ -131,13 +131,13 @@ public class PSSVGGraphics2D extends PSGraphics2D { public void outputFunction(StringBuilder out, int functionIndex) { Function subFunction = function.getFunctions().get(functionIndex); assert subFunction.getFunctions().isEmpty(); - out.append(subFunction.toWriteableString(null)); + subFunction.output(out, null); } }; - out.append(function.toWriteableString(subFunctionRenderer)); + function.output(out, subFunctionRenderer); } }; - shading.output(p, functionRenderer); + shading.output(out, functionRenderer); } protected AffineTransform getBaseTransform() { -- 2.39.5