提交 9a4c31a6 编写于 作者: M minqi

6918065: Crash in Java2D blit loop (IntArgbToIntArgbPreSrcOverMaskBlit) in 64bit mode

Reviewed-by: igor, bae
上级 722982e0
......@@ -614,14 +614,15 @@ public final class AlphaComposite implements Composite {
}
private AlphaComposite(int rule, float alpha) {
if (alpha < 0.0f || alpha > 1.0f) {
throw new IllegalArgumentException("alpha value out of range");
}
if (rule < MIN_RULE || rule > MAX_RULE) {
throw new IllegalArgumentException("unknown composite rule");
}
if (alpha >= 0.0f && alpha <= 1.0f) {
this.rule = rule;
this.extraAlpha = alpha;
} else {
throw new IllegalArgumentException("alpha value out of range");
}
}
/**
......
/*
* @test
* @bug 6918065
* @summary Test for passing NaN as alpha
* should throw IllegalArgumentException
*/
import java.awt.*;
public class TestAlphaCompositeForNaN {
public static void main(String[] args) {
try {
AlphaComposite a = AlphaComposite.getInstance(AlphaComposite.DST, Float.NaN);
System.out.println("Failed");
throw new RuntimeException(a + " failed to throw IllegalArgumentException for alpha = " + Float.NaN);
}
catch (IllegalArgumentException ie) {
System.out.println("Passed");
System.out.println("Caught " + ie);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册