mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
TMI-41: Fix for CorbisRGB special handling testcase JDK 1.7+
This commit is contained in:
parent
662f12a41d
commit
f588d65565
@ -141,7 +141,7 @@ public final class ColorSpaces {
|
||||
// Special handling to detect problematic Corbis RGB ICC Profile.
|
||||
// This makes sure tags that are expected to be of type 'XYZ ' really have this expected type.
|
||||
// Should leave other ICC profiles unchanged.
|
||||
if (fixProfileXYZTag(profile, ICC_Profile.icSigMediaWhitePointTag)) {
|
||||
if (!JDK_HANDLES_RENDERING_INTENTS && fixProfileXYZTag(profile, ICC_Profile.icSigMediaWhitePointTag)) {
|
||||
fixProfileXYZTag(profile, ICC_Profile.icSigRedColorantTag);
|
||||
fixProfileXYZTag(profile, ICC_Profile.icSigGreenColorantTag);
|
||||
fixProfileXYZTag(profile, ICC_Profile.icSigBlueColorantTag);
|
||||
@ -156,7 +156,7 @@ public final class ColorSpaces {
|
||||
* @return {@code true} if found and fixed, otherwise {@code false} for short-circuiting
|
||||
* to avoid unnecessary array copying.
|
||||
*/
|
||||
private static boolean fixProfileXYZTag(ICC_Profile profile, final int tagSignature) {
|
||||
private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) {
|
||||
// TODO: This blows up on OpenJDK... Bug?
|
||||
byte[] data = profile.getData(tagSignature);
|
||||
|
||||
|
@ -34,6 +34,7 @@ import java.awt.color.ColorSpace;
|
||||
import java.awt.color.ICC_ColorSpace;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@ -45,6 +46,9 @@ import static org.junit.Assert.*;
|
||||
* @version $Id: ColorSpacesTest.java,v 1.0 07.02.11 14.32 haraldk Exp$
|
||||
*/
|
||||
public class ColorSpacesTest {
|
||||
|
||||
private static final byte[] XYZ = new byte[] {'X', 'Y', 'Z', ' '};
|
||||
|
||||
@Test
|
||||
public void testCreateColorSpaceFromKnownProfileReturnsInternalCS_sRGB() {
|
||||
ICC_Profile profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
|
||||
@ -189,11 +193,15 @@ public class ColorSpacesTest {
|
||||
@Test
|
||||
public void testCorbisRGBSpecialHandling() throws IOException {
|
||||
ICC_Profile corbisRGB = ICC_Profile.getInstance(getClass().getResourceAsStream("/profiles/Corbis RGB.icc"));
|
||||
ICC_Profile corbisRGBFixed = ICC_Profile.getInstance(getClass().getResourceAsStream("/profiles/Corbis RGB_fixed.icc"));
|
||||
|
||||
ICC_ColorSpace colorSpace = ColorSpaces.createColorSpace(corbisRGB);
|
||||
|
||||
assertNotNull(colorSpace);
|
||||
assertArrayEquals(colorSpace.getProfile().getData(), corbisRGBFixed.getData());
|
||||
|
||||
// Make sure all known affected tags have type 'XYZ '
|
||||
ICC_Profile profile = colorSpace.getProfile();
|
||||
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigMediaWhitePointTag), 0, 4));
|
||||
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigRedColorantTag), 0, 4));
|
||||
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigGreenColorantTag), 0, 4));
|
||||
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigBlueColorantTag), 0, 4));
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user