Author: sebb Date: Tue Oct 22 01:44:23 2013 New Revision: 1534460 URL: http://svn.apache.org/r1534460 Log: Don't reuse same name as a field
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java?rev=1534460&r1=1534459&r2=1534460&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java Tue Oct 22 01:44:23 2013 @@ -229,23 +229,23 @@ public class JpegDecoder extends BinaryF private void rescaleMCU(final Block[] dataUnits, final int hSize, final int vSize, final Block[] ret) { for (int i = 0; i < dataUnits.length; i++) { - final Block block = dataUnits[i]; - if (block.width == hSize && block.height == vSize) { - System.arraycopy(block.samples, 0, ret[i].samples, 0, hSize + final Block dataUnit = dataUnits[i]; + if (dataUnit.width == hSize && dataUnit.height == vSize) { + System.arraycopy(dataUnit.samples, 0, ret[i].samples, 0, hSize * vSize); } else { - final int hScale = hSize / block.width; - final int vScale = vSize / block.height; + final int hScale = hSize / dataUnit.width; + final int vScale = vSize / dataUnit.height; if (hScale == 2 && vScale == 2) { int srcRowOffset = 0; int dstRowOffset = 0; - for (int y = 0; y < block.height; y++) { + for (int y = 0; y < dataUnit.height; y++) { for (int x = 0; x < hSize; x++) { - final int sample = block.samples[srcRowOffset + (x >> 1)]; + final int sample = dataUnit.samples[srcRowOffset + (x >> 1)]; ret[i].samples[dstRowOffset + x] = sample; ret[i].samples[dstRowOffset + hSize + x] = sample; } - srcRowOffset += block.width; + srcRowOffset += dataUnit.width; dstRowOffset += 2 * hSize; } } else { @@ -253,8 +253,8 @@ public class JpegDecoder extends BinaryF int dstRowOffset = 0; for (int y = 0; y < vSize; y++) { for (int x = 0; x < hSize; x++) { - ret[i].samples[dstRowOffset + x] = block.samples[(y / vScale) - * block.width + (x / hScale)]; + ret[i].samples[dstRowOffset + x] = dataUnit.samples[(y / vScale) + * dataUnit.width + (x / hScale)]; } dstRowOffset += hSize; }