200 int srcx, int srcy,
201 int dstx, int dsty,
202 int width, int height)
203 {
204 performop.MaskBlit(srcData, dstData, comp, clip,
205 srcx, srcy, dstx, dsty,
206 width, height,
207 null, 0, 0);
208 }
209 }
210
211 private static class GeneralXorBlit
212 extends Blit
213 implements GeneralBinaryOp
214 {
215 Blit convertsrc;
216 Blit convertdst;
217 Blit performop;
218 Blit convertresult;
219
220 WeakReference srcTmp;
221 WeakReference dstTmp;
222
223 public GeneralXorBlit(SurfaceType srctype,
224 CompositeType comptype,
225 SurfaceType dsttype)
226 {
227 super(srctype, comptype, dsttype);
228 }
229
230 public void setPrimitives(Blit srcconverter,
231 Blit dstconverter,
232 GraphicsPrimitive genericop,
233 Blit resconverter)
234 {
235 this.convertsrc = srcconverter;
236 this.convertdst = dstconverter;
237 this.performop = (Blit) genericop;
238 this.convertresult = resconverter;
239 }
240
241 public synchronized void Blit(SurfaceData srcData,
242 SurfaceData dstData,
243 Composite comp,
244 Region clip,
245 int srcx, int srcy,
246 int dstx, int dsty,
247 int width, int height)
248 {
249 SurfaceData src, dst;
250 Region opclip;
251 int sx, sy, dx, dy;
252
253 if (convertsrc == null) {
254 src = srcData;
255 sx = srcx;
256 sy = srcy;
257 } else {
258 SurfaceData cachedSrc = null;
259 if (srcTmp != null) {
260 cachedSrc = (SurfaceData) srcTmp.get();
261 }
262 src = convertFrom(convertsrc, srcData, srcx, srcy,
263 width, height, cachedSrc);
264 sx = 0;
265 sy = 0;
266 if (src != cachedSrc) {
267 srcTmp = new WeakReference(src);
268 }
269 }
270
271 if (convertdst == null) {
272 dst = dstData;
273 dx = dstx;
274 dy = dsty;
275 opclip = clip;
276 } else {
277 // assert: convertresult != null
278 SurfaceData cachedDst = null;
279 if (dstTmp != null) {
280 cachedDst = (SurfaceData) dstTmp.get();
281 }
282 dst = convertFrom(convertdst, dstData, dstx, dsty,
283 width, height, cachedDst);
284 dx = 0;
285 dy = 0;
286 opclip = null;
287 if (dst != cachedDst) {
288 dstTmp = new WeakReference(dst);
289 }
290 }
291
292 performop.Blit(src, dst, comp, opclip,
293 sx, sy, dx, dy,
294 width, height);
295
296 if (convertresult != null) {
297 // assert: convertdst != null
298 convertTo(convertresult, dst, dstData, clip,
299 dstx, dsty, width, height);
300 }
301 }
302 }
303
304 public GraphicsPrimitive traceWrap() {
305 return new TraceBlit(this);
306 }
307
308 private static class TraceBlit extends Blit {
|
200 int srcx, int srcy,
201 int dstx, int dsty,
202 int width, int height)
203 {
204 performop.MaskBlit(srcData, dstData, comp, clip,
205 srcx, srcy, dstx, dsty,
206 width, height,
207 null, 0, 0);
208 }
209 }
210
211 private static class GeneralXorBlit
212 extends Blit
213 implements GeneralBinaryOp
214 {
215 Blit convertsrc;
216 Blit convertdst;
217 Blit performop;
218 Blit convertresult;
219
220 WeakReference<SurfaceData> srcTmp;
221 WeakReference<SurfaceData> dstTmp;
222
223 public GeneralXorBlit(SurfaceType srctype,
224 CompositeType comptype,
225 SurfaceType dsttype)
226 {
227 super(srctype, comptype, dsttype);
228 }
229
230 public void setPrimitives(Blit srcconverter,
231 Blit dstconverter,
232 GraphicsPrimitive genericop,
233 Blit resconverter)
234 {
235 this.convertsrc = srcconverter;
236 this.convertdst = dstconverter;
237 this.performop = (Blit) genericop;
238 this.convertresult = resconverter;
239 }
240
241 public synchronized void Blit(SurfaceData srcData,
242 SurfaceData dstData,
243 Composite comp,
244 Region clip,
245 int srcx, int srcy,
246 int dstx, int dsty,
247 int width, int height)
248 {
249 SurfaceData src, dst;
250 Region opclip;
251 int sx, sy, dx, dy;
252
253 if (convertsrc == null) {
254 src = srcData;
255 sx = srcx;
256 sy = srcy;
257 } else {
258 SurfaceData cachedSrc = null;
259 if (srcTmp != null) {
260 cachedSrc = srcTmp.get();
261 }
262 src = convertFrom(convertsrc, srcData, srcx, srcy,
263 width, height, cachedSrc);
264 sx = 0;
265 sy = 0;
266 if (src != cachedSrc) {
267 srcTmp = new WeakReference<>(src);
268 }
269 }
270
271 if (convertdst == null) {
272 dst = dstData;
273 dx = dstx;
274 dy = dsty;
275 opclip = clip;
276 } else {
277 // assert: convertresult != null
278 SurfaceData cachedDst = null;
279 if (dstTmp != null) {
280 cachedDst = dstTmp.get();
281 }
282 dst = convertFrom(convertdst, dstData, dstx, dsty,
283 width, height, cachedDst);
284 dx = 0;
285 dy = 0;
286 opclip = null;
287 if (dst != cachedDst) {
288 dstTmp = new WeakReference<>(dst);
289 }
290 }
291
292 performop.Blit(src, dst, comp, opclip,
293 sx, sy, dx, dy,
294 width, height);
295
296 if (convertresult != null) {
297 // assert: convertdst != null
298 convertTo(convertresult, dst, dstData, clip,
299 dstx, dsty, width, height);
300 }
301 }
302 }
303
304 public GraphicsPrimitive traceWrap() {
305 return new TraceBlit(this);
306 }
307
308 private static class TraceBlit extends Blit {
|