You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by vh...@apache.org on 2014/02/11 19:45:00 UTC
svn commit: r1567285 - in
/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics:
image/ image/codec/png/ image/codec/tiff/ image/rendered/ java2d/ util/io/
Author: vhennebert
Date: Tue Feb 11 18:45:00 2014
New Revision: 1567285
URL: http://svn.apache.org/r1567285
Log:
Fix NeedBraces
Modified:
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java Tue Feb 11 18:45:00 2014
@@ -167,8 +167,9 @@ public final class GraphicsUtil {
public static CachableRed convertToLsRGB(CachableRed src) {
ColorModel cm = src.getColorModel();
ColorSpace cs = cm.getColorSpace();
- if (cs == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))
+ if (cs == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)) {
return src;
+ }
return new Any2LsRGBRed(src);
}
@@ -186,8 +187,9 @@ public final class GraphicsUtil {
public static CachableRed convertTosRGB(CachableRed src) {
ColorModel cm = src.getColorModel();
ColorSpace cs = cm.getColorSpace();
- if (cs == ColorSpace.getInstance(ColorSpace.CS_sRGB))
+ if (cs == ColorSpace.getInstance(ColorSpace.CS_sRGB)) {
return src;
+ }
return new Any2sRGBRed(src);
}
@@ -206,10 +208,12 @@ public final class GraphicsUtil {
* @return a CacheableRed that contains the same data as ri.
*/
public static CachableRed wrap(RenderedImage ri) {
- if (ri instanceof CachableRed)
+ if (ri instanceof CachableRed) {
return (CachableRed) ri;
- if (ri instanceof BufferedImage)
+ }
+ if (ri instanceof BufferedImage) {
return new BufferedImageCachableRed((BufferedImage)ri);
+ }
return new RenderedImageCachableRed(ri);
}
@@ -227,18 +231,24 @@ public final class GraphicsUtil {
public static void copyData_INT_PACK(Raster src, WritableRaster dst) {
// System.out.println("Fast copyData");
int x0 = dst.getMinX();
- if (x0 < src.getMinX()) x0 = src.getMinX();
+ if (x0 < src.getMinX()) {
+ x0 = src.getMinX();
+ }
int y0 = dst.getMinY();
- if (y0 < src.getMinY()) y0 = src.getMinY();
+ if (y0 < src.getMinY()) {
+ y0 = src.getMinY();
+ }
int x1 = dst.getMinX() + dst.getWidth() - 1;
- if (x1 > src.getMinX() + src.getWidth() - 1)
+ if (x1 > src.getMinX() + src.getWidth() - 1) {
x1 = src.getMinX() + src.getWidth() - 1;
+ }
int y1 = dst.getMinY() + dst.getHeight() - 1;
- if (y1 > src.getMinY() + src.getHeight() - 1)
+ if (y1 > src.getMinY() + src.getHeight() - 1) {
y1 = src.getMinY() + src.getHeight() - 1;
+ }
int width = x1 - x0 + 1;
int height = y1 - y0 + 1;
@@ -284,8 +294,9 @@ public final class GraphicsUtil {
for (int y = 0; y < height; y++) {
int srcSP = srcBase + y * srcScanStride;
int dstSP = dstBase + y * dstScanStride;
- for (int x = 0; x < width; x++)
+ for (int x = 0; x < width; x++) {
dstPixels[dstSP++] = srcPixels[srcSP++];
+ }
}
}
}
@@ -294,18 +305,24 @@ public final class GraphicsUtil {
// System.out.println("Fallback copyData");
int x0 = dst.getMinX();
- if (x0 < src.getMinX()) x0 = src.getMinX();
+ if (x0 < src.getMinX()) {
+ x0 = src.getMinX();
+ }
int y0 = dst.getMinY();
- if (y0 < src.getMinY()) y0 = src.getMinY();
+ if (y0 < src.getMinY()) {
+ y0 = src.getMinY();
+ }
int x1 = dst.getMinX() + dst.getWidth() - 1;
- if (x1 > src.getMinX() + src.getWidth() - 1)
+ if (x1 > src.getMinX() + src.getWidth() - 1) {
x1 = src.getMinX() + src.getWidth() - 1;
+ }
int y1 = dst.getMinY() + dst.getHeight() - 1;
- if (y1 > src.getMinY() + src.getHeight() - 1)
+ if (y1 > src.getMinY() + src.getHeight() - 1) {
y1 = src.getMinY() + src.getHeight() - 1;
+ }
int width = x1 - x0 + 1;
int [] data = null;
@@ -499,8 +516,9 @@ public final class GraphicsUtil {
*/
public static ColorModel
coerceColorModel(ColorModel cm, boolean newAlphaPreMult) {
- if (cm.isAlphaPremultiplied() == newAlphaPreMult)
+ if (cm.isAlphaPremultiplied() == newAlphaPreMult) {
return cm;
+ }
// Easiest way to build proper colormodel for new Alpha state...
// Eventually this should switch on known ColorModel types and
@@ -523,13 +541,15 @@ public final class GraphicsUtil {
// System.out.println("CoerceData: " + cm.isAlphaPremultiplied() +
// " Out: " + newAlphaPreMult);
- if (!cm.hasAlpha())
+ if (!cm.hasAlpha()) {
// Nothing to do no alpha channel
return cm;
+ }
- if (cm.isAlphaPremultiplied() == newAlphaPreMult)
+ if (cm.isAlphaPremultiplied() == newAlphaPreMult) {
// nothing to do alpha state matches...
return cm;
+ }
// System.out.println("CoerceData: " + wr.getSampleModel());
@@ -543,11 +563,11 @@ public final class GraphicsUtil {
}
public static void multiplyAlpha(WritableRaster wr) {
- if (is_BYTE_COMP_Data(wr.getSampleModel()))
+ if (is_BYTE_COMP_Data(wr.getSampleModel())) {
mult_BYTE_COMP_Data(wr);
- else if (is_INT_PACK_Data(wr.getSampleModel(), true))
+ } else if (is_INT_PACK_Data(wr.getSampleModel(), true)) {
mult_INT_PACK_Data(wr);
- else {
+ } else {
int [] pixel = null;
int bands = wr.getNumBands();
float norm = 1f / 255f;
@@ -557,26 +577,28 @@ public final class GraphicsUtil {
x1 = x0 + wr.getWidth();
y0 = wr.getMinY();
y1 = y0 + wr.getHeight();
- for (int y = y0; y < y1; y++)
+ for (int y = y0; y < y1; y++) {
for (int x = x0; x < x1; x++) {
pixel = wr.getPixel(x, y, pixel);
a = pixel[bands - 1];
if ((a >= 0) && (a < 255)) {
alpha = a * norm;
- for (b = 0; b < bands - 1; b++)
+ for (b = 0; b < bands - 1; b++) {
pixel[b] = (int)(pixel[b] * alpha + 0.5f);
+ }
wr.setPixel(x, y, pixel);
}
}
+ }
}
}
public static void divideAlpha(WritableRaster wr) {
- if (is_BYTE_COMP_Data(wr.getSampleModel()))
+ if (is_BYTE_COMP_Data(wr.getSampleModel())) {
divide_BYTE_COMP_Data(wr);
- else if (is_INT_PACK_Data(wr.getSampleModel(), true))
+ } else if (is_INT_PACK_Data(wr.getSampleModel(), true)) {
divide_INT_PACK_Data(wr);
- else {
+ } else {
int x0, x1, y0, y1, a, b;
float ialpha;
int bands = wr.getNumBands();
@@ -586,17 +608,19 @@ public final class GraphicsUtil {
x1 = x0 + wr.getWidth();
y0 = wr.getMinY();
y1 = y0 + wr.getHeight();
- for (int y = y0; y < y1; y++)
+ for (int y = y0; y < y1; y++) {
for (int x = x0; x < x1; x++) {
pixel = wr.getPixel(x, y, pixel);
a = pixel[bands - 1];
if ((a > 0) && (a < 255)) {
ialpha = 255 / (float)a;
- for (b = 0; b < bands - 1; b++)
+ for (b = 0; b < bands - 1; b++) {
pixel[b] = (int)(pixel[b] * ialpha + 0.5f);
+ }
wr.setPixel(x, y, pixel);
}
}
+ }
}
}
@@ -643,13 +667,14 @@ public final class GraphicsUtil {
// System.out.println("Dst has: " + dstAlpha +
// " is: " + dst.isAlphaPremultiplied());
- if (srcAlpha == dstAlpha)
+ if (srcAlpha == dstAlpha) {
if (!srcAlpha ||
src.isAlphaPremultiplied() == dst.isAlphaPremultiplied()) {
// They match one another so just copy everything...
copyData(src.getRaster(), dst.getRaster());
return;
}
+ }
// System.out.println("Using Slow CopyData");
@@ -693,8 +718,9 @@ public final class GraphicsUtil {
break;
default:
while (in >= 0) {
- for (b = 0; b < bands - 1; b++)
+ for (b = 0; b < bands - 1; b++) {
oPix[out--] = pixel[in--];
+ }
out--;
}
}
@@ -711,9 +737,9 @@ public final class GraphicsUtil {
case 4:
while (in >= 0) {
a = pixel[in];
- if (a == 255)
+ if (a == 255) {
in -= 4;
- else {
+ } else {
in--;
alpha = fpNorm * a;
pixel[in] = (pixel[in] * alpha + pt5) >>> 24; in--;
@@ -725,9 +751,9 @@ public final class GraphicsUtil {
default:
while (in >= 0) {
a = pixel[in];
- if (a == 255)
+ if (a == 255) {
in -= bands;
- else {
+ } else {
in--;
alpha = fpNorm * a;
for (b = 0; b < bands - 1; b++) {
@@ -750,9 +776,9 @@ public final class GraphicsUtil {
case 4:
while (in >= 0) {
a = pixel[in];
- if ((a <= 0) || (a >= 255))
+ if ((a <= 0) || (a >= 255)) {
in -= 4;
- else {
+ } else {
in--;
ialpha = fpNorm / a;
pixel[in] = (pixel[in] * ialpha + pt5) >>> 16; in--;
@@ -764,9 +790,9 @@ public final class GraphicsUtil {
default:
while (in >= 0) {
a = pixel[in];
- if ((a <= 0) || (a >= 255))
+ if ((a <= 0) || (a >= 255)) {
in -= bands;
- else {
+ } else {
in--;
ialpha = fpNorm / a;
for (b = 0; b < bands - 1; b++) {
@@ -792,15 +818,19 @@ public final class GraphicsUtil {
if (a > 0) {
if (a < 255) {
ialpha = fpNorm / a;
- for (b = 0; b < bands; b++)
+ for (b = 0; b < bands; b++) {
oPix[out--] = (pixel[in--] * ialpha + pt5) >>> 16;
- } else
- for (b = 0; b < bands; b++)
+ }
+ } else {
+ for (b = 0; b < bands; b++) {
oPix[out--] = pixel[in--];
+ }
+ }
} else {
in -= bands;
- for (b = 0; b < bands; b++)
+ for (b = 0; b < bands; b++) {
oPix[out--] = 255;
+ }
}
}
dstR.setPixels(x0 + dx, y + dy, w, 1, oPix);
@@ -810,9 +840,10 @@ public final class GraphicsUtil {
// just copy the color channels over.
Rectangle dstRect = new Rectangle(destP.x, destP.y,
srcRect.width, srcRect.height);
- for (int b = 0; b < bands; b++)
+ for (int b = 0; b < bands; b++) {
copyBand(srcR, srcRect, b,
dstR, dstRect, b);
+ }
}
}
@@ -833,11 +864,16 @@ public final class GraphicsUtil {
sR = sR.intersection(src.getBounds());
dR = dR.intersection(dst.getBounds());
int width, height;
- if (dR.width < sR.width) width = dR.width;
- else width = sR.width;
- if (dR.height < sR.height) height = dR.height;
- else height = sR.height;
-
+ if (dR.width < sR.width) {
+ width = dR.width;
+ } else {
+ width = sR.width;
+ }
+ if (dR.height < sR.height) {
+ height = dR.height;
+ } else {
+ height = sR.height;
+ }
int x = sR.x + dx;
int [] samples = null;
for (int y = sR.y; y < sR.y + height; y++) {
@@ -849,35 +885,54 @@ public final class GraphicsUtil {
public static boolean is_INT_PACK_Data(SampleModel sm,
boolean requireAlpha) {
// Check ColorModel is of type DirectColorModel
- if (!(sm instanceof SinglePixelPackedSampleModel)) return false;
+ if (!(sm instanceof SinglePixelPackedSampleModel)) {
+ return false;
+ }
// Check transfer type
- if (sm.getDataType() != DataBuffer.TYPE_INT) return false;
+ if (sm.getDataType() != DataBuffer.TYPE_INT) {
+ return false;
+ }
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel)sm;
int [] masks = sppsm.getBitMasks();
if (masks.length == 3) {
- if (requireAlpha) return false;
- } else if (masks.length != 4)
+ if (requireAlpha) {
+ return false;
+ }
+ } else if (masks.length != 4) {
return false;
+ }
- if (masks[0] != 0x00ff0000) return false;
- if (masks[1] != 0x0000ff00) return false;
- if (masks[2] != 0x000000ff) return false;
+ if (masks[0] != 0x00ff0000) {
+ return false;
+ }
+ if (masks[1] != 0x0000ff00) {
+ return false;
+ }
+ if (masks[2] != 0x000000ff) {
+ return false;
+ }
if ((masks.length == 4) &&
- (masks[3] != 0xff000000)) return false;
+ (masks[3] != 0xff000000)) {
+ return false;
+ }
return true;
}
public static boolean is_BYTE_COMP_Data(SampleModel sm) {
// Check ColorModel is of type DirectColorModel
- if (!(sm instanceof ComponentSampleModel)) return false;
+ if (!(sm instanceof ComponentSampleModel)) {
+ return false;
+ }
// Check transfer type
- if (sm.getDataType() != DataBuffer.TYPE_BYTE) return false;
+ if (sm.getDataType() != DataBuffer.TYPE_BYTE) {
+ return false;
+ }
return true;
}
@@ -983,8 +1038,9 @@ public final class GraphicsUtil {
while (sp < end) {
int a = pixels[sp + aOff] & 0xFF;
if (a == 0) {
- for (int b = 0; b < bands; b++)
+ for (int b = 0; b < bands; b++) {
pixels[sp + bandOff[b]] = (byte)0xFF;
+ }
} else if (a < 255) { // this does NOT include a == 255 (0xff) !
int aFP = (0x00FF0000 / a);
for (int b = 0; b < bands; b++) {
@@ -1026,11 +1082,12 @@ public final class GraphicsUtil {
final int end = sp + width * pixStride;
while (sp < end) {
int a = pixels[sp + aOff] & 0xFF;
- if (a != 0xFF)
+ if (a != 0xFF) {
for (int b = 0; b < bands; b++) {
int i = sp + bandOff[b];
pixels[i] = (byte)(((pixels[i] & 0xFF) * a) >> 8);
}
+ }
sp += pixStride;
}
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java Tue Feb 11 18:45:00 2014
@@ -1436,26 +1436,30 @@ public abstract class PNGEncodeParam imp
if (pb < 0) {
// both pa & pb neg so pc is always greater than or
// equal to pa or pb;
- if (pa >= pb) // since pa & pb neg check sense is reversed.
+ if (pa >= pb) { // since pa & pb neg check sense is reversed.
diff = curr - left;
- else
+ } else {
diff = curr - up;
+ }
} else {
// pa neg pb pos so we must compute pc...
pc = pa + pb;
pa = -pa;
- if (pa <= pb) // pc is positive and less than pb
- if (pa <= pc)
+ if (pa <= pb) { // pc is positive and less than pb
+ if (pa <= pc) {
diff = curr - left;
- else
+ } else {
diff = curr - upleft;
- else
+ }
+ } else {
// pc is negative and less than or equal to pa,
// but since pa is greater than pb this isn't an issue...
- if (pb <= -pc)
+ if (pb <= -pc) {
diff = curr - up;
- else
+ } else {
diff = curr - upleft;
+ }
+ }
}
} else {
if (pb < 0) {
@@ -1463,28 +1467,31 @@ public abstract class PNGEncodeParam imp
if (pa <= pb) {
// pc would be negative and less than or equal to pb
pc = pb - pa;
- if (pa <= pc)
+ if (pa <= pc) {
diff = curr - left;
- else if (pb == pc)
+ } else if (pb == pc) {
// if pa is zero then pc==pb otherwise
// pc must be less than pb.
diff = curr - up;
- else
+ } else {
diff = curr - upleft;
+ }
} else {
// pc would be positive and less than pa.
pc = pa - pb;
- if (pb <= pc)
+ if (pb <= pc) {
diff = curr - up;
- else
+ } else {
diff = curr - upleft;
+ }
}
} else {
// both pos so pa+pb is always greater than pa/pb
- if (pa <= pb)
+ if (pa <= pb) {
diff = curr - left;
- else
+ } else {
diff = curr - up;
+ }
}
}
scratchRows[4][i] = (byte)diff;
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java Tue Feb 11 18:45:00 2014
@@ -258,7 +258,9 @@ public class TIFFDirectory implements Se
while (index < count) {
- while ((index < count) && (bvalues[index++] != 0));
+ while ((index < count) && (bvalues[index++] != 0)) {
+ // NOP
+ }
// When we encountered zero, means one string has ended
v.add(new String(bvalues, prevIndex,
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java Tue Feb 11 18:45:00 2014
@@ -192,9 +192,15 @@ public abstract class AbstractRed implem
this.srcs = new Vector(1);
if (src != null) {
this.srcs.add(src);
- if (bounds == null) bounds = src.getBounds();
- if (cm == null) cm = src.getColorModel();
- if (sm == null) sm = src.getSampleModel();
+ if (bounds == null) {
+ bounds = src.getBounds();
+ }
+ if (cm == null) {
+ cm = src.getColorModel();
+ }
+ if (sm == null) {
+ sm = src.getSampleModel();
+ }
}
this.bounds = bounds;
@@ -206,16 +212,18 @@ public abstract class AbstractRed implem
this.props.putAll(props);
}
- if (cm == null)
+ if (cm == null) {
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_GRAY),
new int [] { 8 }, false, false, Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
+ }
this.cm = cm;
- if (sm == null)
+ if (sm == null) {
sm = cm.createCompatibleSampleModel(bounds.width, bounds.height);
+ }
this.sm = sm;
// Recompute tileWidth/Height, minTileX/Y, numX/YTiles.
@@ -311,9 +319,15 @@ public abstract class AbstractRed implem
if (srcs.size() != 0) {
CachableRed src = (CachableRed)srcs.get(0);
- if (bounds == null) bounds = src.getBounds();
- if (cm == null) cm = src.getColorModel();
- if (sm == null) sm = src.getSampleModel();
+ if (bounds == null) {
+ bounds = src.getBounds();
+ }
+ if (cm == null) {
+ cm = src.getColorModel();
+ }
+ if (sm == null) {
+ sm = src.getSampleModel();
+ }
}
this.bounds = bounds;
@@ -324,16 +338,18 @@ public abstract class AbstractRed implem
this.props.putAll(props);
}
- if (cm == null)
+ if (cm == null) {
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_GRAY),
new int [] { 8 }, false, false, Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
+ }
this.cm = cm;
- if (sm == null)
+ if (sm == null) {
sm = cm.createCompatibleSampleModel(bounds.width, bounds.height);
+ }
this.sm = sm;
// Recompute tileWidth/Height, minTileX/Y, numX/YTiles.
@@ -435,12 +451,16 @@ public abstract class AbstractRed implem
public Object getProperty(String name) {
Object ret = props.get(name);
- if (ret != null) return ret;
+ if (ret != null) {
+ return ret;
+ }
Iterator i = srcs.iterator();
while (i.hasNext()) {
RenderedImage ri = (RenderedImage)i.next();
ret = ri.getProperty(name);
- if (ret != null) return ret;
+ if (ret != null) {
+ return ret;
+ }
}
return null;
}
@@ -466,13 +486,15 @@ public abstract class AbstractRed implem
}
public Shape getDependencyRegion(int srcIndex, Rectangle outputRgn) {
- if ((srcIndex < 0) || (srcIndex > srcs.size()))
+ if ((srcIndex < 0) || (srcIndex > srcs.size())) {
throw new IndexOutOfBoundsException(
"Nonexistent source requested.");
+ }
// Return empty rect if they don't intersect.
- if (!outputRgn.intersects(bounds))
+ if (!outputRgn.intersects(bounds)) {
return new Rectangle();
+ }
// We only depend on our source for stuff that is inside
// our bounds...
@@ -480,13 +502,15 @@ public abstract class AbstractRed implem
}
public Shape getDirtyRegion(int srcIndex, Rectangle inputRgn) {
- if (srcIndex != 0)
+ if (srcIndex != 0) {
throw new IndexOutOfBoundsException(
"Nonexistent source requested.");
+ }
// Return empty rect if they don't intersect.
- if (!inputRgn.intersects(bounds))
+ if (!inputRgn.intersects(bounds)) {
return new Rectangle();
+ }
// Changes in the input region don't propogate outside our
// bounds.
@@ -529,10 +553,11 @@ public abstract class AbstractRed implem
public final int getXTile(int xloc) {
int tgx = xloc - tileGridXOff;
// We need to round to -infinity...
- if (tgx >= 0)
+ if (tgx >= 0) {
return tgx / tileWidth;
- else
+ } else {
return (tgx - tileWidth + 1) / tileWidth;
+ }
}
/**
@@ -543,10 +568,11 @@ public abstract class AbstractRed implem
public final int getYTile(int yloc) {
int tgy = yloc - tileGridYOff;
// We need to round to -infinity...
- if (tgy >= 0)
+ if (tgy >= 0) {
return tgy / tileHeight;
- else
+ } else {
return (tgy - tileHeight + 1) / tileHeight;
+ }
}
/**
@@ -561,23 +587,33 @@ public abstract class AbstractRed implem
int tx1 = getXTile(wr.getMinX() + wr.getWidth() - 1);
int ty1 = getYTile(wr.getMinY() + wr.getHeight() - 1);
- if (tx0 < minTileX) tx0 = minTileX;
- if (ty0 < minTileY) ty0 = minTileY;
+ if (tx0 < minTileX) {
+ tx0 = minTileX;
+ }
+ if (ty0 < minTileY) {
+ ty0 = minTileY;
+ }
- if (tx1 >= minTileX + numXTiles) tx1 = minTileX + numXTiles - 1;
- if (ty1 >= minTileY + numYTiles) ty1 = minTileY + numYTiles - 1;
+ if (tx1 >= minTileX + numXTiles) {
+ tx1 = minTileX + numXTiles - 1;
+ }
+ if (ty1 >= minTileY + numYTiles) {
+ ty1 = minTileY + numYTiles - 1;
+ }
final boolean isIntPack =
GraphicsUtil.is_INT_PACK_Data(getSampleModel(), false);
- for (int y = ty0; y <= ty1; y++)
+ for (int y = ty0; y <= ty1; y++) {
for (int x = tx0; x <= tx1; x++) {
Raster r = getTile(x, y);
- if (isIntPack)
+ if (isIntPack) {
GraphicsUtil.copyData_INT_PACK(r, wr);
- else
+ } else {
GraphicsUtil.copyData_FALLBACK(r, wr);
+ }
}
+ }
}
@@ -595,10 +631,11 @@ public abstract class AbstractRed implem
*/
public WritableRaster makeTile(int tileX, int tileY) {
if ((tileX < minTileX) || (tileX >= minTileX + numXTiles)
- || (tileY < minTileY) || (tileY >= minTileY + numYTiles))
+ || (tileY < minTileY) || (tileY >= minTileY + numYTiles)) {
throw new IndexOutOfBoundsException(
"Requested Tile (" + tileX + ',' + tileY
+ ") lies outside the bounds of image");
+ }
Point pt = new Point(tileGridXOff + tileX * tileWidth,
tileGridYOff + tileY * tileHeight);
@@ -632,10 +669,18 @@ public abstract class AbstractRed implem
|| (y0 < bounds.y) || (y1 >= (bounds.y + bounds.height))) {
// Part of this raster lies outside our bounds so subset
// it so it only advertises the stuff inside our bounds.
- if (x0 < bounds.x) x0 = bounds.x;
- if (y0 < bounds.y) y0 = bounds.y;
- if (x1 >= (bounds.x + bounds.width)) x1 = bounds.x + bounds.width - 1;
- if (y1 >= (bounds.y + bounds.height)) y1 = bounds.y + bounds.height - 1;
+ if (x0 < bounds.x) {
+ x0 = bounds.x;
+ }
+ if (y0 < bounds.y) {
+ y0 = bounds.y;
+ }
+ if (x1 >= (bounds.x + bounds.width)) {
+ x1 = bounds.x + bounds.width - 1;
+ }
+ if (y1 >= (bounds.y + bounds.height)) {
+ y1 = bounds.y + bounds.height - 1;
+ }
wr = wr.createWritableChild(x0, y0, x1 - x0 + 1, y1 - y0 + 1,
x0, y0, null);
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java Tue Feb 11 18:45:00 2014
@@ -66,10 +66,13 @@ public class Any2LsRGBRed extends Abstra
null);
ColorModel srcCM = src.getColorModel();
- if (srcCM == null) return;
+ if (srcCM == null) {
+ return;
+ }
ColorSpace srcCS = srcCM.getColorSpace();
- if (srcCS == ColorSpace.getInstance(ColorSpace.CS_sRGB))
+ if (srcCS == ColorSpace.getInstance(ColorSpace.CS_sRGB)) {
srcIssRGB = true;
+ }
}
/**
@@ -80,8 +83,9 @@ public class Any2LsRGBRed extends Abstra
public static final double sRGBToLsRGB(double value) {
- if (value <= 0.003928)
+ if (value <= 0.003928) {
return value * LFACT;
+ }
return Math.pow((value + 0.055) / 1.055, GAMMA);
}
@@ -114,8 +118,9 @@ public class Any2LsRGBRed extends Abstra
if (srcIssRGB
&& Any2sRGBRed.is_INT_PACK_COMP(wr.getSampleModel())) {
src.copyData(wr);
- if (srcCM.hasAlpha())
+ if (srcCM.hasAlpha()) {
GraphicsUtil.coerceData(wr, srcCM, false);
+ }
Any2sRGBRed.applyLut_INT(wr, sRGBToLsRGBLut);
return wr;
}
@@ -228,9 +233,10 @@ public class Any2LsRGBRed extends Abstra
ColorConvertOp op = new ColorConvertOp(null);
op.filter(srcBI, dstBI);
- if (dstCM.hasAlpha())
+ if (dstCM.hasAlpha()) {
copyBand(srcWr, srcSM.getNumBands() - 1,
wr, getSampleModel().getNumBands() - 1);
+ }
}
return wr;
}
@@ -243,8 +249,9 @@ public class Any2LsRGBRed extends Abstra
protected static ColorModel fixColorModel(CachableRed src) {
ColorModel cm = src.getColorModel();
if (cm != null) {
- if (cm.hasAlpha())
+ if (cm.hasAlpha()) {
return GraphicsUtil.Linear_sRGB_Unpre;
+ }
return GraphicsUtil.Linear_sRGB;
} else {
@@ -280,9 +287,9 @@ public class Any2LsRGBRed extends Abstra
boolean alpha = false;
- if (cm != null)
+ if (cm != null) {
alpha = cm.hasAlpha();
- else {
+ } else {
switch (sm.getNumBands()) {
case 1: case 3:
alpha = false;
@@ -292,17 +299,18 @@ public class Any2LsRGBRed extends Abstra
break;
}
}
- if (alpha)
+ if (alpha) {
return new SinglePixelPackedSampleModel(
DataBuffer.TYPE_INT,
sm.getWidth(),
sm.getHeight(),
new int [] {0xFF0000, 0xFF00, 0xFF, 0xFF000000});
- else
+ } else {
return new SinglePixelPackedSampleModel(
DataBuffer.TYPE_INT,
sm.getWidth(),
sm.getHeight(),
new int [] {0xFF0000, 0xFF00, 0xFF});
+ }
}
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java Tue Feb 11 18:45:00 2014
@@ -68,28 +68,45 @@ public class Any2sRGBRed extends Abstrac
null);
ColorModel srcCM = src.getColorModel();
- if (srcCM == null) return;
+ if (srcCM == null) {
+ return;
+ }
ColorSpace srcCS = srcCM.getColorSpace();
- if (srcCS == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))
+ if (srcCS == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)) {
srcIsLsRGB = true;
+ }
}
public static boolean is_INT_PACK_COMP(SampleModel sm) {
- if (!(sm instanceof SinglePixelPackedSampleModel)) return false;
+ if (!(sm instanceof SinglePixelPackedSampleModel)) {
+ return false;
+ }
// Check transfer types
- if (sm.getDataType() != DataBuffer.TYPE_INT) return false;
+ if (sm.getDataType() != DataBuffer.TYPE_INT) {
+ return false;
+ }
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel)sm;
int [] masks = sppsm.getBitMasks();
- if ((masks.length != 3) && (masks.length != 4)) return false;
- if (masks[0] != 0x00ff0000) return false;
- if (masks[1] != 0x0000ff00) return false;
- if (masks[2] != 0x000000ff) return false;
+ if ((masks.length != 3) && (masks.length != 4)) {
+ return false;
+ }
+ if (masks[0] != 0x00ff0000) {
+ return false;
+ }
+ if (masks[1] != 0x0000ff00) {
+ return false;
+ }
+ if (masks[2] != 0x000000ff) {
+ return false;
+ }
if ((masks.length == 4) &&
- (masks[3] != 0xff000000)) return false;
+ (masks[3] != 0xff000000)) {
+ return false;
+ }
return true;
}
@@ -112,10 +129,11 @@ public class Any2sRGBRed extends Abstrac
// System.out.print("L2S: ");
for (int i = 0; i < 256; i++) {
double value = i * scale;
- if (value <= 0.0031308)
+ if (value <= 0.0031308) {
value *= 12.92;
- else
+ } else {
value = 1.055 * Math.pow(value, exp) - 0.055;
+ }
linearToSRGBLut[i] = (int)Math.round(value * 255.);
// System.out.print(linearToSRGBLut[i] + ",");
@@ -172,8 +190,9 @@ public class Any2sRGBRed extends Abstrac
if (srcIsLsRGB &&
is_INT_PACK_COMP(wr.getSampleModel())) {
src.copyData(wr);
- if (srcCM.hasAlpha())
+ if (srcCM.hasAlpha()) {
GraphicsUtil.coerceData(wr, srcCM, false);
+ }
applyLut_INT(wr, linearToSRGBLut);
return wr;
}
@@ -256,10 +275,11 @@ public class Any2sRGBRed extends Abstrac
// No transform needed, just reformat data...
// System.out.println("Bypassing");
- if (is_INT_PACK_COMP(srcSM))
+ if (is_INT_PACK_COMP(srcSM)) {
src.copyData(wr);
- else
+ } else {
GraphicsUtil.copyData(src.getData(wr.getBounds()), wr);
+ }
return wr;
}
@@ -271,8 +291,9 @@ public class Any2sRGBRed extends Abstrac
// the color convert may not be a linear operation which may
// lead to out of range values.
ColorModel srcBICM = srcCM;
- if (srcCM.hasAlpha())
+ if (srcCM.hasAlpha()) {
srcBICM = GraphicsUtil.coerceData(srcWr, srcCM, false);
+ }
BufferedImage srcBI, dstBI;
srcBI = new BufferedImage(srcBICM,
@@ -290,12 +311,14 @@ public class Any2sRGBRed extends Abstrac
// System.out.println("After filter:");
WritableRaster wr00 = wr.createWritableTranslatedChild(0, 0);
- for (int i = 0; i < dstCM.getColorSpace().getNumComponents(); i++)
+ for (int i = 0; i < dstCM.getColorSpace().getNumComponents(); i++) {
copyBand(dstBI.getRaster(), i, wr00, i);
+ }
- if (dstCM.hasAlpha())
+ if (dstCM.hasAlpha()) {
copyBand(srcWr, srcSM.getNumBands() - 1,
wr, getSampleModel().getNumBands() - 1);
+ }
return wr;
}
@@ -307,8 +330,9 @@ public class Any2sRGBRed extends Abstrac
protected static ColorModel fixColorModel(CachableRed src) {
ColorModel cm = src.getColorModel();
if (cm != null) {
- if (cm.hasAlpha())
+ if (cm.hasAlpha()) {
return GraphicsUtil.sRGB_Unpre;
+ }
return GraphicsUtil.sRGB;
} else {
@@ -344,9 +368,9 @@ public class Any2sRGBRed extends Abstrac
boolean alpha = false;
- if (cm != null)
+ if (cm != null) {
alpha = cm.hasAlpha();
- else {
+ } else {
switch (sm.getNumBands()) {
case 1: case 3:
alpha = false;
@@ -356,17 +380,18 @@ public class Any2sRGBRed extends Abstrac
break;
}
}
- if (alpha)
+ if (alpha) {
return new SinglePixelPackedSampleModel(
DataBuffer.TYPE_INT,
sm.getWidth(),
sm.getHeight(),
new int [] {0xFF0000, 0xFF00, 0xFF, 0xFF000000});
- else
+ } else {
return new SinglePixelPackedSampleModel(
DataBuffer.TYPE_INT,
sm.getWidth(),
sm.getHeight(),
new int [] {0xFF0000, 0xFF00, 0xFF});
+ }
}
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java Tue Feb 11 18:45:00 2014
@@ -100,8 +100,9 @@ public class BufferedImageCachableRed ex
public Raster getData(Rectangle rect) {
Rectangle r = (Rectangle)rect.clone();
- if (!r.intersects(getBounds()))
+ if (!r.intersects(getBounds())) {
return null;
+ }
r = r.intersection(getBounds());
r.translate(-getMinX(), - getMinY());
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java Tue Feb 11 18:45:00 2014
@@ -54,21 +54,25 @@ public class FormatRed extends AbstractR
public static CachableRed construct(CachableRed src, ColorModel cm) {
ColorModel srcCM = src.getColorModel();
if ((cm.hasAlpha() != srcCM.hasAlpha())
- || (cm.isAlphaPremultiplied() != srcCM.isAlphaPremultiplied()))
+ || (cm.isAlphaPremultiplied() != srcCM.isAlphaPremultiplied())) {
return new FormatRed(src, cm);
+ }
- if (cm.getNumComponents() != srcCM.getNumComponents())
+ if (cm.getNumComponents() != srcCM.getNumComponents()) {
throw new IllegalArgumentException(
"Incompatible ColorModel given");
+ }
if ((srcCM instanceof ComponentColorModel)
- && (cm instanceof ComponentColorModel))
+ && (cm instanceof ComponentColorModel)) {
return src;
+ }
if ((srcCM instanceof DirectColorModel)
- && (cm instanceof DirectColorModel))
+ && (cm instanceof DirectColorModel)) {
return src;
+ }
return new FormatRed(src, cm);
}
@@ -160,27 +164,31 @@ public class FormatRed extends AbstractR
// if Src has Alpha then our out bands must
// either be one less than the source (no out alpha)
// or equal (still has alpha)
- if (bands == srcCM.getNumComponents() - 1)
+ if (bands == srcCM.getNumComponents() - 1) {
hasAlpha = false;
- else if (bands != srcCM.getNumComponents())
+ } else if (bands != srcCM.getNumComponents()) {
throw new IllegalArgumentException(
"Incompatible number of bands in and out");
+ }
} else {
- if (bands == srcCM.getNumComponents() + 1)
+ if (bands == srcCM.getNumComponents() + 1) {
hasAlpha = true;
- else if (bands != srcCM.getNumComponents())
+ } else if (bands != srcCM.getNumComponents()) {
throw new IllegalArgumentException(
"Incompatible number of bands in and out");
+ }
}
boolean preMult = srcCM.isAlphaPremultiplied();
- if (!hasAlpha)
+ if (!hasAlpha) {
preMult = false;
+ }
if (sm instanceof ComponentSampleModel) {
int [] bitsPer = new int[bands];
- for (int i = 0; i < bands; i++)
+ for (int i = 0; i < bands; i++) {
bitsPer[i] = bits;
+ }
return new ComponentColorModel(
cs, bitsPer, hasAlpha, preMult,
@@ -190,17 +198,18 @@ public class FormatRed extends AbstractR
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel)sm;
int[] masks = sppsm.getBitMasks();
- if (bands == 4)
+ if (bands == 4) {
return new DirectColorModel(
cs, bits, masks[0], masks[1], masks[2], masks[3],
preMult, dt);
- else if (bands == 3)
+ } else if (bands == 3) {
return new DirectColorModel(
cs, bits, masks[0], masks[1], masks[2], 0x0,
preMult, dt);
- else
+ } else {
throw new IllegalArgumentException(
"Incompatible number of bands out for ColorModel");
+ }
}
throw new IllegalArgumentException(
"Unsupported SampleModel Type");
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java Tue Feb 11 18:45:00 2014
@@ -45,10 +45,12 @@ import java.util.Vector;
public class RenderedImageCachableRed implements CachableRed {
public static CachableRed wrap(RenderedImage ri) {
- if (ri instanceof CachableRed)
+ if (ri instanceof CachableRed) {
return (CachableRed) ri;
- if (ri instanceof BufferedImage)
+ }
+ if (ri instanceof BufferedImage) {
return new BufferedImageCachableRed((BufferedImage)ri);
+ }
return new RenderedImageCachableRed(ri);
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java Tue Feb 11 18:45:00 2014
@@ -546,8 +546,9 @@ public abstract class AbstractGraphics2D
if (nPoints > 0) {
GeneralPath path = new GeneralPath();
path.moveTo(xPoints[0], yPoints[0]);
- for (int i = 1; i < nPoints; i++)
+ for (int i = 1; i < nPoints; i++) {
path.lineTo(xPoints[i], yPoints[i]);
+ }
draw(path);
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java Tue Feb 11 18:45:00 2014
@@ -64,8 +64,9 @@ public class Base64DecodeStream extends
private static final byte[] PEM_ARRAY = new byte[256];
static {
- for (int i = 0; i < PEM_ARRAY.length; i++)
+ for (int i = 0; i < PEM_ARRAY.length; i++) {
PEM_ARRAY[i] = -1;
+ }
int idx = 0;
for (char c = 'A'; c <= 'Z'; c++) {
@@ -120,8 +121,11 @@ public class Base64DecodeStream extends
if (out_offset == 3) {
if (EOF || getNextAtom()) {
EOF = true;
- if (idx == 0) return -1;
- else return idx;
+ if (idx == 0) {
+ return -1;
+ } else {
+ return idx;
+ }
}
}
@@ -138,15 +142,17 @@ public class Base64DecodeStream extends
int off = 0;
while (off != 4) {
count = src.read(decode_buffer, off, 4 - off);
- if (count == -1)
+ if (count == -1) {
return true;
+ }
int in = off, out = off;
while (in < off + count) {
if ((decode_buffer[in] != '\n') &&
(decode_buffer[in] != '\r') &&
- (decode_buffer[in] != ' '))
+ (decode_buffer[in] != ' ')) {
decode_buffer[out++] = decode_buffer[in];
+ }
in++;
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java?rev=1567285&r1=1567284&r2=1567285&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java Tue Feb 11 18:45:00 2014
@@ -80,8 +80,9 @@ public class Base64EncodeStream extends
if (out != null) {
encodeAtom();
out.flush();
- if (closeOutOnClose)
+ if (closeOutOnClose) {
out.close();
+ }
out = null;
}
}
@@ -98,8 +99,9 @@ public class Base64EncodeStream extends
public void write(int b) throws IOException {
atom[atomLen++] = (byte)b;
- if (atomLen == 3)
+ if (atomLen == 3) {
encodeAtom();
+ }
}
public void write(byte []data) throws IOException {
@@ -163,8 +165,9 @@ public class Base64EncodeStream extends
void encodeFromArray(byte[] data, int offset, int len)
throws IOException {
byte a, b, c;
- if (len == 0)
+ if (len == 0) {
return;
+ }
// System.out.println("atomLen: " + atomLen +
// " len: " + len +
@@ -174,7 +177,9 @@ public class Base64EncodeStream extends
switch(atomLen) {
case 1:
atom[1] = data[offset++]; len--; atomLen++;
- if (len == 0) return;
+ if (len == 0) {
+ return;
+ }
atom[2] = data[offset++]; len--; atomLen++;
break;
case 2:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org