harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apavle...@apache.org
Subject svn commit: r601353 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main: java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java native/gl/windows/WinGDIPGraphics2D.cpp
Date Wed, 05 Dec 2007 15:10:26 GMT
Author: apavlenko
Date: Wed Dec  5 07:10:23 2007
New Revision: 601353

URL: http://svn.apache.org/viewvc?rev=601353&view=rev
Log:
Fix for HARMONY-5255: [classlib][awt][EIOffice] printing service error

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java?rev=601353&r1=601352&r2=601353&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
Wed Dec  5 07:10:23 2007
@@ -55,6 +55,7 @@
     private NativeWindow nw = null;
     private long hdc = 0;
     private long gi = 0;
+    private char pageUnit = 1;
 
     private final Dimension size;
 
@@ -155,6 +156,8 @@
      */
     public WinGDIPGraphics2D(final long hdc, final char pageUnit,
                     final int width, final int height) {
+        this.hdc = hdc;
+        this.pageUnit = pageUnit;
         size = new Dimension(width, height);
         gi = createGraphicsInfoFor(hdc, pageUnit);
 
@@ -190,12 +193,18 @@
             System.err.println("WinGDIPGraphics2D.create()"); //$NON-NLS-1$
         }
 
-        WinGDIPGraphics2D res = null;
-        if (img == null) {
-            res = new WinGDIPGraphics2D(nw, origPoint.x, origPoint.y, size.width, size.height);
-        } else {
+        final WinGDIPGraphics2D res;
+
+        if (img != null) {
             res = new WinGDIPGraphics2D(img, gi, size.width, size.height);
+        } else if (nw != null) {
+            res = new WinGDIPGraphics2D(nw, origPoint.x, origPoint.y,
+                            size.width, size.height);
+        } else {
+            res = new WinGDIPGraphics2D(getDC(), pageUnit, size.width,
+                            size.height);
         }
+
         copyInternalFields(res);
         return res;
     }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp?rev=601353&r1=601352&r2=601353&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/WinGDIPGraphics2D.cpp
Wed Dec  5 07:10:23 2007
@@ -118,7 +118,7 @@
  */
 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 *) calloc(1, sizeof(GraphicsInfo));
 
         gi->hdc = (HDC) hdc;
         gi->graphics = new Graphics(gi->hdc);



Mime
View raw message