Module: wine Branch: master Commit: 3ea77f5cfde7dbf1cacf35ff3f0e595eba01d7c7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3ea77f5cfde7dbf1cacf35ff3f...
Author: Evan Stade estade@gmail.com Date: Tue Aug 7 18:42:00 2007 -0700
gdiplus: Added GdipCreateStreamOnFile.
---
dlls/gdiplus/Makefile.in | 2 +- dlls/gdiplus/gdiplus.c | 17 +++++++++++++++++ dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/gdiplus_private.h | 1 + dlls/gdiplus/graphics.c | 24 ++++++++++++++++++++++++ include/gdiplusflat.h | 1 + 6 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index d651c4c..ddf3d99 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = gdiplus.dll IMPORTLIB = libgdiplus.$(IMPLIBEXT) -IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 kernel32 ntdll +IMPORTS = shlwapi oleaut32 ole32 user32 gdi32 advapi32 kernel32 ntdll EXTRALIBS = -luuid
C_SRCS = \ diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c index 3787836..998cec8 100644 --- a/dlls/gdiplus/gdiplus.c +++ b/dlls/gdiplus/gdiplus.c @@ -27,6 +27,9 @@
#include "objbase.h"
+#include "winreg.h" +#include "shlwapi.h" + #include "gdiplus.h" #include "gdiplus_private.h"
@@ -246,3 +249,17 @@ REAL gdiplus_atan2(REAL dy, REAL dx)
return atan2(dy, dx); } + +GpStatus hresult_to_status(HRESULT res) +{ + switch(res){ + case S_OK: + return Ok; + case E_OUTOFMEMORY: + return OutOfMemory; + case E_INVALIDARG: + return InvalidParameter; + default: + return GenericError; + } +} diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 7e53322..218990d 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -129,7 +129,7 @@ @ stub GdipCreateRegionRectI @ stub GdipCreateRegionRgnData @ stdcall GdipCreateSolidFill(long ptr) -@ stub GdipCreateStreamOnFile +@ stdcall GdipCreateStreamOnFile(ptr long ptr) @ stub GdipCreateStringFormat @ stub GdipCreateTexture2 @ stub GdipCreateTexture2I diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 79440a2..130703d 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -41,6 +41,7 @@ COLORREF ARGB2COLORREF(ARGB color); extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle); extern REAL gdiplus_atan2(REAL dy, REAL dx); +extern GpStatus hresult_to_status(HRESULT res);
static inline INT roundr(REAL x) { diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index c21e891..9787234 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -30,6 +30,9 @@ #include "olectl.h" #include "ole2.h"
+#include "winreg.h" +#include "shlwapi.h" + #include "gdiplus.h" #include "gdiplus_private.h" #include "wine/debug.h" @@ -873,6 +876,27 @@ end: return retval; }
+GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, + UINT access, IStream **stream) +{ + DWORD dwMode; + HRESULT ret; + + if(!stream || !filename) + return InvalidParameter; + + if(access & GENERIC_WRITE) + dwMode = STGM_SHARE_DENY_WRITE | STGM_WRITE | STGM_CREATE; + else if(access & GENERIC_READ) + dwMode = STGM_SHARE_DENY_WRITE | STGM_READ | STGM_FAILIFTHERE; + else + return InvalidParameter; + + ret = SHCreateStreamOnFileW(filename, dwMode, stream); + + return hresult_to_status(ret); +} + GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics) { if(!graphics) return InvalidParameter; diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 3035f0d..1768419 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -52,6 +52,7 @@ GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**); GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE,BOOL,GpMetafile**); GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE,BOOL, GDIPCONST WmfPlaceableFileHeader*,GpMetafile**); +GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR*,UINT,IStream**); GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *); GpStatus WINGDIPAPI GdipDrawArc(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,