gdiplus: add global gdi+ pen instance [try2]

Evan Stade estade at gmail.com
Fri Jun 22 21:23:11 CDT 2007


Hi,

This is a resend; the last one was not committed because of dependency
on other un-committed patches.

Changelog:
*add global pen instance

 dlls/gdiplus/gdiplus.c         |   17 ++++++++++++++---
 dlls/gdiplus/gdiplus_private.h |    3 +++
 2 files changed, 17 insertions(+), 3 deletions(-)
-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
index 959bcb0..7e20714 100644
--- a/dlls/gdiplus/gdiplus.c
+++ b/dlls/gdiplus/gdiplus.c
@@ -26,6 +26,8 @@ #include "gdiplus.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
 
+GpPen* GDIP_PEN;
+
 /*****************************************************
  *      DllMain
  */
@@ -51,6 +53,8 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWO
 Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input,
                              struct GdiplusStartupOutput *output)
 {
+    Status ret = Ok;
+
     if(!token)
         return InvalidParameter;
 
@@ -59,13 +63,18 @@ Status WINAPI GdiplusStartup(ULONG_PTR *
     } else if ((input->DebugEventCallback) ||
         (input->SuppressBackgroundThread) || (input->SuppressExternalCodecs)){
         FIXME("Unimplemented for non-default GdiplusStartupInput\n");
-        return NotImplemented;
+        ret = NotImplemented;
     } else if(output) {
         FIXME("Unimplemented for non-null GdiplusStartupOutput\n");
-        return NotImplemented;
+        ret = NotImplemented;
     }
 
-    return Ok;
+    if(GdipCreatePen1((ARGB) 0, 0, UnitPixel, &GDIP_PEN) != Ok){
+        FIXME("Problem starting GDI+\n");
+        return GenericError;
+    }
+
+    return ret;
 }
 
 /*****************************************************
@@ -74,6 +83,8 @@ Status WINAPI GdiplusStartup(ULONG_PTR *
 void WINAPI GdiplusShutdown(ULONG_PTR token)
 {
     /* FIXME: no object tracking */
+
+    GdipDeletePen(GDIP_PEN);
 }
 
 /*****************************************************
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index e221044..0b60b51 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -56,4 +56,7 @@ struct GpPath{
     BOOL newfigure; /* whether the next drawing action starts a new figure */
 };
 
+/* global GDI+ variables (akin to "stock" gdi objects) */
+extern GpPen* GDIP_PEN;
+
 #endif
-- 
1.4.1



More information about the wine-patches mailing list