-
- if (dx2 - dx1 != sx2 - sx1 || dy2 - dy1 != sy2 - sy1)
- g.drawImage(i, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, o);
- else {
- // fastpath for images that do not need to be scaled
- if (i instanceof BufferedImage) {
- BufferedImage b = (BufferedImage)i;
-
- if (dx2 - dx1 != b.getWidth(null) || dy2 - dy1 != b.getHeight(null)) {
- b = b.getSubimage(sx1, sy1, sx2 - sx1, sy2 - sy1);
- sx2 = sx2 - sx1;
- sy2 = sy2 - sy1;
- sx1 = 0;
- sy1 = 0;
- }
- g.drawImage(b, dx1, dy1, o);
-
- } else {
-
- // workaround for a wierd JDK bug
- boolean skip = false;
- try { g.getClipBounds(clipBounds); } catch (NullPointerException n) { skip = true; }
-
- g.clipRect(dx1, dy1, dx2 - dx1, dy2 - dy1);
- g.drawImage(i, dx1 - sx1, dy1 - sy1, o);
-
- if (!skip) g.setClip(clipBounds.x, clipBounds.y, clipBounds.x + clipBounds.width, clipBounds.y + clipBounds.height);
- }
- }
+ g.drawImage(i, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, o);