mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-01 00:00:02 -04:00
Added processImageStarted and stubbed out processImageProgress and processReadAborted
Added all DDS format test cases to getTestData
This commit is contained in:
+8
-1
@@ -67,13 +67,20 @@ public final class DDSImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
int width = getWidth(imageIndex);
|
int width = getWidth(imageIndex);
|
||||||
int height = getHeight(imageIndex);
|
int height = getHeight(imageIndex);
|
||||||
|
|
||||||
BufferedImage destination = getDestination(param, getImageTypes(imageIndex), width, height);
|
BufferedImage destination = getDestination(param, getImageTypes(imageIndex), width, height);
|
||||||
|
|
||||||
|
processImageStarted(imageIndex);
|
||||||
|
|
||||||
DDSReader dds = new DDSReader(header);
|
DDSReader dds = new DDSReader(header);
|
||||||
int[] pixels = dds.read(imageInput, 0);
|
int[] pixels = dds.read(imageInput, 0);
|
||||||
destination.setRGB(0, 0, width, height, pixels, 0, width);
|
destination.setRGB(0, 0, width, height, pixels, 0, width);
|
||||||
|
|
||||||
|
// TODO: break read into raster line and add progress and abort checks
|
||||||
|
processImageProgress(100f);
|
||||||
|
if (abortRequested()) {
|
||||||
|
processReadAborted();
|
||||||
|
}
|
||||||
|
|
||||||
processImageComplete();
|
processImageComplete();
|
||||||
|
|
||||||
return destination;
|
return destination;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.twelvemonkeys.imageio.util.ImageReaderAbstractTest;
|
|||||||
|
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -16,9 +17,41 @@ public class DDSImageTeaderTest extends ImageReaderAbstractTest<DDSImageReader>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TestData> getTestData() {
|
protected List<TestData> getTestData() {
|
||||||
return Collections.singletonList(
|
Dimension dim = new Dimension(256, 256);
|
||||||
new TestData(getClassLoaderResource("/dds/dxt5.dds"), new Dimension(512, 512))
|
|
||||||
);
|
List<TestData> testData = new ArrayList<>();
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A1R5G5B5.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A1R5G5B5_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A4R4G4B4.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A4R4G4B4_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8B8G8R8.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8B8G8R8_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8R8G8B8.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8R8G8B8_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT1.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT1_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT2.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT2_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT3.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT3_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT4.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT4_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT5.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT5_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_R5G6B5.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_R5G6B5_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_R8G8B8.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_R8G8B8_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X1R5G5B5.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X1R5G5B5_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X4R4G4B4.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X4R4G4B4_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8B8G8R8.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8B8G8R8_mipmap.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8R8G8B8.dds"), dim));
|
||||||
|
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8R8G8B8_mipmap.dds"), dim));
|
||||||
|
|
||||||
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user