< prev index next >

src/java.desktop/macosx/classes/sun/java2d/OSXOffScreenSurfaceData.java

Print this page

        

*** 476,492 **** */ public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, int dx, int dy) { // <rdar://problem/4488745> For the Sun2D renderer we should rely on the implementation of the super class. // BufImageSurfaceData.java doesn't have an implementation of copyArea() and relies on the super class. ! int offsetX = 0; ! int offsetY = 0; ! if (sg2d.transformState == SunGraphics2D.TRANSFORM_ANY_TRANSLATE || ! sg2d.transformState == SunGraphics2D.TRANSFORM_INT_TRANSLATE) { ! offsetX = (int) sg2d.transform.getTranslateX(); ! offsetY = (int) sg2d.transform.getTranslateY(); ! } else if (sg2d.transformState != SunGraphics2D.TRANSFORM_ISIDENT) { return false; } // reset the clip (this is how it works on windows) // we actually can handle a case with any clips but windows ignores the light clip Shape clip = sg2d.getClip(); sg2d.setClip(getBounds()); --- 476,488 ---- */ public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, int dx, int dy) { // <rdar://problem/4488745> For the Sun2D renderer we should rely on the implementation of the super class. // BufImageSurfaceData.java doesn't have an implementation of copyArea() and relies on the super class. ! if (sg2d.transformState > SunGraphics2D.TRANSFORM_ANY_TRANSLATE) { ! return false; ! } // reset the clip (this is how it works on windows) // we actually can handle a case with any clips but windows ignores the light clip Shape clip = sg2d.getClip(); sg2d.setClip(getBounds());
*** 496,517 **** if (clippedCopyAreaRect == null) { // clipped out return true; } ! // the rectangle returned from clipCopyArea() is in the coordinate space of the surface (image) ! // we need to substract the offsetX and offsetY to move it to the coordinate space of the graphics2d. ! // sg2d.drawImage expects the destination rect to be in the coord space of the graphics2d. <rdar://3746194> ! // (vm) ! x = clippedCopyAreaRect.x - offsetX; ! y = clippedCopyAreaRect.y - offsetY; w = clippedCopyAreaRect.width; h = clippedCopyAreaRect.height; ! // copy (dst coordinates are in the coord space of the graphics2d, and src coordinates are ! // in the coordinate space of the image) ! sg2d.drawImage(this.bim, x + dx, y + dy, x + dx + w, y + dy + h, x + offsetX, y + offsetY, x + w + offsetX, y + h + offsetY, null); // restore the clip sg2d.setClip(clip); return true; --- 492,518 ---- if (clippedCopyAreaRect == null) { // clipped out return true; } ! // the rectangle returned from clipCopyArea() is in the coordinate space ! // of the surface (image) ! x = clippedCopyAreaRect.x; ! y = clippedCopyAreaRect.y; w = clippedCopyAreaRect.width; h = clippedCopyAreaRect.height; ! // copy (dst coordinates are in the coord space of the graphics2d, and ! // src coordinates are in the coordinate space of the image) ! // sg2d.drawImage expects the destination rect to be in the coord space ! // of the graphics2d. <rdar://3746194> (vm) ! // we need to substract the transX and transY to move it ! // to the coordinate space of the graphics2d. ! int dstX = x + dx - sg2d.transX; ! int dstY = y + dy - sg2d.transY; ! sg2d.drawImage(this.bim, dstX, dstY, dstX + w, dstY + h, ! x, y, x + w, y + h, null); // restore the clip sg2d.setClip(clip); return true;
< prev index next >