harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apavle...@apache.org
Subject svn commit: r591778 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main: java/windows/org/apache/harmony/awt/gl/windows/ native/gl/windows/ native/gl/windows/include/
Date Sun, 04 Nov 2007 12:46:00 GMT
Author: apavlenko
Date: Sun Nov  4 04:45:59 2007
New Revision: 591778

URL: http://svn.apache.org/viewvc?rev=591778&view=rev
Log:
Added new constructor for associating WinGDIPGraphics2D with various device contexts such
as printer, etc.

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
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h

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=591778&r1=591777&r2=591778&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
Sun Nov  4 04:45:59 2007
@@ -147,6 +147,28 @@
         setTransform(getTransform());
     }
 
+    /**
+     * Create G2D associated with the specified device context.
+     * 
+     * @param hdc pointer to DC handle
+     * @param pageUnit one of Gdiplus::Unit specifying how to convert Graphics
+     *        coordinates to DC coordinates
+     * @param width Graphics width
+     * @param height Graphics height
+     */
+    public WinGDIPGraphics2D(final long hdc, final char pageUnit,
+                    final int width, final int height) {
+        size = new Dimension(width, height);
+        gi = createGraphicsInfoFor(hdc, pageUnit);
+
+        if (!FontManager.IS_FONTLIB) {
+            jtr = GDIPTextRenderer.inst;
+        }
+
+        dstSurf = new GDISurface(gi);
+        blitter = GDIBlitter.getInstance();
+    }
+
     @Override
     public void addRenderingHints(Map<?,?> hints) {
         super.addRenderingHints(hints);
@@ -532,6 +554,7 @@
 
     // Creates native GraphicsInfo structure
     private native long createGraphicsInfo(long hwnd, int x, int y, int width, int height);
+    private native long createGraphicsInfoFor(long hdc, char pageUnit);
     static native long createCompatibleImageInfo(long hwnd, int width, int height);
     static native long createCompatibleImageInfo(byte[] bytes, int width, int height);
     private native long copyImageInfo(long gi);

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=591778&r1=591777&r2=591778&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
Sun Nov  4 04:45:59 2007
@@ -109,6 +109,27 @@
 }
 
 /*
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    createGraphicsInfoFor
+ * Signature: (JC)J
+ */
+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));
+
+	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);
+
+	return (jlong)gi;
+}
+
+/*
  * Creates compatible GraphicsInfo structure for specified device context
  */
 static inline GraphicsInfo *createCompatibleImageInfo(JNIEnv *env, HDC hdc, jint width, jint
height) {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h?rev=591778&r1=591777&r2=591778&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h
Sun Nov  4 04:45:59 2007
@@ -74,6 +74,14 @@
 
 /*
  * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    createGraphicsInfoFor
+ * Signature: (JC)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createGraphicsInfoFor
+  (JNIEnv *, jobject, jlong, jchar);
+
+/*
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
  * Method:    createCompatibleImageInfo
  * Signature: (JII)J
  */



Mime
View raw message