You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2007/01/30 19:00:38 UTC
svn commit: r501495 [1/2] - in
/xmlgraphics/batik/trunk/sources/org/apache/batik: anim/values/ bridge/
bridge/svg12/ css/dom/ css/engine/sac/ css/parser/ dom/ dom/anim/ dom/svg/
ext/awt/geom/ ext/awt/image/ ext/awt/image/codec/png/ ext/awt/image/codec/...
Author: dvholten
Date: Tue Jan 30 10:00:36 2007
New Revision: 501495
URL: http://svn.apache.org/viewvc?view=rev&rev=501495
Log:
1.) reduce some garbage-objects
2.) use Math.toRadians() instead of manual conversion
3.) replace manual copy and fill with System.arraycopy() and Arrays.fill
4.) replace some type var[] by type[] var
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableColorValue.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeImageElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMValue.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultAndCondition.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultChildSelector.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultConditionalSelector.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/anim/AnimationTarget.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/TraitInformation.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/DistantLight.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/BumpMap.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageWriterRegistry.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/JAffineTransformChooser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/MultiGlyphVector.java
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AWTTransformProducer.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AbstractParser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AngleParser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/FragmentIdentifierParser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/LengthParser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/PreserveAspectRatioParser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/TransformListParser.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/DefaultImageHandler.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/SVGFont.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/SVGGraphics2D.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/SVGLookupOp.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/SVGTransform.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/SVGFont.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/table/Device.java
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
xmlgraphics/batik/trunk/sources/org/apache/batik/util/Base64DecodeStream.java
xmlgraphics/batik/trunk/sources/org/apache/batik/util/Base64EncoderStream.java
xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java
xmlgraphics/batik/trunk/sources/org/apache/batik/util/RunnableQueue.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableColorValue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableColorValue.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableColorValue.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableColorValue.java Tue Jan 30 10:00:36 2007
@@ -138,8 +138,8 @@
* Returns the CSS text representation of the value.
*/
public String getCssText() {
- return "rgb(" + Math.round(red * 255) + ","
- + Math.round(green * 255) + ","
- + Math.round(blue * 255) + ")";
+ return "rgb(" + Math.round(red * 255) + ','
+ + Math.round(green * 255) + ','
+ + Math.round(blue * 255) + ')';
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java Tue Jan 30 10:00:36 2007
@@ -24,6 +24,7 @@
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Arrays;
import org.apache.batik.anim.AnimationEngine;
import org.apache.batik.anim.AnimationException;
@@ -776,9 +777,7 @@
public AnimationTickRunnable(RunnableQueue q) {
this.q = q;
// Initialize the past times to 100ms.
- for (int i = 0; i < NUM_TIMES; i++) {
- times[i] = 100;
- }
+ Arrays.fill( times, 100 );
sumTime = 100 * NUM_TIMES;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java Tue Jan 30 10:00:36 2007
@@ -212,7 +212,7 @@
if (s.length() == 0)
return 0; // default is 0
try {
- return (float)(SVGUtilities.convertSVGNumber(s)*Math.PI)/180f;
+ return (float) Math.toRadians( SVGUtilities.convertSVGNumber(s) );
} catch (NumberFormatException ex) {
throw new BridgeException
(ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java Tue Jan 30 10:00:36 2007
@@ -84,7 +84,7 @@
throw new BridgeException(ctx, filterElement,
ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_STD_DEVIATION_ATTRIBUTE,
- "" + stdDeviationXY[0] +
+ String.valueOf( stdDeviationXY[ 0 ] ) +
stdDeviationXY[1]});
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeImageElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeImageElementBridge.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeImageElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFeImageElementBridge.java Tue Jan 30 10:00:36 2007
@@ -93,15 +93,15 @@
// and it behaves like a <use> if it references a document
// fragment.
//
- // To provide this behavior, depending on whether the uri
- // contains a fragment identifier, we create either an
+ // To provide this behavior, depending on whether the uri
+ // contains a fragment identifier, we create either an
// <image> or a <use> element and request the corresponding
// bridges to build the corresponding GraphicsNode for us.
- //
- // Then, we take care of the possible transformation needed
+ //
+ // Then, we take care of the possible transformation needed
// from objectBoundingBox space to user space.
//
-
+
Document document = filterElement.getOwnerDocument();
boolean isUse = uriStr.indexOf("#") != -1;
Element contentElement = null;
@@ -113,8 +113,8 @@
SVG_IMAGE_TAG);
}
-
- contentElement.setAttributeNS(XLINK_NAMESPACE_URI,
+
+ contentElement.setAttributeNS(XLINK_NAMESPACE_URI,
XLINK_HREF_QNAME,
uriStr);
@@ -132,22 +132,18 @@
filteredNode,
defaultRegion,
ctx);
-
+
// System.err.println(">>>>>>>> primitiveRegion : " + primitiveRegion);
- contentElement.setAttributeNS(null, SVG_X_ATTRIBUTE,
- "" + primitiveRegion.getX());
- contentElement.setAttributeNS(null, SVG_Y_ATTRIBUTE,
- "" + primitiveRegion.getY());
- contentElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE,
- "" + primitiveRegion.getWidth());
- contentElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE,
- "" + primitiveRegion.getHeight());
-
+ contentElement.setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf( primitiveRegion.getX() ) );
+ contentElement.setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf( primitiveRegion.getY() ) );
+ contentElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( primitiveRegion.getWidth() ) );
+ contentElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( primitiveRegion.getHeight() ) );
+
GraphicsNode node = ctx.getGVTBuilder().build(ctx, proxyElement);
Filter filter = node.getGraphicsNodeRable(true);
-
+
// 'primitiveUnits' attribute - default is userSpaceOnUse
short coordSystemType;
String s = SVGUtilities.getChainableAttributeNS
@@ -158,7 +154,7 @@
coordSystemType = SVGUtilities.parseCoordinateSystem
(filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s, ctx);
}
-
+
// Compute the transform from object bounding box to user
// space if needed.
AffineTransform at = new AffineTransform();
@@ -178,7 +174,7 @@
defaultRegion,
filterRegion,
ctx);
- filter = new PadRable8Bit(filter, primitiveRegionUserSpace,
+ filter = new PadRable8Bit(filter, primitiveRegionUserSpace,
PadMode.ZERO_PAD);
// update the filter Map
@@ -230,18 +226,18 @@
coordSystemType = SVGUtilities.parseCoordinateSystem
(filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s, ctx);
}
-
+
if (coordSystemType == SVGUtilities.OBJECT_BOUNDING_BOX) {
at = SVGUtilities.toObjectBBox(at, filteredNode);
}
Rectangle2D bounds = filteredNode.getGeometryBounds();
at.preConcatenate(AffineTransform.getTranslateInstance
- (primitiveRegion.getX() - bounds.getX(),
+ (primitiveRegion.getX() - bounds.getX(),
primitiveRegion.getY() - bounds.getY()));
-
+
} else {
-
+
// Need to translate the image to the x, y coordinate to
// have the same behavior as the <use> element
at.translate(primitiveRegion.getX(), primitiveRegion.getY());
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java Tue Jan 30 10:00:36 2007
@@ -1617,7 +1617,7 @@
TextAttribute.ORIENTATION_ANGLE);
result.put(GVTAttributedCharacterIterator.
TextAttribute.VERTICAL_ORIENTATION_ANGLE,
- new Float(val.getFloatValue() * 180 / Math.PI));
+ new Float( Math.toDegrees( val.getFloatValue() ) ));
break;
case CSSPrimitiveValue.CSS_GRAD:
result.put(GVTAttributedCharacterIterator.
@@ -1647,7 +1647,7 @@
case CSSPrimitiveValue.CSS_RAD:
result.put(GVTAttributedCharacterIterator.
TextAttribute.HORIZONTAL_ORIENTATION_ANGLE,
- new Float(val.getFloatValue() * 180 / Math.PI));
+ new Float( Math.toDegrees( val.getFloatValue() ) ));
break;
case CSSPrimitiveValue.CSS_GRAD:
result.put(GVTAttributedCharacterIterator.
@@ -2502,7 +2502,7 @@
if ( sinTheta > 0 ) glyphAngle = Math.PI;
else glyphAngle = -Math.PI;
} else {
- glyphAngle = Math.atan(sinTheta/cosTheta);
+ glyphAngle = Math.atan(sinTheta/cosTheta); // todo is this safe??
if ( cosTheta < 0 )
glyphAngle += Math.PI;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java Tue Jan 30 10:00:36 2007
@@ -408,7 +408,7 @@
chars += ch + " ";
int w = ((Integer)aci.getAttribute(WORD_LIMIT)).intValue();
if (w >=10)
- brkStr += ""+w+" ";
+ brkStr += ""+w+" "; // todo tune stringhandling
else
brkStr += ""+w+" ";
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMValue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMValue.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMValue.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMValue.java Tue Jan 30 10:00:36 2007
@@ -318,7 +318,7 @@
case CSSPrimitiveValue.CSS_DEG:
return value.getFloatValue();
case CSSPrimitiveValue.CSS_RAD:
- return (float)(value.getFloatValue() * 180 / Math.PI);
+ return (float) Math.toDegrees( value.getFloatValue() );
case CSSPrimitiveValue.CSS_GRAD:
return (value.getFloatValue() * 9 / 5);
default:
@@ -332,7 +332,7 @@
protected static float toRadians(Value value) {
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_DEG:
- return (value.getFloatValue() * 5 / 9);
+ return (value.getFloatValue() * 5 / 9); // todo ??
case CSSPrimitiveValue.CSS_RAD:
return value.getFloatValue();
case CSSPrimitiveValue.CSS_GRAD:
@@ -348,7 +348,7 @@
protected static float toGradians(Value value) {
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_DEG:
- return (float)(value.getFloatValue() * Math.PI / 180);
+ return (float)(value.getFloatValue() * Math.PI / 180); // todo ????
case CSSPrimitiveValue.CSS_RAD:
return (float)(value.getFloatValue() * Math.PI / 100);
case CSSPrimitiveValue.CSS_GRAD:
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAndCondition.java Tue Jan 30 10:00:36 2007
@@ -41,7 +41,7 @@
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.Condition#getConditionType()}.
- */
+ */
public short getConditionType() {
return SAC_AND_CONDITION;
}
@@ -66,6 +66,6 @@
* Returns a text representation of this object.
*/
public String toString() {
- return "" + getFirstCondition() + getSecondCondition();
+ return String.valueOf( getFirstCondition() ) + getSecondCondition();
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSChildSelector.java Tue Jan 30 10:00:36 2007
@@ -76,7 +76,7 @@
public String toString() {
SimpleSelector s = getSimpleSelector();
if (s.getSelectorType() == SAC_PSEUDO_ELEMENT_SELECTOR) {
- return "" + getAncestorSelector() + s;
+ return String.valueOf( getAncestorSelector() ) + s;
}
return getAncestorSelector() + " > " + s;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSConditionalSelector.java Tue Jan 30 10:00:36 2007
@@ -102,7 +102,7 @@
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.ConditionalSelector#getSimpleSelector()}.
- */
+ */
public SimpleSelector getSimpleSelector() {
return simpleSelector;
}
@@ -110,7 +110,7 @@
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.ConditionalSelector#getCondition()}.
- */
+ */
public Condition getCondition() {
return condition;
}
@@ -119,6 +119,6 @@
* Returns a representation of the selector.
*/
public String toString() {
- return "" + simpleSelector + condition;
+ return String.valueOf( simpleSelector ) + condition;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultAndCondition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultAndCondition.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultAndCondition.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultAndCondition.java Tue Jan 30 10:00:36 2007
@@ -39,7 +39,7 @@
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.Condition#getConditionType()}.
- */
+ */
public short getConditionType() {
return SAC_AND_CONDITION;
}
@@ -48,6 +48,6 @@
* Returns a text representation of this object.
*/
public String toString() {
- return "" + getFirstCondition() + getSecondCondition();
+ return String.valueOf( getFirstCondition() ) + getSecondCondition();
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultChildSelector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultChildSelector.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultChildSelector.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultChildSelector.java Tue Jan 30 10:00:36 2007
@@ -51,7 +51,7 @@
public String toString() {
SimpleSelector s = getSimpleSelector();
if (s.getSelectorType() == SAC_PSEUDO_ELEMENT_SELECTOR) {
- return "" + getAncestorSelector() + s;
+ return String.valueOf( getAncestorSelector() ) + s;
}
return getAncestorSelector() + " > " + s;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultConditionalSelector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultConditionalSelector.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultConditionalSelector.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/DefaultConditionalSelector.java Tue Jan 30 10:00:36 2007
@@ -60,7 +60,7 @@
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.ConditionalSelector#getSimpleSelector()}.
- */
+ */
public SimpleSelector getSimpleSelector() {
return simpleSelector;
}
@@ -68,7 +68,7 @@
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.ConditionalSelector#getCondition()}.
- */
+ */
public Condition getCondition() {
return condition;
}
@@ -77,6 +77,6 @@
* Returns a representation of the selector.
*/
public String toString() {
- return "" + simpleSelector + condition;
+ return String.valueOf( simpleSelector ) + condition;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java Tue Jan 30 10:00:36 2007
@@ -1945,7 +1945,7 @@
/**
* Map of parameter names to array indexes.
*/
- protected HashMap booleanParamIndexes = new HashMap();
+ protected Map booleanParamIndexes = new HashMap();
{
for (int i = 0; i < booleanParamNames.length; i++) {
booleanParamIndexes.put(booleanParamNames[i], new Integer(i));
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java Tue Jan 30 10:00:36 2007
@@ -815,7 +815,7 @@
}
Node n = getFirstChild();
Node m = other.getFirstChild();
- while (n != null && m != null) {
+ if (n != null && m != null) {
if (!((AbstractNode) n).isEqualNode(m)) {
return false;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/anim/AnimationTarget.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/anim/AnimationTarget.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/anim/AnimationTarget.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/anim/AnimationTarget.java Tue Jan 30 10:00:36 2007
@@ -32,10 +32,10 @@
public interface AnimationTarget {
// Constants for percentage interpretation.
- public static final short PERCENTAGE_FONT_SIZE = 0;
- public static final short PERCENTAGE_VIEWPORT_WIDTH = 1;
- public static final short PERCENTAGE_VIEWPORT_HEIGHT = 2;
- public static final short PERCENTAGE_VIEWPORT_SIZE = 3;
+ short PERCENTAGE_FONT_SIZE = 0;
+ short PERCENTAGE_VIEWPORT_WIDTH = 1;
+ short PERCENTAGE_VIEWPORT_HEIGHT = 2;
+ short PERCENTAGE_VIEWPORT_SIZE = 3;
/**
* Returns the element.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java Tue Jan 30 10:00:36 2007
@@ -230,7 +230,7 @@
*/
public SVGMatrix rotate(float angle) {
AffineTransform tr = (AffineTransform)getAffineTransform().clone();
- tr.rotate(Math.PI * angle / 180);
+ tr.rotate( Math.toRadians( angle ) );
return new SVGOMMatrix(tr);
}
@@ -267,23 +267,20 @@
/**
* Implements {@link SVGMatrix#skewX(float)}.
*/
- public SVGMatrix skewX(float angle) {
+ public SVGMatrix skewX(float angleDeg) {
AffineTransform tr = (AffineTransform)getAffineTransform().clone();
tr.concatenate
- (AffineTransform.getShearInstance(Math.tan(Math.PI * angle / 180),
- 0));
+ (AffineTransform.getShearInstance( Math.tan( Math.toRadians( angleDeg )), 0));
return new SVGOMMatrix(tr);
}
/**
* Implements {@link SVGMatrix#skewY(float)}.
*/
- public SVGMatrix skewY(float angle) {
+ public SVGMatrix skewY(float angleDeg ) {
AffineTransform tr = (AffineTransform)getAffineTransform().clone();
tr.concatenate
- (AffineTransform.getShearInstance(0,
- Math.tan(Math.PI *
- angle / 180)));
+ (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( angleDeg ) ) ));
return new SVGOMMatrix(tr);
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java Tue Jan 30 10:00:36 2007
@@ -123,7 +123,7 @@
protected String getDefaultValue() {
usedDefault = true;
- return ""+getComputedTextLength();
+ return String.valueOf( getComputedTextLength() );
}
public SVGLength getBaseVal() {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/TraitInformation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/TraitInformation.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/TraitInformation.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/TraitInformation.java Tue Jan 30 10:00:36 2007
@@ -30,7 +30,7 @@
// Constants for percentage interpretation.
public static final short PERCENTAGE_FONT_SIZE = AnimationTarget.PERCENTAGE_FONT_SIZE;
public static final short PERCENTAGE_VIEWPORT_WIDTH = AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH;
- public static final short PERCENTAGE_VIEWPORT_HEIGHT = AnimationTarget.PERCENTAGE_VIEWPORT_HEIGHT;;
+ public static final short PERCENTAGE_VIEWPORT_HEIGHT = AnimationTarget.PERCENTAGE_VIEWPORT_HEIGHT;
public static final short PERCENTAGE_VIEWPORT_SIZE = AnimationTarget.PERCENTAGE_VIEWPORT_SIZE;
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java Tue Jan 30 10:00:36 2007
@@ -887,8 +887,7 @@
this.rects[i+len] = this.rects[i];
// Put the new rects in.
- for (int i=0; i<len; i++)
- this.rects[i+dstPos] = rects[i+srcPos];
+ System.arraycopy( rects, srcPos, this.rects, dstPos, len );
size += len;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/DistantLight.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/DistantLight.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/DistantLight.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/DistantLight.java Tue Jan 30 10:00:36 2007
@@ -65,9 +65,9 @@
this.azimuth = azimuth;
this.elevation = elevation;
- Lx = Math.cos(Math.PI*azimuth/180.)*Math.cos(Math.PI*elevation/180.);
- Ly = Math.sin(Math.PI*azimuth/180.)*Math.cos(Math.PI*elevation/180.);
- Lz = Math.sin(Math.PI*elevation/180);
+ Lx = Math.cos( Math.toRadians( azimuth ) ) * Math.cos( Math.toRadians( elevation ) );
+ Ly = Math.sin( Math.toRadians( azimuth ) ) * Math.cos( Math.toRadians( elevation ) );
+ Lz = Math.sin( Math.toRadians( elevation ));
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java Tue Jan 30 10:00:36 2007
@@ -122,7 +122,7 @@
this.pointAtZ = pointAtZ;
this.specularExponent = specularExponent;
this.limitingConeAngle = limitingConeAngle;
- this.limitingCos = Math.cos(limitingConeAngle*Math.PI/180.0);
+ this.limitingCos = Math.cos( Math.toRadians( limitingConeAngle ) );
S[0] = pointAtX - lightX;
S[1] = pointAtY - lightY;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java Tue Jan 30 10:00:36 2007
@@ -75,19 +75,19 @@
byte[] data;
int crc;
- String typeString;
+ final String typeString;
- public PNGChunk(int length, int type, byte[] data, int crc) {
+ PNGChunk(int length, int type, byte[] data, int crc) {
this.length = length;
this.type = type;
this.data = data;
this.crc = crc;
- typeString = "";
- typeString += (char)(type >> 24);
- typeString += (char)((type >> 16) & 0xff);
- typeString += (char)((type >> 8) & 0xff);
- typeString += (char)(type & 0xff);
+ typeString = ""
+ + (char)((type >>> 24) & 0xff)
+ + (char)((type >>> 16) & 0xff)
+ + (char)((type >>> 8) & 0xff)
+ + (char)((type ) & 0xff);
}
public int getLength() {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java Tue Jan 30 10:00:36 2007
@@ -48,6 +48,7 @@
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
+import java.util.Collections;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
@@ -279,7 +280,7 @@
private static final int POST_ADD_GRAY_TRANS_EXP =
POST_ADD_GRAY_TRANS | POST_EXP_MASK;
- private Vector streamVec = new Vector();
+ private List streamVec = new ArrayList();
private DataInputStream dataStream;
private int bytesPerPixel; // number of bytes per input pixel
@@ -749,7 +750,7 @@
// Parse prior IDAT chunks
InputStream seqStream =
- new SequenceInputStream(streamVec.elements());
+ new SequenceInputStream( Collections.enumeration( streamVec ));
InputStream infStream =
new InflaterInputStream(seqStream, new Inflater());
dataStream = new DataInputStream(infStream);
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java Tue Jan 30 10:00:36 2007
@@ -50,7 +50,7 @@
* @see TIFFField
* @version $Id$
*/
-public class TIFFDirectory extends Object implements Serializable {
+public class TIFFDirectory implements Serializable {
/** A boolean storing the endianness of the stream. */
boolean isBigEndian;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java Tue Jan 30 10:00:36 2007
@@ -37,7 +37,7 @@
* @see TIFFDirectory
* @version $Id$
*/
-public class TIFFField extends Object implements Comparable, Serializable {
+public class TIFFField implements Comparable, Serializable {
/** Flag for 8 bit unsigned integers. */
public static final int TIFF_BYTE = 1;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java Tue Jan 30 10:00:36 2007
@@ -109,7 +109,7 @@
/**
* Constant: 3*sqrt(2*PI)/4
*/
- static final float DSQRT2PI = (float)(Math.sqrt(2*Math.PI)*3.0/4.0);
+ static final double DSQRT2PI = (Math.sqrt(2*Math.PI)*3.0/4.0);
/**
* Grow the source's bounds
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/BumpMap.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/BumpMap.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/BumpMap.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/BumpMap.java Tue Jan 30 10:00:36 2007
@@ -66,7 +66,7 @@
/**
* @return surface scale used by this bump map.
*/
- public final double getSurfaceScale(){
+ public double getSurfaceScale(){
return surfaceScale;
}
@@ -74,7 +74,7 @@
* @param x x-axis coordinate for which the normal is computed
* @param y y-axis coordinate for which the normal is computed
*/
- public final double[][][] getNormalArray
+ public double[][][] getNormalArray
(final int x, final int y,
final int w, final int h)
{
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageWriterRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageWriterRegistry.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageWriterRegistry.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageWriterRegistry.java Tue Jan 30 10:00:36 2007
@@ -30,9 +30,9 @@
*/
public class ImageWriterRegistry {
- private static ImageWriterRegistry instance;
+ private static volatile ImageWriterRegistry instance;
- private volatile Map imageWriterMap = new HashMap();
+ private final Map imageWriterMap = new HashMap();
private ImageWriterRegistry() {
setup();
@@ -62,6 +62,11 @@
imageWriterMap.put(writer.getMIMEType(), writer);
}
+ /**
+ * get the ImageWriter registered for mime, or null.
+ * @param mime used for lookup
+ * @return the registered ImageWriter (maybe null)
+ */
public ImageWriter getWriterFor(String mime) {
return (ImageWriter)imageWriterMap.get(mime);
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/JAffineTransformChooser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/JAffineTransformChooser.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/JAffineTransformChooser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/JAffineTransformChooser.java Tue Jan 30 10:00:36 2007
@@ -281,12 +281,15 @@
double[] m = new double[6];
- m[0] = sx*Math.cos(theta);
- m[1] = sx*Math.sin(theta);
- m[2] = -sy*Math.sin(theta);
- m[3] = sy*Math.cos(theta);
- m[4] = tx + rx - rx*Math.cos(theta) + ry*Math.sin(theta);
- m[5] = ty + ry - rx*Math.sin(theta) - ry*Math.cos(theta);
+ final double SIN_THETA = Math.sin( theta );
+ final double COS_THETA = Math.cos( theta );
+
+ m[0] = sx * COS_THETA;
+ m[1] = sx * SIN_THETA;
+ m[2] = -sy * SIN_THETA;
+ m[3] = sy * COS_THETA;
+ m[4] = tx + rx - rx * COS_THETA + ry * SIN_THETA;
+ m[5] = ty + ry - rx * SIN_THETA - ry * COS_THETA;
txf = new AffineTransform(m);
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikStarElementBridge.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikStarElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikStarElementBridge.java Tue Jan 30 10:00:36 2007
@@ -35,8 +35,8 @@
* @author <a href="mailto:thomas.deweese@kodak.com">Thomas Deweese</a>
* @version $Id$
*/
-public class BatikStarElementBridge
- extends SVGDecoratedShapeElementBridge
+public class BatikStarElementBridge
+ extends SVGDecoratedShapeElementBridge
implements BatikExtConstants {
/**
@@ -117,11 +117,14 @@
// 'sides' attribute - default is 3
int sides = convertSides(e, BATIK_EXT_SIDES_ATTRIBUTE, 3, ctx);
-
+
GeneralPath gp = new GeneralPath();
double angle, x, y;
+ final double SECTOR = 2.0 * Math.PI/sides;
+ final double HALF_PI = Math.PI / 2.0;
+
for (int i=0; i<sides; i++) {
- angle = (i)*(2*Math.PI/sides) - (Math.PI/2);
+ angle = i * SECTOR - HALF_PI;
x = cx + ir*Math.cos(angle);
y = cy - ir*Math.sin(angle);
if (i==0)
@@ -129,7 +132,7 @@
else
gp.lineTo((float)x, (float)y);
- angle = (i+0.5)*(2*Math.PI/sides) - (Math.PI/2);
+ angle = (i+0.5) * SECTOR - HALF_PI;
x = cx + r*Math.cos(angle);
y = cy - r*Math.sin(angle);
gp.lineTo((float)x, (float)y);
@@ -167,7 +170,7 @@
new Object[] {attrName, s});
}
- if (ret <3)
+ if (ret <3)
throw new BridgeException
(ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {attrName, s});
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java Tue Jan 30 10:00:36 2007
@@ -570,7 +570,7 @@
}
/**
- * Returns the rotation according to the specified parameters.
+ * Returns the rotation according to the specified parameters in degrees.
*/
private double computeRotation(double[] prev, int prevSegType,
double[] curr, int currSegType,
@@ -604,9 +604,9 @@
if (dx == 0 && dy == 0) {
// The two vectors are exact opposites. There is no way to
// know which direction to go (+90 or -90). Choose +90
- return Math.atan2(inSlope[1], inSlope[0])*180./Math.PI + 90;
+ return Math.toDegrees( Math.atan2(inSlope[1], inSlope[0]) ) + 90;
} else {
- return Math.atan2(dy, dx)*180./Math.PI;
+ return Math.toDegrees( Math.atan2(dy, dx) );
}
}
@@ -802,7 +802,7 @@
markerPosition.getY() - ref.getY());
if (!Double.isNaN(rotation)) {
- txf.rotate(rotation*Math.PI/180., ref.getX(), ref.getY());
+ txf.rotate( Math.toRadians( rotation ), ref.getX(), ref.getY());
}
return txf;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/MultiGlyphVector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/MultiGlyphVector.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/MultiGlyphVector.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/MultiGlyphVector.java Tue Jan 30 10:00:36 2007
@@ -270,8 +270,7 @@
tmp = new float[len*2];
gv.getGlyphPositions(gi, len, tmp);
- for (int j=0; j<len*2; j++)
- ret[i+j] = tmp[j];
+ System.arraycopy( tmp, 0, ret, i, len * 2 );
}
gi=0;
gvIdx++;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java Tue Jan 30 10:00:36 2007
@@ -30,6 +30,7 @@
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
+import java.awt.geom.Line2D;
import java.text.AttributedCharacterIterator;
import java.text.CharacterIterator;
import java.util.HashSet;
@@ -656,7 +657,8 @@
return shape;
}
- public static final float eps = 0.00001f;
+ public static final double eps = 0.00001;
+
public static boolean epsEQ(double a, double b) {
return ((a+eps > b) && (a-eps < b));
}
@@ -1002,7 +1004,7 @@
Rectangle2D logicalBounds = gv.getLogicalBounds();
return overlineStroke.createStrokedShape(
- new java.awt.geom.Line2D.Double(
+ new Line2D.Double(
logicalBounds.getMinX() + overlineThickness/2.0, offset.getY()+y,
logicalBounds.getMaxX() - overlineThickness/2.0, offset.getY()+y));
}
@@ -1031,7 +1033,7 @@
Rectangle2D logicalBounds = gv.getLogicalBounds();
return underlineStroke.createStrokedShape(
- new java.awt.geom.Line2D.Double(
+ new Line2D.Double(
logicalBounds.getMinX() + underlineThickness/2.0, offset.getY()+y,
logicalBounds.getMaxX() - underlineThickness/2.0, offset.getY()+y));
}
@@ -1054,7 +1056,7 @@
Rectangle2D logicalBounds = gv.getLogicalBounds();
return strikethroughStroke.createStrokedShape(
- new java.awt.geom.Line2D.Double(
+ new Line2D.Double(
logicalBounds.getMinX() + strikethroughThickness/2.0, offset.getY()+y,
logicalBounds.getMaxX() - strikethroughThickness/2.0, offset.getY()+y));
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AWTTransformProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AWTTransformProducer.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AWTTransformProducer.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AWTTransformProducer.java Tue Jan 30 10:00:36 2007
@@ -94,7 +94,7 @@
*/
public void rotate(float theta) throws ParseException {
affineTransform.concatenate
- (AffineTransform.getRotateInstance(Math.PI * theta / 180));
+ (AffineTransform.getRotateInstance( Math.toRadians( theta ) ));
}
/**
@@ -102,7 +102,7 @@
*/
public void rotate(float theta, float cx, float cy) throws ParseException {
AffineTransform at
- = AffineTransform.getRotateInstance(Math.PI * theta / 180, cx, cy);
+ = AffineTransform.getRotateInstance( Math.toRadians( theta ), cx, cy);
affineTransform.concatenate(at);
}
@@ -141,8 +141,7 @@
*/
public void skewX(float skx) throws ParseException {
affineTransform.concatenate
- (AffineTransform.getShearInstance(Math.tan(Math.PI * skx / 180),
- 0));
+ (AffineTransform.getShearInstance(Math.tan( Math.toRadians( skx ) ), 0));
}
/**
@@ -150,8 +149,7 @@
*/
public void skewY(float sky) throws ParseException {
affineTransform.concatenate
- (AffineTransform.getShearInstance(0,
- Math.tan(Math.PI * sky / 180)));
+ (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( sky ) )));
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AbstractParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AbstractParser.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AbstractParser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AbstractParser.java Tue Jan 30 10:00:36 2007
@@ -175,6 +175,21 @@
}
/**
+ * simple api to call often reported error.
+ * Just a wrapper for reportError().
+ *
+ * @param expectedChar what caller expected
+ * @param currentChar what caller found
+ */
+ protected void reportCharacterExpectedError( char expectedChar, int currentChar ){
+ reportError("character.expected",
+ new Object[] { new Character( expectedChar ),
+ new Integer( currentChar ) });
+
+ }
+
+
+ /**
* Returns a localized error message.
* @param key The message key in the resource bundle.
* @param args The message arguments.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AngleParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AngleParser.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AngleParser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/AngleParser.java Tue Jan 30 10:00:36 2007
@@ -27,7 +27,6 @@
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @version $Id$
*/
-
public class AngleParser extends NumberParser {
/**
@@ -65,7 +64,7 @@
current = reader.read();
skipSpaces();
-
+
try {
float f = parseFloat();
@@ -76,21 +75,17 @@
case 0xD: case 0xA: case 0x20: case 0x9:
break s;
}
-
+
switch (current) {
case 'd':
current = reader.read();
if (current != 'e') {
- reportError("character.expected",
- new Object[] { new Character('e'),
- new Integer(current) });
+ reportCharacterExpectedError('e', current );
break;
}
current = reader.read();
if (current != 'g') {
- reportError("character.expected",
- new Object[] { new Character('g'),
- new Integer(current) });
+ reportCharacterExpectedError('g', current );
break;
}
angleHandler.deg();
@@ -99,23 +94,17 @@
case 'g':
current = reader.read();
if (current != 'r') {
- reportError("character.expected",
- new Object[] { new Character('r'),
- new Integer(current) });
+ reportCharacterExpectedError('r', current );
break;
}
current = reader.read();
if (current != 'a') {
- reportError("character.expected",
- new Object[] { new Character('a'),
- new Integer(current) });
+ reportCharacterExpectedError('a', current );
break;
}
current = reader.read();
if (current != 'd') {
- reportError("character.expected",
- new Object[] { new Character('d'),
- new Integer(current) });
+ reportCharacterExpectedError('d', current );
break;
}
angleHandler.grad();
@@ -124,16 +113,12 @@
case 'r':
current = reader.read();
if (current != 'a') {
- reportError("character.expected",
- new Object[] { new Character('a'),
- new Integer(current) });
+ reportCharacterExpectedError('a', current );
break;
}
current = reader.read();
if (current != 'd') {
- reportError("character.expected",
- new Object[] { new Character('d'),
- new Integer(current) });
+ reportCharacterExpectedError('d', current );
break;
}
angleHandler.rad();
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/FragmentIdentifierParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/FragmentIdentifierParser.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/FragmentIdentifierParser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/FragmentIdentifierParser.java Tue Jan 30 10:00:36 2007
@@ -170,9 +170,7 @@
fragmentIdentifierHandler.idReference(id);
if (current != q) {
- reportError("character.expected",
- new Object[] { new Character(q),
- new Integer(current) });
+ reportCharacterExpectedError( q, current );
break ident;
}
current = reader.read();
@@ -1441,20 +1439,6 @@
break loop;
}
}
- }
-
- /**
- * Convenience method to simplify error-reporting.
- * We just wrap the data into a call to
- * {@link #reportError(String,Object[])}.
- *
- * @param exp the expected character
- * @param actual character from input
- */
- private void reportCharacterExpectedError( char exp, int actual ){
- reportError("character.expected",
- new Object[] { new Character( exp ),
- new Integer( actual ) });
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/LengthParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/LengthParser.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/LengthParser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/LengthParser.java Tue Jan 30 10:00:36 2007
@@ -68,7 +68,7 @@
current = reader.read();
skipSpaces();
-
+
parseLength();
skipSpaces();
@@ -116,8 +116,8 @@
l: for (;;) {
current = reader.read();
switch (current) {
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
break l;
default:
break m1;
@@ -125,8 +125,8 @@
}
}
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
mantRead = true;
l: for (;;) {
if (mantDig < 9) {
@@ -139,12 +139,12 @@
switch (current) {
default:
break l;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- }
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ }
}
}
-
+
if (current == '.') {
current = reader.read();
m2: switch (current) {
@@ -163,8 +163,8 @@
current = reader.read();
expAdj--;
switch (current) {
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
break l;
default:
break m2;
@@ -172,8 +172,8 @@
}
}
}
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
l: for (;;) {
if (mantDig < 9) {
mantDig++;
@@ -184,8 +184,8 @@
switch (current) {
default:
break l;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
}
}
}
@@ -227,20 +227,20 @@
reportError("character.unexpected",
new Object[] { new Integer(current) });
return;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
}
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
}
-
+
en: switch (current) {
case '0':
l: for (;;) {
current = reader.read();
switch (current) {
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
break l;
default:
break en;
@@ -248,8 +248,8 @@
}
}
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
l: for (;;) {
if (expDig < 3) {
expDig++;
@@ -259,8 +259,8 @@
switch (current) {
default:
break l;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
}
}
}
@@ -330,9 +330,7 @@
case 'i':
current = reader.read();
if (current != 'n') {
- reportError("character.expected",
- new Object[] { new Character('n'),
- new Integer(current) });
+ reportCharacterExpectedError( 'n',current );
break;
}
lengthHandler.in();
@@ -341,9 +339,7 @@
case 'c':
current = reader.read();
if (current != 'm') {
- reportError("character.expected",
- new Object[] { new Character('m'),
- new Integer(current) });
+ reportCharacterExpectedError( 'm',current );
break;
}
lengthHandler.cm();
@@ -352,9 +348,7 @@
case 'm':
current = reader.read();
if (current != 'm') {
- reportError("character.expected",
- new Object[] { new Character('m'),
- new Integer(current) });
+ reportCharacterExpectedError( 'm',current );
break;
}
lengthHandler.mm();
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/PreserveAspectRatioParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/PreserveAspectRatioParser.java?view=diff&rev=501495&r1=501494&r2=501495
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/PreserveAspectRatioParser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/PreserveAspectRatioParser.java Tue Jan 30 10:00:36 2007
@@ -86,25 +86,19 @@
case 'n':
current = reader.read();
if (current != 'o') {
- reportError("character.expected",
- new Object[] { new Character('o'),
- new Integer(current) });
+ reportCharacterExpectedError( 'o',current );
skipIdentifier();
break align;
}
current = reader.read();
if (current != 'n') {
- reportError("character.expected",
- new Object[] { new Character('n'),
- new Integer(current) });
+ reportCharacterExpectedError( 'o',current );
skipIdentifier();
break align;
}
current = reader.read();
if (current != 'e') {
- reportError("character.expected",
- new Object[] { new Character('e'),
- new Integer(current) });
+ reportCharacterExpectedError( 'e',current );
skipIdentifier();
break align;
}
@@ -116,9 +110,7 @@
case 'x':
current = reader.read();
if (current != 'M') {
- reportError("character.expected",
- new Object[] { new Character('M'),
- new Integer(current) });
+ reportCharacterExpectedError( 'M',current );
skipIdentifier();
break;
}
@@ -127,25 +119,19 @@
case 'a':
current = reader.read();
if (current != 'x') {
- reportError("character.expected",
- new Object[] { new Character('x'),
- new Integer(current) });
+ reportCharacterExpectedError( 'x',current );
skipIdentifier();
break align;
}
current = reader.read();
if (current != 'Y') {
- reportError("character.expected",
- new Object[] { new Character('Y'),
- new Integer(current) });
+ reportCharacterExpectedError( 'Y',current );
skipIdentifier();
break align;
}
current = reader.read();
if (current != 'M') {
- reportError("character.expected",
- new Object[] { new Character('M'),
- new Integer(current) });
+ reportCharacterExpectedError( 'M',current );
skipIdentifier();
break align;
}
@@ -154,9 +140,7 @@
case 'a':
current = reader.read();
if (current != 'x') {
- reportError("character.expected",
- new Object[] { new Character('x'),
- new Integer(current) });
+ reportCharacterExpectedError( 'x',current );
skipIdentifier();
break align;
}
@@ -188,17 +172,13 @@
case 'd':
current = reader.read();
if (current != 'Y') {
- reportError("character.expected",
- new Object[] { new Character('Y'),
- new Integer(current) });
+ reportCharacterExpectedError( 'Y',current );
skipIdentifier();
break align;
}
current = reader.read();
if (current != 'M') {
- reportError("character.expected",
- new Object[] { new Character('M'),
- new Integer(current) });
+ reportCharacterExpectedError( 'M',current );
skipIdentifier();
break align;
}
@@ -207,10 +187,7 @@
case 'a':
current = reader.read();
if (current != 'x') {
- reportError
- ("character.expected",
- new Object[] { new Character('x'),
- new Integer(current) });
+ reportCharacterExpectedError( 'x',current );
skipIdentifier();
break align;
}
@@ -239,17 +216,13 @@
case 'n':
current = reader.read();
if (current != 'Y') {
- reportError("character.expected",
- new Object[] { new Character('Y'),
- new Integer(current) });
+ reportCharacterExpectedError( 'Y',current );
skipIdentifier();
break align;
}
current = reader.read();
if (current != 'M') {
- reportError("character.expected",
- new Object[] { new Character('M'),
- new Integer(current) });
+ reportCharacterExpectedError( 'M',current );
skipIdentifier();
break align;
}
@@ -258,10 +231,7 @@
case 'a':
current = reader.read();
if (current != 'x') {
- reportError
- ("character.expected",
- new Object[] { new Character('x'),
- new Integer(current) });
+ reportCharacterExpectedError( 'x',current );
skipIdentifier();
break align;
}
@@ -315,25 +285,19 @@
case 'm':
current = reader.read();
if (current != 'e') {
- reportError("character.expected",
- new Object[] { new Character('e'),
- new Integer(current) });
+ reportCharacterExpectedError( 'e',current );
skipIdentifier();
break;
}
current = reader.read();
if (current != 'e') {
- reportError("character.expected",
- new Object[] { new Character('e'),
- new Integer(current) });
+ reportCharacterExpectedError( 'e',current );
skipIdentifier();
break;
}
current = reader.read();
if (current != 't') {
- reportError("character.expected",
- new Object[] { new Character('t'),
- new Integer(current) });
+ reportCharacterExpectedError( 't',current );
skipIdentifier();
break;
}
@@ -343,33 +307,25 @@
case 's':
current = reader.read();
if (current != 'l') {
- reportError("character.expected",
- new Object[] { new Character('l'),
- new Integer(current) });
+ reportCharacterExpectedError( 'l',current );
skipIdentifier();
break;
}
current = reader.read();
if (current != 'i') {
- reportError("character.expected",
- new Object[] { new Character('i'),
- new Integer(current) });
+ reportCharacterExpectedError( 'i',current );
skipIdentifier();
break;
}
current = reader.read();
if (current != 'c') {
- reportError("character.expected",
- new Object[] { new Character('c'),
- new Integer(current) });
+ reportCharacterExpectedError( 'c',current );
skipIdentifier();
break;
}
current = reader.read();
if (current != 'e') {
- reportError("character.expected",
- new Object[] { new Character('e'),
- new Integer(current) });
+ reportCharacterExpectedError( 'e',current );
skipIdentifier();
break;
}