--- old/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java 2013-10-18 04:14:30.084679945 -0400 +++ new/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java 2013-10-18 04:14:29.945679876 -0400 @@ -109,22 +109,17 @@ return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig); } + @Override public void validatePipe(SunGraphics2D sg2d) { TextPipe textpipe; boolean validated = false; - + /* * The textpipe for now can't handle TexturePaint when extra-alpha is * specified nore XOR mode */ - if (sg2d.compositeState < SunGraphics2D.COMP_XOR && - (sg2d.paintState < SunGraphics2D.PAINT_TEXTURE || - sg2d.composite == null || - !(sg2d.composite instanceof AlphaComposite) || - ((AlphaComposite) sg2d.composite).getAlpha() == 1.0f)) + if ((textpipe = getTextPipe(sg2d)) == null) { - textpipe = xrtextpipe; - } else { super.validatePipe(sg2d); textpipe = sg2d.textpipe; validated = true; @@ -183,14 +178,39 @@ // always override the image pipe with the specialized XRender pipe sg2d.imagepipe = xrDrawImage; } + + protected TextPipe getTextPipe(SunGraphics2D sg2d) { + boolean supportedPaint = sg2d.compositeState <= SunGraphics2D.COMP_ALPHA + && (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR || sg2d.composite == null); + + boolean supportedCompOp = false; + if (sg2d.composite instanceof AlphaComposite) { + int compRule = ((AlphaComposite) sg2d.composite).getRule(); + supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule)) + || (compRule == AlphaComposite.SRC + && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR); + } + return (supportedPaint && supportedCompOp) ? xrtextpipe : null; + } + protected MaskFill getMaskFill(SunGraphics2D sg2d) { - if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR && - !XRPaints.isValid(sg2d)) - { - return null; - } - return super.getMaskFill(sg2d); + AlphaComposite aComp = null; + if(sg2d.composite != null + && sg2d.composite instanceof AlphaComposite) { + aComp = (AlphaComposite) sg2d.composite; + } + + boolean supportedPaint = sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR + || XRPaints.isValid(sg2d); + + boolean supportedCompOp = false; + if(aComp != null) { + int rule = aComp.getRule(); + supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(rule)); + } + + return (supportedPaint && supportedCompOp) ? super.getMaskFill(sg2d) : null; } public RenderLoops getRenderLoops(SunGraphics2D sg2d) {