use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.
the class GDIWindowSurfaceData method copyArea.
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, int dx, int dy) {
CompositeType comptype = sg2d.imageComp;
if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE && sg2d.clipState != sg2d.CLIP_SHAPE && (CompositeType.SrcOverNoEa.equals(comptype) || CompositeType.SrcNoEa.equals(comptype))) {
x += sg2d.transX;
y += sg2d.transY;
int dstx1 = x + dx;
int dsty1 = y + dy;
int dstx2 = dstx1 + w;
int dsty2 = dsty1 + h;
Region clip = sg2d.getCompClip();
if (dstx1 < clip.getLoX())
dstx1 = clip.getLoX();
if (dsty1 < clip.getLoY())
dsty1 = clip.getLoY();
if (dstx2 > clip.getHiX())
dstx2 = clip.getHiX();
if (dsty2 > clip.getHiY())
dsty2 = clip.getHiY();
if (dstx1 < dstx2 && dsty1 < dsty2) {
gdiPipe.devCopyArea(this, dstx1 - dx, dsty1 - dy, dx, dy, dstx2 - dstx1, dsty2 - dsty1);
}
return true;
}
return false;
}
use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.
the class XorPixelWriter method doDrawRect.
public static void doDrawRect(PixelWriter pw, SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) {
if (w < 0 || h < 0) {
return;
}
int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
if (r.isEmpty()) {
return;
}
int cx1 = r.getLoX();
int cy1 = r.getLoY();
int cx2 = r.getHiX();
int cy2 = r.getHiY();
if (w < 2 || h < 2) {
doSetRect(sData, pw, cx1, cy1, cx2, cy2);
return;
}
if (cy1 == y) {
doSetRect(sData, pw, cx1, cy1, cx2, cy1 + 1);
}
if (cx1 == x) {
doSetRect(sData, pw, cx1, cy1 + 1, cx1 + 1, cy2 - 1);
}
if (cx2 == x2) {
doSetRect(sData, pw, cx2 - 1, cy1 + 1, cx2, cy2 - 1);
}
if (cy2 == y2) {
doSetRect(sData, pw, cx1, cy2 - 1, cx2, cy2);
}
}
Aggregations