mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 03:55:28 -04:00
TMI-80: PCXImageReader now correctly skips rows and applies source region. Re-enabled test in DCXImageReader that earlier failed.
This commit is contained in:
parent
91e693724f
commit
4b00945c9d
@ -45,10 +45,7 @@ import javax.imageio.stream.ImageInputStream;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.color.ColorSpace;
|
import java.awt.color.ColorSpace;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import java.io.DataInput;
|
import java.io.*;
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -214,7 +211,7 @@ public final class PCXImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
processImageProgress(100f * y / height);
|
processImageProgress(100f * y / height);
|
||||||
|
|
||||||
if (y < srcRegion.y) {
|
if (y >= srcRegion.y + srcRegion.height) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +237,7 @@ public final class PCXImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
processImageProgress(100f * y / height);
|
processImageProgress(100f * y / height);
|
||||||
|
|
||||||
if (y < srcRegion.y) {
|
if (y >= srcRegion.y + srcRegion.height) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,15 +276,15 @@ public final class PCXImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
processImageProgress(100f * y / height * c / header.getChannels());
|
processImageProgress(100f * y / height * c / header.getChannels());
|
||||||
|
|
||||||
if (y < srcRegion.y) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abortRequested()) {
|
if (abortRequested()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (y >= srcRegion.y + srcRegion.height) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (abortRequested()) {
|
if (abortRequested()) {
|
||||||
processReadAborted();
|
processReadAborted();
|
||||||
break;
|
break;
|
||||||
@ -444,8 +441,8 @@ public final class PCXImageReader extends ImageReaderBase {
|
|||||||
// param.setSourceSubsampling(2, 3, 0, 0);
|
// param.setSourceSubsampling(2, 3, 0, 0);
|
||||||
// param.setSourceSubsampling(2, 1, 0, 0);
|
// param.setSourceSubsampling(2, 1, 0, 0);
|
||||||
//
|
//
|
||||||
// int width = reader.getHdpi(0);
|
// int width = reader.getWidth(0);
|
||||||
// int height = reader.getVdpi(0);
|
// int height = reader.getHeight(0);
|
||||||
//
|
//
|
||||||
// param.setSourceRegion(new Rectangle(width / 4, height / 4, width / 2, height / 2));
|
// param.setSourceRegion(new Rectangle(width / 4, height / 4, width / 2, height / 2));
|
||||||
// param.setSourceRegion(new Rectangle(width / 2, height / 2));
|
// param.setSourceRegion(new Rectangle(width / 2, height / 2));
|
||||||
|
@ -84,10 +84,4 @@ public class DCXImageReaderTest extends ImageReaderAbstractTestCase<DCXImageRead
|
|||||||
"image/dcx", "image/x-dcx"
|
"image/dcx", "image/x-dcx"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testReadWithSourceRegionParamEqualImage() throws IOException {
|
|
||||||
// Default invocation
|
|
||||||
assertReadWithSourceRegionParamEqualImage(new Rectangle(0, 0, 32, 32), getTestData().get(0), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,11 @@
|
|||||||
package com.twelvemonkeys.imageio.plugins.pcx;
|
package com.twelvemonkeys.imageio.plugins.pcx;
|
||||||
|
|
||||||
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -98,4 +100,11 @@ public class PCXImageReaderTest extends ImageReaderAbstractTestCase<PCXImageRead
|
|||||||
"image/pcx", "image/x-pcx"
|
"image/pcx", "image/x-pcx"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReadWithSourceRegionParamEqualImage() throws IOException {
|
||||||
|
assertReadWithSourceRegionParamEqualImage(new Rectangle(200, 0, 4, 4), getTestData().get(0), 0);
|
||||||
|
assertReadWithSourceRegionParamEqualImage(new Rectangle(100, 100, 4, 4), getTestData().get(0), 0);
|
||||||
|
assertReadWithSourceRegionParamEqualImage(new Rectangle(0, 200, 4, 4), getTestData().get(0), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user