提交 37b07bf2 编写于 作者: B bae

6976076: sun/java2d/pipe/MutableColorTest/MutableColorTest.java failed

Reviewed-by: igor, prr
上级 90567e57
......@@ -105,7 +105,7 @@ public class MutableColorTest {
for (int y = 0; y < snapshot.getHeight(); y++) {
for (int x = 0; x < snapshot.getWidth(); x++) {
int snapRGB = snapshot.getRGB(x, y);
if (snapRGB != evilColor) {
if (!isSameColor(snapRGB, evilColor)) {
System.err.printf("Wrong RGB for %s at (%d,%d): 0x%x " +
"instead of 0x%x\n", desc, x, y, snapRGB, evilColor);
String fileName = "MutableColorTest_"+desc+".png";
......@@ -166,4 +166,24 @@ public class MutableColorTest {
System.err.println("Test passed.");
}
/*
* We assume that colors with slightly different components
* are the same. This is done just in order to workaround
* peculiarities of OGL rendering pipeline on some platforms.
* See CR 6989217 for more details.
*/
private static boolean isSameColor(int color1, int color2) {
final int tolerance = 2;
for (int i = 0; i < 32; i += 8) {
int c1 = 0xff & (color1 >> i);
int c2 = 0xff & (color2 >> i);
if (Math.abs(c1 - c2) > tolerance) {
return false;
}
}
return true;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册