use of sun.java2d.pipe.SpanIterator in project jdk8u_jdk by JetBrains.
the class XorCopyArgbToAny method Blit.
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int srcx, int srcy, int dstx, int dsty, int w, int h) {
Raster srcRast = src.getRaster(srcx, srcy, w, h);
ColorModel srcCM = src.getColorModel();
Raster dstRast = dst.getRaster(dstx, dsty, w, h);
IntegerComponentRaster icr = (IntegerComponentRaster) dstRast;
int[] dstPix = icr.getDataStorage();
Region roi = CustomComponent.getRegionOfInterest(src, dst, clip, srcx, srcy, dstx, dsty, w, h);
SpanIterator si = roi.getSpanIterator();
Object srcPix = null;
int dstScan = icr.getScanlineStride();
// assert(icr.getPixelStride() == 1);
srcx -= dstx;
srcy -= dsty;
int[] span = new int[4];
while (si.nextSpan(span)) {
int rowoff = icr.getDataOffset(0) + span[1] * dstScan + span[0];
for (int y = span[1]; y < span[3]; y++) {
int off = rowoff;
for (int x = span[0]; x < span[2]; x++) {
srcPix = srcRast.getDataElements(x + srcx, y + srcy, srcPix);
dstPix[off++] = srcCM.getRGB(srcPix);
}
rowoff += dstScan;
}
}
// Pixels in the dest were modified directly, we must
// manually notify the raster that it was modified
icr.markDirty();
// REMIND: We need to do something to make sure that dstRast
// is put back to the destination (as in the native Release
// function)
// src.releaseRaster(srcRast); // NOP?
// dst.releaseRaster(dstRast);
}
Aggregations