jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java
changeset 21234 e5d41ac9fb32
parent 21233 a36ed36d3209
child 21776 31823abc2258
equal deleted inserted replaced
21233:a36ed36d3209 21234:e5d41ac9fb32
   107     @Override
   107     @Override
   108     public SurfaceDataProxy makeProxyFor(SurfaceData srcData) {
   108     public SurfaceDataProxy makeProxyFor(SurfaceData srcData) {
   109         return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig);
   109         return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig);
   110     }
   110     }
   111 
   111 
       
   112     @Override
   112     public void validatePipe(SunGraphics2D sg2d) {
   113     public void validatePipe(SunGraphics2D sg2d) {
   113         TextPipe textpipe;
   114         TextPipe textpipe;
   114         boolean validated = false;
   115         boolean validated = false;
   115 
   116 
   116         /*
   117         /*
   117          * The textpipe for now can't handle TexturePaint when extra-alpha is
   118          * The textpipe for now can't handle TexturePaint when extra-alpha is
   118          * specified nore XOR mode
   119          * specified nore XOR mode
   119          */
   120          */
   120         if (sg2d.compositeState < SunGraphics2D.COMP_XOR &&
   121         if ((textpipe = getTextPipe(sg2d)) == null)
   121             (sg2d.paintState < SunGraphics2D.PAINT_TEXTURE ||
       
   122              sg2d.composite == null ||
       
   123              !(sg2d.composite instanceof AlphaComposite) ||
       
   124              ((AlphaComposite) sg2d.composite).getAlpha() == 1.0f))
       
   125         {
   122         {
   126             textpipe = xrtextpipe;
       
   127         } else {
       
   128             super.validatePipe(sg2d);
   123             super.validatePipe(sg2d);
   129             textpipe = sg2d.textpipe;
   124             textpipe = sg2d.textpipe;
   130             validated = true;
   125             validated = true;
   131         }
   126         }
   132 
   127 
   182 
   177 
   183         // always override the image pipe with the specialized XRender pipe
   178         // always override the image pipe with the specialized XRender pipe
   184         sg2d.imagepipe = xrDrawImage;
   179         sg2d.imagepipe = xrDrawImage;
   185     }
   180     }
   186 
   181 
       
   182     protected TextPipe getTextPipe(SunGraphics2D sg2d) {
       
   183         boolean supportedPaint = sg2d.compositeState <= SunGraphics2D.COMP_ALPHA
       
   184                 && (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR || sg2d.composite == null);
       
   185 
       
   186         boolean supportedCompOp = false;
       
   187         if (sg2d.composite instanceof AlphaComposite) {
       
   188             int compRule = ((AlphaComposite) sg2d.composite).getRule();
       
   189             supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
       
   190                     || (compRule == AlphaComposite.SRC
       
   191                                 && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR);
       
   192         }
       
   193 
       
   194         return (supportedPaint && supportedCompOp) ? xrtextpipe : null;
       
   195     }
       
   196 
   187     protected MaskFill getMaskFill(SunGraphics2D sg2d) {
   197     protected MaskFill getMaskFill(SunGraphics2D sg2d) {
   188         if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR &&
   198         AlphaComposite aComp = null;
   189             !XRPaints.isValid(sg2d))
   199         if(sg2d.composite != null
   190         {
   200                 && sg2d.composite instanceof AlphaComposite) {
   191             return null;
   201             aComp = (AlphaComposite) sg2d.composite;
   192         }
   202         }
   193         return super.getMaskFill(sg2d);
   203 
       
   204         boolean supportedPaint = sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR
       
   205                 || XRPaints.isValid(sg2d);
       
   206 
       
   207         boolean supportedCompOp = false;
       
   208         if(aComp != null) {
       
   209             int rule = aComp.getRule();
       
   210             supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(rule));
       
   211         }
       
   212 
       
   213         return (supportedPaint && supportedCompOp) ?  super.getMaskFill(sg2d) : null;
   194     }
   214     }
   195 
   215 
   196     public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
   216     public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
   197         if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
   217         if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
   198             sg2d.compositeState <= SunGraphics2D.COMP_ALPHA)
   218             sg2d.compositeState <= SunGraphics2D.COMP_ALPHA)