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/31 14:54:07 UTC
svn commit: r501844 - in /xmlgraphics/batik/trunk/sources/org/apache/batik:
anim/values/ bridge/ css/engine/ css/engine/sac/ ext/awt/geom/
ext/awt/image/codec/png/ ext/awt/image/renderable/ gvt/font/
svggen/font/table/ transcoder/wmf/tosvg/
Author: dvholten
Date: Wed Jan 31 05:54:05 2007
New Revision: 501844
URL: http://svn.apache.org/viewvc?view=rev&rev=501844
Log:
1.) wipe out some more Vectors
2.) add some hashCode()
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableTransformListValue.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFontUtilities.java
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/SystemColorSupport.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/AbstractAttributeCondition.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java
xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/Glyph.java
xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/table/CmapFormat4.java
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableTransformListValue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableTransformListValue.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableTransformListValue.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/anim/values/AnimatableTransformListValue.java Wed Jan 31 05:54:05 2007
@@ -20,6 +20,7 @@
import java.util.Iterator;
import java.util.Vector;
+import java.util.List;
import org.apache.batik.dom.anim.AnimationTarget;
import org.apache.batik.dom.svg.AbstractSVGTransform;
@@ -62,14 +63,11 @@
* Creates a new AnimatableTransformListValue with a transform list.
*/
public AnimatableTransformListValue(AnimationTarget target,
- Vector transforms) {
+ List transforms) {
super(target);
- int size = transforms.size();
- this.transforms = new Vector(size);
- this.transforms.setSize(size);
- for (int i = 0; i < size; i++) {
- this.transforms.setElementAt(transforms.elementAt(i), i);
- }
+
+ this.transforms = new Vector( transforms );
+
}
/**
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=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java Wed Jan 31 05:54:05 2007
@@ -25,6 +25,7 @@
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Arrays;
+import java.util.Set;
import org.apache.batik.anim.AnimationEngine;
import org.apache.batik.anim.AnimationException;
@@ -226,12 +227,12 @@
/**
* Set of SMIL animation event names for SVG 1.1.
*/
- protected static HashSet animationEventNames11 = new HashSet();
+ protected static final Set animationEventNames11 = new HashSet();
/**
* Set of SMIL animation event names for SVG 1.2.
*/
- protected static HashSet animationEventNames12 = new HashSet();
+ protected static final Set animationEventNames12 = new HashSet();
static {
String[] eventNamesCommon = {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java Wed Jan 31 05:54:05 2007
@@ -66,7 +66,7 @@
Element paintedElement,
String iccProfileName) {
// Check if there is one if the cache.
- ICCColorSpaceExt cs = cache.request(iccProfileName.toLowerCase());
+ ICCColorSpaceExt cs = cache.request(iccProfileName.toLowerCase()); // todo locale??
if (cs != null){
return cs;
}
@@ -107,7 +107,7 @@
}
ParsedURL purl = new ParsedURL(pDocURL, href);
- if (!purl.complete())
+ if (!purl.complete())
throw new BridgeException(ctx, paintedElement, ERR_URI_MALFORMED,
new Object[] {href});
try {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFontUtilities.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFontUtilities.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFontUtilities.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGFontUtilities.java Wed Jan 31 05:54:05 2007
@@ -52,7 +52,7 @@
// FontFamily that matches
Map fontFamilyMap = ctx.getFontFamilyMap();
List ret = (List)fontFamilyMap.get(doc);
- if (ret != null)
+ if (ret != null)
return ret;
ret = new LinkedList();
@@ -79,7 +79,7 @@
}
return ret;
}
-
+
/**
* Given a font family name tries to find a matching SVG font
@@ -107,7 +107,7 @@
String fontStyle) {
// TODO: should match against font-variant as well
- String fontKeyName = fontFamilyName.toLowerCase() + " " +
+ String fontKeyName = fontFamilyName.toLowerCase() + " " + // todo locale??
fontWeight + " " + fontStyle;
// check fontFamilyMap to see if we have already created an
@@ -123,13 +123,13 @@
Document doc = textElement.getOwnerDocument();
List fontFaces = (List)fontFamilyMap.get(doc);
-
+
if (fontFaces == null) {
fontFaces = getFontFaces(doc, ctx);
fontFamilyMap.put(doc, fontFaces);
}
-
+
Iterator iter = fontFaces.iterator();
List svgFontFamilies = new LinkedList();
while (iter.hasNext()) {
@@ -143,7 +143,7 @@
if (fontFaceStyle.equals(SVG_ALL_VALUE) ||
fontFaceStyle.indexOf(fontStyle) != -1) {
GVTFontFamily ffam = fontFace.getFontFamily(ctx);
- if (ffam != null)
+ if (ffam != null)
svgFontFamilies.add(ffam);
}
}
@@ -152,7 +152,7 @@
// only found one matching svg font family
fontFamilyMap.put(fontKeyName, svgFontFamilies.get(0));
return (GVTFontFamily)svgFontFamilies.get(0);
-
+
} else if (svgFontFamilies.size() > 1) {
// need to find font face that matches the font-weight closest
String fontWeightNumber = getFontWeightNumberString(fontWeight);
@@ -199,7 +199,7 @@
String newFontFamilyWeight =
newFontFamilyWeights.get(minDifferenceIndex) +
", " + weightString;
- newFontFamilyWeights.set(minDifferenceIndex,
+ newFontFamilyWeights.set(minDifferenceIndex,
newFontFamilyWeight);
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java Wed Jan 31 05:54:05 2007
@@ -22,7 +22,8 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
@@ -183,7 +184,7 @@
// glyph-name
String nameList
= glyphElement.getAttributeNS(null, SVG_GLYPH_NAME_ATTRIBUTE);
- Vector names = new Vector();
+ List names = new ArrayList();
StringTokenizer st = new StringTokenizer(nameList, " ,");
while (st.hasMoreTokens()) {
names.add(st.nextToken());
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/SystemColorSupport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/SystemColorSupport.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/SystemColorSupport.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/SystemColorSupport.java Wed Jan 31 05:54:05 2007
@@ -22,6 +22,7 @@
import java.awt.SystemColor;
import java.util.HashMap;
import java.util.Map;
+import java.util.Locale;
import org.apache.batik.css.engine.value.FloatValue;
import org.apache.batik.css.engine.value.RGBColorValue;
@@ -41,7 +42,7 @@
* Returns the Value corresponding to the given system color.
*/
public static Value getSystemColor(String ident) {
- ident = ident.toLowerCase();
+ ident = ident.toLowerCase( ); // todo locale??
SystemColor sc = (SystemColor)factories.get(ident);
return new RGBColorValue
(new FloatValue(CSSPrimitiveValue.CSS_NUMBER, sc.getRed()),
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/AbstractAttributeCondition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/AbstractAttributeCondition.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/AbstractAttributeCondition.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/AbstractAttributeCondition.java Wed Jan 31 05:54:05 2007
@@ -56,6 +56,14 @@
}
/**
+ * equal objects should have equal hashCodes.
+ * @return hashCode of this AbstractAttributeCondition
+ */
+ public int hashCode() {
+ return value == null ? -1 : value.hashCode();
+ }
+
+ /**
* Returns the specificity of this condition.
*/
public int getSpecificity() {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSAttributeCondition.java Wed Jan 31 05:54:05 2007
@@ -73,6 +73,16 @@
}
/**
+ * equal objects should have equal hashCodes.
+ * @return hashCode of this CSSAttributeCondition
+ */
+ public int hashCode() {
+ return namespaceURI.hashCode()
+ ^ localName.hashCode()
+ ^ (specified ? -1 : 0);
+ }
+
+ /**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.Condition#getConditionType()}.
*/
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/sac/CSSPseudoClassCondition.java Wed Jan 31 05:54:05 2007
@@ -57,17 +57,26 @@
}
/**
+ * equal objects should have equal hashCodes.
+ * @return hashCode of this CSSPseudoClassCondition
+ */
+ public int hashCode() {
+ return namespaceURI.hashCode();
+ }
+
+
+ /**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.Condition#getConditionType()}.
- */
+ */
public short getConditionType() {
return SAC_PSEUDO_CLASS_CONDITION;
}
-
+
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.AttributeCondition#getNamespaceURI()}.
- */
+ */
public String getNamespaceURI() {
return namespaceURI;
}
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=501844&r1=501843&r2=501844
==============================================================================
--- 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 Wed Jan 31 05:54:05 2007
@@ -164,7 +164,7 @@
/**
* Standard <tt>Object</tt> clone method.
*/
- public Object clone() {
+ public Object clone() throws CloneNotSupportedException {
return copy();
}
@@ -213,9 +213,18 @@
return ret;
}
- public Object [] toArray(Object []a) {
+ /**
+ * fill the given array a with values from my internal <code>rects</code>.
+ * when a is not large enough, a new array is allocated, filled and returned.
+ * the method works only, when a is a Object[] or a Rectange[].
+ * When this is not the case, the a[] is just cleared.
+ *
+ * @param a array to fill (must not be null!)
+ * @return the content of rects, either in a[] or a fresh array.
+ */
+ public Object [] toArray(Object[] a) {
Class t = a.getClass().getComponentType();
- if ((t != Object.class) &
+ if ((t != Object.class) &&
(t != Rectangle.class)) {
// Nothing here for it...
Arrays.fill( a, null );
@@ -225,8 +234,7 @@
if (a.length < size)
a = new Rectangle[size];
System.arraycopy(rects, 0, a, 0, size);
- for (int i=size; i<a.length; i++)
- a[i] = null;
+ Arrays.fill( a, size, a.length, null );
return a;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java Wed Jan 31 05:54:05 2007
@@ -77,7 +77,7 @@
private ByteArrayOutputStream baos;
private DataOutputStream dos;
- public ChunkStream(String type) throws IOException {
+ ChunkStream(String type) throws IOException {
this.type = type;
this.baos = new ByteArrayOutputStream();
@@ -162,6 +162,24 @@
crc = CRC.updateCRC(crc, data, 0, len);
output.writeInt(crc ^ 0xffffffff);
}
+
+ /**
+ * this doesnt do much, its main purpose is to stop complaints
+ * about 'outputStream not closed...'.
+ *
+ * @throws IOException
+ */
+ public void close() throws IOException {
+
+ if ( baos != null ) {
+ baos.close();
+ baos = null;
+ }
+ if( dos != null ) {
+ dos.close();
+ dos= null;
+ }
+ }
}
@@ -305,6 +323,7 @@
cs.writeByte(interlace ? (byte)1 : (byte)0);
cs.writeToStream(dataOutput);
+ cs.close();
}
private byte[] prevRow = null;
@@ -489,6 +508,7 @@
private void writeIEND() throws IOException {
ChunkStream cs = new ChunkStream("IEND");
cs.writeToStream(dataOutput);
+ cs.close();
}
private static final float[] srgbChroma = {
@@ -510,6 +530,7 @@
cs.writeInt((int)(chroma[i]*100000));
}
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -527,6 +548,7 @@
// everything is different.
cs.writeInt((int)(gamma*100000/*+0.5*/));
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -536,6 +558,7 @@
byte[] ICCProfileData = param.getICCProfileData();
cs.write(ICCProfileData);
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -548,6 +571,7 @@
cs.writeByte(significantBits[i]);
}
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -558,6 +582,7 @@
int intent = param.getSRGBIntent();
cs.write(intent);
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -574,6 +599,7 @@
}
cs.writeToStream(dataOutput);
+ cs.close();
}
private void writeBKGD() throws IOException {
@@ -603,6 +629,7 @@
}
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -616,6 +643,7 @@
}
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -642,6 +670,7 @@
}
cs.writeToStream(dataOutput);
+ cs.close();
} else if (colorType == PNG_COLOR_PALETTE) {
int lastEntry = Math.min(255, alphaPalette.length - 1);
int nonOpaque;
@@ -657,6 +686,7 @@
cs.writeByte(alphaPalette[i]);
}
cs.writeToStream(dataOutput);
+ cs.close();
}
}
}
@@ -671,6 +701,7 @@
cs.writeByte((byte)dims[2]);
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -681,6 +712,7 @@
System.out.println("sPLT not supported yet.");
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -709,6 +741,7 @@
cs.writeByte(second);
cs.writeToStream(dataOutput);
+ cs.close();
}
}
@@ -727,6 +760,7 @@
cs.write(value);
cs.writeToStream(dataOutput);
+ cs.close();
}
}
}
@@ -750,6 +784,7 @@
dos.finish();
cs.writeToStream(dataOutput);
+ cs.close();
}
}
}
@@ -763,6 +798,7 @@
ChunkStream cs = new ChunkStream(type);
cs.write(data);
cs.writeToStream(dataOutput);
+ cs.close();
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java Wed Jan 31 05:54:05 2007
@@ -33,7 +33,7 @@
import java.lang.ref.SoftReference;
import java.util.Iterator;
import java.util.ListIterator;
-import java.util.Vector;
+import java.util.List;
import org.apache.batik.ext.awt.image.CompositeRule;
import org.apache.batik.ext.awt.image.GraphicsUtil;
@@ -47,7 +47,7 @@
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
* @version $Id$
*/
-public class FilterResRable8Bit extends AbstractRable
+public class FilterResRable8Bit extends AbstractRable
implements FilterResRable, PaintRable {
/**
@@ -63,7 +63,7 @@
public FilterResRable8Bit() {
// System.out.println("Using FilterResRable8bit...");
}
-
+
public FilterResRable8Bit(Filter src, int filterResX, int filterResY) {
init(src, null);
@@ -77,7 +77,7 @@
public Filter getSource() {
return (Filter)srcs.get(0);
}
-
+
/**
* Sets the source to be cropped
* @param src image to offset.
@@ -106,7 +106,7 @@
touch();
this.filterResolutionX = filterResolutionX;
}
-
+
/**
* Returns the resolution along the Y axis.
*/
@@ -117,42 +117,42 @@
/**
* Sets the resolution along the Y axis, i.e., the maximum
* size for intermediate images along that axis.
- * If the Y-value is less than zero, the scale applied to
+ * If the Y-value is less than zero, the scale applied to
* the rendered images is computed to preserve the image's aspect ratio
*/
public void setFilterResolutionY(int filterResolutionY){
touch();
this.filterResolutionY = filterResolutionY;
}
-
+
/**
* This returns true if <tt>ri</tt> and all of <tt>ri</tt>'s
* sources implement the PaintRable interface. This is used to
* indicate that the chain has a good potential for bypassing the
- * filterRes operation entirely.
- *
+ * filterRes operation entirely.
+ *
* Ideally there would be a checkPaintRable method in PaintRable
* that could be used to get a definate answer about a filters
* ability to draw directly to a Graphics2D (this can sometimes
* 'fail' because of the way the Graphics2D is currently
- * configured).
+ * configured).
*/
public boolean allPaintRable(RenderableImage ri) {
if (!(ri instanceof PaintRable))
return false;
- Vector v = ri.getSources();
+ List v = ri.getSources();
// No sources and we are PaintRable so the chain is PaintRable.
if (v == null) return true;
-
+
Iterator i = v.iterator();
while (i.hasNext()) {
RenderableImage nri = (RenderableImage)i.next();
// A source is not paintRable so we are not 100% paintRable.
if (!allPaintRable(nri)) return false;
}
-
+
return true;
}
@@ -193,13 +193,13 @@
return false;
}
- Vector v = comp.getSources();
+ List v = comp.getSources();
if (v == null) return true;
ListIterator li = v.listIterator(v.size());
while (li.hasPrevious()) {
RenderableImage csrc = (RenderableImage)li.previous();
if (!allPaintRable(csrc)) {
- li.next();
+ li.next();
break;
}
}
@@ -210,7 +210,7 @@
GraphicsUtil.drawImage(g2d, comp);
return true;
}
-
+
if (!li.hasNext())
// None of the trailing inputs are PaintRable so we don't
// distribute across this at all.
@@ -244,12 +244,12 @@
}
/**
- * Should perform the equivilent action as
+ * Should perform the equivilent action as
* createRendering followed by drawing the RenderedImage.
*
* @param g2d The Graphics2D to draw to.
* @return true if the paint call succeeded, false if
- * for some reason the paint failed (in which
+ * for some reason the paint failed (in which
* case a createRendering should be used).
*/
public boolean paintRable(Graphics2D g2d) {
@@ -289,8 +289,8 @@
double resScaleX = getFilterResolutionX()/imageRect.getWidth();
double resScaleY = getFilterResolutionY()/imageRect.getHeight();
-
- // System.out.println("filterRes X " + filterResolutionX +
+
+ // System.out.println("filterRes X " + filterResolutionX +
// " Y : " + filterResolutionY);
float resScale = (float)Math.min(resScaleX, resScaleY);
@@ -305,7 +305,7 @@
AffineTransform resUsr2Dev;
resUsr2Dev = AffineTransform.getScaleInstance(resScale, resScale);
-
+
//
// Create a new RenderingContext
//
@@ -324,10 +324,10 @@
return ret;
}
-
+
/**
- *
+ *
*/
public RenderedImage createRendering(RenderContext renderContext) {
// Get user space to device space transform
@@ -337,8 +337,8 @@
}
RenderingHints hints = renderContext.getRenderingHints();
-
- // As per specification, a value of zero for the
+
+ // As per specification, a value of zero for the
// x-axis or y-axis causes the filter to produce
// nothing.
// The processing is done as follows:
@@ -347,7 +347,7 @@
// + if the y resolution is zero, this is a no-op
// else compute the y resolution from the x scale
// and compute the corresponding y scale.
- // + if the y or x scale is less than one, insert
+ // + if the y or x scale is less than one, insert
// an AffineRable.
// Else, return the source as is.
int filterResolutionX = getFilterResolutionX();
@@ -357,7 +357,7 @@
if ((filterResolutionX <= 0) || (filterResolutionY == 0))
return null;
-
+
// Find out the renderable area
Rectangle2D imageRect = getBounds2D();
Rectangle devRect;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/Glyph.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/Glyph.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/Glyph.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/Glyph.java Wed Jan 31 05:54:05 2007
@@ -26,6 +26,7 @@
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Vector;
+import java.util.List;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.text.TextPaintInfo;
@@ -66,7 +67,7 @@
/**
* Constructs a Glyph with the specified parameters.
*/
- public Glyph(String unicode, Vector names,
+ public Glyph(String unicode, List names,
String orientation, String arabicForm, String lang,
Point2D horizOrigin, Point2D vertOrigin, float horizAdvX,
float vertAdvY, int glyphCode,
@@ -84,7 +85,7 @@
}
this.unicode = unicode;
- this.names = names;
+ this.names = new Vector( names );
this.orientation = orientation;
this.arabicForm = arabicForm;
this.lang = lang;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/table/CmapFormat4.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/table/CmapFormat4.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/table/CmapFormat4.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/svggen/font/table/CmapFormat4.java Wed Jan 31 05:54:05 2007
@@ -85,7 +85,7 @@
/*
Quoting :
http://developer.apple.com/fonts/TTRefMan/RM06/Chap6cmap.html#Surrogates
-
+
The original architecture of the Unicode Standard
allowed for all encoded characters to be represented
using sixteen bit code points. This allowed for up to
@@ -93,7 +93,7 @@
U+FFFE and U+FFFF are reserved and unavailable to
represent characters. For more details, see The Unicode
Standard.)
-
+
My comment : Isn't there a typo here ? Shouldn't we
rather read 65,534 ?
*/
@@ -104,7 +104,7 @@
if (endCode[i] >= charCode) {
if (startCode[i] <= charCode) {
if (idRangeOffset[i] > 0) {
- return glyphIdArray[idRangeOffset[i]/2 +
+ return glyphIdArray[idRangeOffset[i]/2 +
(charCode - startCode[i]) -
(segCount - i)];
} else {
@@ -122,7 +122,7 @@
}
public String toString() {
- return new StringBuffer()
+ return new StringBuffer( 80 )
.append(super.toString())
.append(", segCountX2: ")
.append(segCountX2)
@@ -133,12 +133,33 @@
.append(", rangeShift: ")
.append(rangeShift)
.append(", endCode: ")
- .append(endCode)
+ .append( intToStr( endCode ))
.append(", startCode: ")
- .append(endCode)
+ .append( intToStr( startCode ))
.append(", idDelta: ")
- .append(idDelta)
+ .append( intToStr( idDelta ))
.append(", idRangeOffset: ")
- .append(idRangeOffset).toString();
+ .append( intToStr( idRangeOffset ) ).toString();
+ }
+
+ /**
+ * local helper method to convert an int-array to String.
+ * Intended for debugging, format may change.
+ *
+ * @param array of int to convert
+ * @return a String in the form "[val,val,val ... ]"
+ */
+ private static String intToStr( int[] array ){
+ int nSlots = array.length;
+ StringBuffer workBuff = new StringBuffer( nSlots * 8 );
+ workBuff.append( '[' );
+ for( int i= 0; i < nSlots; i++ ){
+ workBuff.append( array[ i ] );
+ if ( i < nSlots-1 ) {
+ workBuff.append( ',' );
+ }
+ }
+ workBuff.append( ']');
+ return workBuff.toString();
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java?view=diff&rev=501844&r1=501843&r2=501844
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java Wed Jan 31 05:54:05 2007
@@ -632,7 +632,7 @@
int len = 2*recSize - 18;
if (len > 0) {
- byte bitmap[] = new byte[len];
+ byte[] bitmap = new byte[len];
for (int i = 0; i < len; i++)
bitmap[i] = is.readByte();
mr = new MetaRecord.ByteRecord(bitmap);