* - (translated) src bounds
* - supplied clip (may be non-rectangular)
* Intersect the rectangular regions first since those are
* simpler operations.
*/
Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
ret = ret.getIntersection(dst.getBounds());
Rectangle r = src.getBounds();
// srcxy in src space maps to dstxy in dst space
r.translate(dstx - srcx, dsty - srcy);
ret = ret.getIntersection(r);
if (clip != null) {
// Intersect with clip last since it may be non-rectangular
ret = ret.getIntersection(clip);
}
return ret;
}