8130400: Test java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java fails with ClassCastException
Reviewed-by: prr, serb
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java Mon Aug 03 15:48:33 2015 -0500
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java Tue Aug 04 12:34:08 2015 +0300
@@ -46,24 +46,28 @@
SurfaceData dstData = sg.surfaceData;
SurfaceData srcData = dstData.getSourceSurfaceData(img,
SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
- int compRule = ((AlphaComposite) sg.composite).getRule();
- float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
- if (srcData != null && !isBgOperation(srcData, bgColor)
+ if (sg.composite instanceof AlphaComposite) {
+ int compRule = ((AlphaComposite) sg.composite).getRule();
+ float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
+
+ if (srcData != null && !isBgOperation(srcData, bgColor)
&& interpType <= AffineTransformOp.TYPE_BILINEAR
&& (XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
- || (XRUtils.isTransformQuadrantRotated(tx)) && extraAlpha == 1.0f))
- {
- SurfaceType srcType = srcData.getSurfaceType();
- SurfaceType dstType = dstData.getSurfaceType();
+ || (XRUtils.isTransformQuadrantRotated(tx))
+ && extraAlpha == 1.0f))
+ {
+ SurfaceType srcType = srcData.getSurfaceType();
+ SurfaceType dstType = dstData.getSurfaceType();
- TransformBlit blit = TransformBlit.getFromCache(srcType,
- sg.imageComp, dstType);
- if (blit != null) {
- blit.Transform(srcData, dstData, sg.composite,
- sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
+ TransformBlit blit = TransformBlit.getFromCache(srcType,
+ sg.imageComp, dstType);
+ if (blit != null) {
+ blit.Transform(srcData, dstData, sg.composite,
+ sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
- sx1, sy2 - sy1);
return;
+ }
}
}
--- a/jdk/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java Mon Aug 03 15:48:33 2015 -0500
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java Tue Aug 04 12:34:08 2015 +0300
@@ -40,7 +40,7 @@
/**
* @test
- * @bug 8061831
+ * @bug 8061831 8130400
* @summary Tests drawing volatile image to volatile image using different
* clips + xor mode. Results of the blit compatibleImage to
* compatibleImage is used for comparison.