92 } 93 } 94 95 /** 96 * Synchronized accessor method for isDrawableValid. 97 */ 98 protected boolean isXRDrawableValid() { 99 try { 100 SunToolkit.awtLock(); 101 return isDrawableValid(); 102 } finally { 103 SunToolkit.awtUnlock(); 104 } 105 } 106 107 @Override 108 public SurfaceDataProxy makeProxyFor(SurfaceData srcData) { 109 return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig); 110 } 111 112 public void validatePipe(SunGraphics2D sg2d) { 113 TextPipe textpipe; 114 boolean validated = false; 115 116 /* 117 * The textpipe for now can't handle TexturePaint when extra-alpha is 118 * specified nore XOR mode 119 */ 120 if (sg2d.compositeState < SunGraphics2D.COMP_XOR && 121 (sg2d.paintState < SunGraphics2D.PAINT_TEXTURE || 122 sg2d.composite == null || 123 !(sg2d.composite instanceof AlphaComposite) || 124 ((AlphaComposite) sg2d.composite).getAlpha() == 1.0f)) 125 { 126 textpipe = xrtextpipe; 127 } else { 128 super.validatePipe(sg2d); 129 textpipe = sg2d.textpipe; 130 validated = true; 131 } 132 133 PixelToShapeConverter txPipe = null; 134 XRRenderer nonTxPipe = null; 135 136 /* 137 * TODO: Can we rely on the GC for ARGB32 surfaces? 138 */ 139 if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { 140 if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) { 141 if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) { 142 txPipe = xrtxpipe; 143 nonTxPipe = xrpipe; 144 } 145 } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) { 146 if (XRPaints.isValid(sg2d)) { 147 txPipe = xrtxpipe; 167 sg2d.fillpipe = nonTxPipe; 168 } else { 169 sg2d.drawpipe = nonTxPipe; 170 sg2d.fillpipe = nonTxPipe; 171 } 172 sg2d.shapepipe = nonTxPipe; 173 } else { 174 if (!validated) { 175 super.validatePipe(sg2d); 176 } 177 } 178 } 179 180 // install the text pipe based on our earlier decision 181 sg2d.textpipe = textpipe; 182 183 // always override the image pipe with the specialized XRender pipe 184 sg2d.imagepipe = xrDrawImage; 185 } 186 187 protected MaskFill getMaskFill(SunGraphics2D sg2d) { 188 if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR && 189 !XRPaints.isValid(sg2d)) 190 { 191 return null; 192 } 193 return super.getMaskFill(sg2d); 194 } 195 196 public RenderLoops getRenderLoops(SunGraphics2D sg2d) { 197 if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && 198 sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) 199 { 200 return solidloops; 201 } 202 203 return super.getRenderLoops(sg2d); 204 } 205 206 public GraphicsConfiguration getDeviceConfiguration() { 207 return graphicsConfig; 208 } 209 210 /** 211 * Method for instantiating a Window SurfaceData 212 */ 213 public static XRWindowSurfaceData createData(X11ComponentPeer peer) { | 92 } 93 } 94 95 /** 96 * Synchronized accessor method for isDrawableValid. 97 */ 98 protected boolean isXRDrawableValid() { 99 try { 100 SunToolkit.awtLock(); 101 return isDrawableValid(); 102 } finally { 103 SunToolkit.awtUnlock(); 104 } 105 } 106 107 @Override 108 public SurfaceDataProxy makeProxyFor(SurfaceData srcData) { 109 return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig); 110 } 111 112 @Override 113 public void validatePipe(SunGraphics2D sg2d) { 114 TextPipe textpipe; 115 boolean validated = false; 116 117 /* 118 * The textpipe for now can't handle TexturePaint when extra-alpha is 119 * specified nore XOR mode 120 */ 121 if ((textpipe = getTextPipe(sg2d)) == null) 122 { 123 super.validatePipe(sg2d); 124 textpipe = sg2d.textpipe; 125 validated = true; 126 } 127 128 PixelToShapeConverter txPipe = null; 129 XRRenderer nonTxPipe = null; 130 131 /* 132 * TODO: Can we rely on the GC for ARGB32 surfaces? 133 */ 134 if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { 135 if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) { 136 if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) { 137 txPipe = xrtxpipe; 138 nonTxPipe = xrpipe; 139 } 140 } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) { 141 if (XRPaints.isValid(sg2d)) { 142 txPipe = xrtxpipe; 162 sg2d.fillpipe = nonTxPipe; 163 } else { 164 sg2d.drawpipe = nonTxPipe; 165 sg2d.fillpipe = nonTxPipe; 166 } 167 sg2d.shapepipe = nonTxPipe; 168 } else { 169 if (!validated) { 170 super.validatePipe(sg2d); 171 } 172 } 173 } 174 175 // install the text pipe based on our earlier decision 176 sg2d.textpipe = textpipe; 177 178 // always override the image pipe with the specialized XRender pipe 179 sg2d.imagepipe = xrDrawImage; 180 } 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 197 protected MaskFill getMaskFill(SunGraphics2D sg2d) { 198 AlphaComposite aComp = null; 199 if(sg2d.composite != null 200 && sg2d.composite instanceof AlphaComposite) { 201 aComp = (AlphaComposite) sg2d.composite; 202 } 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; 214 } 215 216 public RenderLoops getRenderLoops(SunGraphics2D sg2d) { 217 if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && 218 sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) 219 { 220 return solidloops; 221 } 222 223 return super.getRenderLoops(sg2d); 224 } 225 226 public GraphicsConfiguration getDeviceConfiguration() { 227 return graphicsConfig; 228 } 229 230 /** 231 * Method for instantiating a Window SurfaceData 232 */ 233 public static XRWindowSurfaceData createData(X11ComponentPeer peer) { |