Index: modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java =================================================================== --- modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java (revision 593087) +++ modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java (working copy) @@ -96,7 +96,6 @@ size = new Dimension(b.width, b.height); gi = createGraphicsInfo(this.nw.getId(), tx, ty, b.width, b.height); - setTransformedClip(this.clip); if (!FontManager.IS_FONTLIB) { jtr = GDIPTextRenderer.inst; } @@ -112,7 +111,6 @@ size = new Dimension(width, height); gi = createGraphicsInfo(this.nw.getId(), tx, ty, width, height); - setTransformedClip(this.clip); if (!FontManager.IS_FONTLIB) { jtr = GDIPTextRenderer.inst; } @@ -138,7 +136,6 @@ } else { this.gi = copyImageInfo(img.gi); } - setTransformedClip(this.clip); dstSurf = img.getImageSurface(); blitter = GDIBlitter.getInstance(); if (!FontManager.IS_FONTLIB) { Index: modules/awt/src/main/native/gl/windows/include/gl_GDIPlus.h =================================================================== --- modules/awt/src/main/native/gl/windows/include/gl_GDIPlus.h (revision 593087) +++ modules/awt/src/main/native/gl/windows/include/gl_GDIPlus.h (working copy) @@ -35,6 +35,7 @@ Brush *brush; HBITMAP bmp; Matrix *matrix; + Region *clip; } GraphicsInfo; typedef struct _GLBITMAPINFO{ Index: modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp =================================================================== --- modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp (revision 593087) +++ modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp (working copy) @@ -105,6 +105,9 @@ gi->bmp = 0; gi->matrix = new Matrix(); + gi->clip = new Region(Rect(x, y, width, height)); + gi->graphics->SetClip(gi->clip); + return (jlong)gi; } @@ -115,18 +118,21 @@ */ JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createGraphicsInfoFor (JNIEnv * env, jobject obj, jlong hdc, jchar pageUnit) { - GraphicsInfo * gi = (GraphicsInfo *) malloc(sizeof(GraphicsInfo)); + GraphicsInfo * gi = (GraphicsInfo *) malloc(sizeof(GraphicsInfo)); - gi->hdc = (HDC) hdc; - gi->graphics = new Graphics(gi->hdc); - gi->pen = 0; - gi->brush = 0; - gi->bmp = 0; - gi->matrix = new Matrix(); + gi->hdc = (HDC) hdc; + gi->graphics = new Graphics(gi->hdc); + gi->pen = 0; + gi->brush = 0; + gi->bmp = 0; + gi->matrix = new Matrix(); - gi->graphics->SetPageUnit((Gdiplus::Unit) pageUnit); + gi->clip = new Region(); + gi->graphics->SetClip(gi->clip); - return (jlong)gi; + gi->graphics->SetPageUnit((Gdiplus::Unit) pageUnit); + + return (jlong)gi; } /* @@ -172,6 +178,9 @@ gi->pen = 0; gi->brush = 0; gi->matrix = 0; + + gi->clip = new Region(Rect(0, 0, width, height)); + gi->graphics->SetClip(gi->clip); return gi; } @@ -222,12 +231,13 @@ gi->hdc = origgi->hdc; gi->bmp = 0; gi->graphics = new Graphics(gi->hdc); + + gi->clip = new Region(); if (origgi->graphics != NULL) { - Region clip; - origgi->graphics->GetClip(&clip); - gi->graphics->SetClip(&clip); + origgi->graphics->GetClip(gi->clip); } + gi->graphics->SetClip(gi->clip); gi->pen = (origgi->pen != NULL)?origgi->pen->Clone():0; gi->brush = (origgi->brush != NULL)?origgi->brush->Clone():0; gi->matrix = (origgi->matrix != NULL)?origgi->matrix->Clone():new Matrix(); @@ -264,6 +274,10 @@ delete(gi->matrix); } + if (gi->clip) { + delete(gi->clip); + } + // If hwnd and bmp are 0 then we should not destroy HDC // because it's a copy of VolatileImage if (gi->hwnd != 0 || gi->bmp != 0) { @@ -679,7 +693,7 @@ return; GraphicsInfo *gi = (GraphicsInfo *)gip; - gi->graphics->ResetClip(); + gi->graphics->SetClip(gi->clip); } /*