--- old/src/share/classes/sun/java2d/SunGraphics2D.java 2014-05-22 21:44:52.000000000 +0400 +++ new/src/share/classes/sun/java2d/SunGraphics2D.java 2014-05-22 21:44:52.000000000 +0400 @@ -2108,7 +2108,7 @@ if (theData.copyArea(this, x, y, w, h, dx, dy)) { return; } - if (transformState >= TRANSFORM_TRANSLATESCALE) { + if (transformState > TRANSFORM_TRANSLATESCALE) { throw new InternalError("transformed copyArea not implemented yet"); } // REMIND: This method does not deal with missing data from the @@ -2129,9 +2129,26 @@ lastCAcomp = comp; } - x += transX; - y += transY; + double[] coords = {x, y, x + w, y + h, x + dx, y + dy}; + transform.transform(coords, 0, coords, 0, 3); + x = (int)Math.ceil(coords[0] - 0.5); + y = (int)Math.ceil(coords[1] - 0.5); + w = ((int)Math.ceil(coords[2] - 0.5)) - x; + h = ((int)Math.ceil(coords[3] - 0.5)) - y; + dx = ((int)Math.ceil(coords[4] - 0.5)) - x; + dy = ((int)Math.ceil(coords[5] - 0.5)) - y; + + // In case of negative scale transform, reflect the rect coords. + if (w < 0) { + w *= -1; + x -= w; + } + if (h < 0) { + h *= -1; + y -= h; + } + Blit ob = lastCAblit; if (dy == 0 && dx > 0 && dx < w) { while (w > 0) {