[4/7] gdiplus: GDIP_PEN global pen instance
Evan Stade
estade at gmail.com
Thu Jun 21 18:15:28 CDT 2007
Hi,
It's usually frowned-upon to use global variables but I think in this
case it's justified.
It serves a function similar to stock objects in GDI. The alternative
to having this would be that every time you want to call a function
that requires a pen you don't care about, you have to create the pen
manually.
Changelog:
*added GDIP_PEN (global gdi+ pen variable)
*added instantiation and deletion code
dlls/gdiplus/gdiplus.c | 9 +++++++++
dlls/gdiplus/gdiplus_private.h | 4 ++++
2 files changed, 13 insertions(+), 0 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
index 4e9fb1c..7ba18b9 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
*/
@@ -65,6 +67,11 @@ Status WINAPI GdiplusStartup(ULONG_PTR *
return NotImplemented;
}
+ if(GdipCreatePen1((ARGB) 0, 0, UnitPixel, &GDIP_PEN) != Ok){
+ FIXME("Problem starting GDI+\n");
+ return GenericError;
+ }
+
return Ok;
}
@@ -74,6 +81,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 f9d5710..f049fd1 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -54,7 +54,11 @@ struct GpPath{
GpFillMode fill;
GpGraphics* graphics;
GpPathData pathdata;
+ INT datalen;
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