From 27b9b2ecbfca055a3aad1eddeefd2c7f4aa62ad7 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Fri, 18 Jul 2014 19:31:41 +0000 Subject: [PATCH] Removed unused code git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1611778 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/pdf/PDFFunction.java | 28 ----- src/java/org/apache/fop/pdf/PDFShading.java | 32 ------ .../apache/fop/render/gradient/Function.java | 107 ------------------ .../fop/render/gradient/GradientMaker.java | 8 +- .../apache/fop/render/gradient/Shading.java | 74 ------------ 5 files changed, 4 insertions(+), 245 deletions(-) diff --git a/src/java/org/apache/fop/pdf/PDFFunction.java b/src/java/org/apache/fop/pdf/PDFFunction.java index fd860b08c..3ce581d7f 100644 --- a/src/java/org/apache/fop/pdf/PDFFunction.java +++ b/src/java/org/apache/fop/pdf/PDFFunction.java @@ -168,13 +168,6 @@ public class PDFFunction extends PDFObject { } else if (func.getRange() != null) { return false; } - if (function.getSize() != null) { - if (!function.getSize().equals(func.getSize())) { - return false; - } - } else if (func.getSize() != null) { - return false; - } if (function.getEncode() != null) { if (!function.getEncode().equals(func.getEncode())) { return false; @@ -182,27 +175,6 @@ public class PDFFunction extends PDFObject { } else if (func.getEncode() != null) { return false; } - if (function.getDecode() != null) { - if (!function.getDecode().equals(func.getDecode())) { - return false; - } - } else if (func.getDecode() != null) { - return false; - } - if (function.getDataStream() != null) { - if (!function.getDataStream().equals(func.getDataStream())) { - return false; - } - } else if (func.getDataStream() != null) { - return false; - } - if (function.getFilter() != null) { - if (!function.getFilter().equals(func.getFilter())) { - return false; - } - } else if (func.getFilter() != null) { - return false; - } if (!Arrays.equals(function.getCZero(), func.getCZero())) { return false; } diff --git a/src/java/org/apache/fop/pdf/PDFShading.java b/src/java/org/apache/fop/pdf/PDFShading.java index e1784c59d..c4ba5b089 100644 --- a/src/java/org/apache/fop/pdf/PDFShading.java +++ b/src/java/org/apache/fop/pdf/PDFShading.java @@ -47,10 +47,6 @@ public class PDFShading extends PDFObject { private final Shading shading; private final PDFFunction pdfFunction; - /** - * A ColorSpace representing the colorspace. "DeviceRGB" is an example. - */ - protected PDFDeviceColorSpace colorSpace; /** * Constructor for Type 2 and 3 @@ -155,27 +151,6 @@ public class PDFShading extends PDFObject { } else if (other.getColorSpace() != null) { return false; } - if (shading.getBackground() != null) { - if (!shading.getBackground().equals(other.getBackground())) { - return false; - } - } else if (other.getBackground() != null) { - return false; - } - if (shading.getBBox() != null) { - if (!shading.getBBox().equals(other.getBBox())) { - return false; - } - } else if (other.getBBox() != null) { - return false; - } - if (shading.getMatrix() != null) { - if (!shading.getMatrix().equals(other.getMatrix())) { - return false; - } - } else if (other.getMatrix() != null) { - return false; - } if (shading.getCoords() != null) { if (!shading.getCoords().equals(other.getCoords())) { return false; @@ -190,13 +165,6 @@ public class PDFShading extends PDFObject { } else if (other.getExtend() != null) { return false; } - if (shading.getDecode() != null) { - if (!shading.getDecode().equals(other.getDecode())) { - return false; - } - } else if (other.getDecode() != null) { - return false; - } if (shading.getFunction() != null) { if (!shading.getFunction().equals(other.getFunction())) { return false; diff --git a/src/java/org/apache/fop/render/gradient/Function.java b/src/java/org/apache/fop/render/gradient/Function.java index 38aec8064..5099fce96 100644 --- a/src/java/org/apache/fop/render/gradient/Function.java +++ b/src/java/org/apache/fop/render/gradient/Function.java @@ -46,16 +46,6 @@ public class Function { */ private List range; - /* ********************TYPE 0***************************** */ - // FunctionType 0 specific function guts - - /** - * Required: Array containing the Integer size of the Domain and Range, respectively. - * Note: This is really more like two seperate integers, sizeDomain, and sizeRange, - * but since they're expressed as an array in PDF, my implementation reflects that. - */ - protected List size; - /** * Required for Type 0: Number of Bits used to represent each sample value. * Limited to 1,2,4,8,12,16,24, or 32 @@ -80,28 +70,6 @@ public class Function { */ private List encode; - /** - * Optional for Type 0: A 2 * n array of Doubles which provides - * a linear mapping of sample values to the range. Defaults to Range. - */ - private List decode; - - /** - * Optional For Type 0: A stream of sample values - */ - - /** - * Required For Type 4: Postscript Calculator function - * composed of arithmetic, boolean, and stack operators + boolean constants - */ - private StringBuffer functionDataStream; - - /** - * Required (possibly) For Type 0: A vector of Strings for the - * various filters to be used to decode the stream. - * These are how the string is compressed. Flate, LZW, etc. - */ - private List filter; /* *************************TYPE 2************************** */ /** @@ -258,13 +226,6 @@ public class Function { return domain; } - /** - * The function size - */ - public List getSize() { - return size; - } - /** * Gets the function encoding */ @@ -283,13 +244,6 @@ public class Function { } } - /** - * Gets the function filter - */ - public List getFilter() { - return filter; - } - /** * Gets the bits per sample of the function */ @@ -318,20 +272,6 @@ public class Function { return range; } - /** - * Gets the function decoding - */ - public List getDecode() { - return decode; - } - - /** - * Gets the function data stream - */ - public StringBuffer getDataStream() { - return functionDataStream; - } - /** * Gets the function C0 value (color for gradient) */ @@ -351,20 +291,11 @@ public class Function { out.append("<<\n/FunctionType " + functionType + "\n"); outputDomain(out, doubleFormatter); if (this.functionType == 0) { - outputSize(out, doubleFormatter); outputEncode(out, doubleFormatter); outputBitsPerSample(out); outputOrder(out); outputRange(out, doubleFormatter); - outputDecode(out, doubleFormatter); - if (functionDataStream != null) { - out.append("/Length " + (functionDataStream.length() + 1) + "\n"); - } - outputFilter(out); out.append(">>"); - if (functionDataStream != null) { - out.append("\nstream\n" + functionDataStream + "\nendstream"); - } } else if (functionType == 2) { outputRange(out, doubleFormatter); outputCZero(out, doubleFormatter); @@ -402,13 +333,7 @@ public class Function { out.append("\n>>"); } else if (functionType == 4) { outputRange(out, doubleFormatter); - if (functionDataStream != null) { - out.append("/Length " + (functionDataStream.length() + 1) + "\n"); - } out.append(">>"); - if (functionDataStream != null) { - out.append("\nstream\n{ " + functionDataStream + " }\nendstream"); - } } return out.toString(); } @@ -419,14 +344,6 @@ public class Function { p.append("\n"); } - private void outputSize(StringBuilder out, DoubleFormatter doubleFormatter) { - if (size != null) { - out.append("/Size "); - GradientMaker.outputDoubles(out, doubleFormatter, size); - out.append("\n"); - } - } - private void outputBitsPerSample(StringBuilder out) { out.append("/BitsPerSample " + bitsPerSample + "\n"); } @@ -451,30 +368,6 @@ public class Function { out.append("\n"); } - private void outputDecode(StringBuilder out, DoubleFormatter doubleFormatter) { - if (decode != null) { - out.append("/Decode "); - GradientMaker.outputDoubles(out, doubleFormatter, decode); - out.append("\n"); - } - } - - private void outputFilter(StringBuilder out) { - if (filter != null) { - int size = filter.size(); - out.append("/Filter "); - if (size == 1) { - out.append("/" + filter.get(0) + "\n"); - } else { - out.append("[ "); - for (int i = 0; i < size; i++) { - out.append("/" + filter.get(0) + " "); - } - out.append("]\n"); - } - } - } - private void outputCZero(StringBuilder out, DoubleFormatter doubleFormatter) { if (cZero != null) { out.append("/C0 [ "); diff --git a/src/java/org/apache/fop/render/gradient/GradientMaker.java b/src/java/org/apache/fop/render/gradient/GradientMaker.java index 4c8734d9f..520335dd8 100644 --- a/src/java/org/apache/fop/render/gradient/GradientMaker.java +++ b/src/java/org/apache/fop/render/gradient/GradientMaker.java @@ -47,10 +47,10 @@ public final class GradientMaker { Point2D startPoint = gp.getStartPoint(); Point2D endPoint = gp.getEndPoint(); List coords = new java.util.ArrayList(4); - coords.add(new Double(startPoint.getX())); - coords.add(new Double(startPoint.getY())); - coords.add(new Double(endPoint.getX())); - coords.add(new Double(endPoint.getY())); + coords.add(Double.valueOf(startPoint.getX())); + coords.add(Double.valueOf(startPoint.getY())); + coords.add(Double.valueOf(endPoint.getX())); + coords.add(Double.valueOf(endPoint.getY())); return makeGradient(gp, coords, baseTransform, transform); } diff --git a/src/java/org/apache/fop/render/gradient/Shading.java b/src/java/org/apache/fop/render/gradient/Shading.java index 53a6f7d9e..843081b4a 100644 --- a/src/java/org/apache/fop/render/gradient/Shading.java +++ b/src/java/org/apache/fop/render/gradient/Shading.java @@ -57,31 +57,6 @@ public class Shading { */ private final Function function; - /** - * Optional: A List specifying the clipping rectangle - */ - private final List bbox; - - /** - * Optional for Type 1: A transformation matrix - */ - private final List matrix; - - /** - * The background color. Since shading is opaque, - * this is very rarely used. - */ - private final List background; - - /** - * Required for Type 4,5,6, and 7: Array of Doubles which specifies - * how to decode coordinate and color component values. - * Each type has a differing number of decode array members, so check - * the spec. - * Page 303 in PDF Spec 1.3 - */ - private final List decode; - /** * Required for Type 2+3: An Array of two boolean values specifying * whether to extend the start and end colors past the start @@ -128,14 +103,10 @@ public class Shading { List coords, Function function) { this.shadingType = shadingType; this.colorSpace = colorSpace; - this.background = null; - this.bbox = null; this.antiAlias = false; this.coords = coords; this.function = function; this.extend = Arrays.asList(true, true); - this.matrix = null; - this.decode = null; this.bitsPerCoordinate = 0; this.bitsPerFlag = 0; this.bitsPerComponent = 0; @@ -158,22 +129,6 @@ public class Shading { return function; } - public List getBBox() { - return bbox; - } - - public List getMatrix() { - return matrix; - } - - public List getBackground() { - return background; - } - - public List getDecode() { - return decode; - } - public List getExtend() { return extend; } @@ -204,18 +159,6 @@ public class Shading { out.append("/ColorSpace /" + colorSpace.getName() + "\n"); } - if (background != null) { - out.append("/Background "); - GradientMaker.outputDoubles(out, doubleFormatter, background); - out.append("\n"); - } - - if (bbox != null) { - out.append("/BBox"); - GradientMaker.outputDoubles(out, doubleFormatter, bbox); - out.append("\n"); - } - if (antiAlias) { out.append("/AntiAlias " + antiAlias + "\n"); } @@ -243,11 +186,6 @@ public class Shading { private void outputShadingType1(StringBuilder out, DoubleFormatter doubleFormatter, Shading.FunctionRenderer functionRenderer) { - if (matrix != null) { - out.append("/Matrix "); - GradientMaker.outputDoubles(out, doubleFormatter, matrix); - out.append("\n"); - } outputFunction(out, functionRenderer); } @@ -289,12 +227,6 @@ public class Shading { out.append("/BitsPerFlag 2 \n"); } - if (decode != null) { - out.append("/Decode "); - GradientMaker.outputDoubles(out, doubleFormatter, decode); - out.append("\n"); - } - outputFunction(out, functionRenderer); } @@ -312,12 +244,6 @@ public class Shading { out.append("/BitsPerComponent 1 \n"); } - if (decode != null) { - out.append("/Decode "); - GradientMaker.outputDoubles(out, doubleFormatter, decode); - out.append("\n"); - } - outputFunction(out, functionRenderer); if (verticesPerRow > 0) { -- 2.39.5