mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-01 00:00:02 -04:00
TMI-75: Fix offset bug in DCXImageReader (now with passing test)
This commit is contained in:
+3
-2
@@ -42,6 +42,7 @@ import javax.imageio.event.IIOReadWarningListener;
|
|||||||
import javax.imageio.metadata.IIOMetadata;
|
import javax.imageio.metadata.IIOMetadata;
|
||||||
import javax.imageio.metadata.IIOMetadataFormatImpl;
|
import javax.imageio.metadata.IIOMetadataFormatImpl;
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -202,8 +203,8 @@ public final class DCXImageReader 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));
|
||||||
|
|||||||
+9
-1
@@ -28,13 +28,15 @@
|
|||||||
|
|
||||||
package com.twelvemonkeys.imageio.plugins.dcx;
|
package com.twelvemonkeys.imageio.plugins.dcx;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
|
|
||||||
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DCXImageReaderTest
|
* DCXImageReaderTest
|
||||||
@@ -82,4 +84,10 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user