diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/gdiputil.cpp')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/gdiputil.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/gdiputil.cpp b/src/libs/dutil/WixToolset.DUtil/gdiputil.cpp index b5a0087c..c8b6814f 100644 --- a/src/libs/dutil/WixToolset.DUtil/gdiputil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/gdiputil.cpp | |||
@@ -56,6 +56,7 @@ extern "C" void DAPI GdipUninitialize( | |||
56 | 56 | ||
57 | /******************************************************************** | 57 | /******************************************************************** |
58 | GdipBitmapFromResource - read a GDI+ image out of a resource stream | 58 | GdipBitmapFromResource - read a GDI+ image out of a resource stream |
59 | of type RT_RCDATA. | ||
59 | 60 | ||
60 | ********************************************************************/ | 61 | ********************************************************************/ |
61 | extern "C" HRESULT DAPI GdipBitmapFromResource( | 62 | extern "C" HRESULT DAPI GdipBitmapFromResource( |
@@ -67,12 +68,13 @@ extern "C" HRESULT DAPI GdipBitmapFromResource( | |||
67 | HRESULT hr = S_OK; | 68 | HRESULT hr = S_OK; |
68 | LPVOID pvData = NULL; | 69 | LPVOID pvData = NULL; |
69 | DWORD cbData = 0; | 70 | DWORD cbData = 0; |
70 | HGLOBAL hGlobal = NULL;; | 71 | HGLOBAL hGlobal = NULL; |
71 | LPVOID pv = NULL; | 72 | LPVOID pv = NULL; |
72 | IStream *pStream = NULL; | 73 | IStream *pStream = NULL; |
73 | Bitmap *pBitmap = NULL; | 74 | Bitmap *pBitmap = NULL; |
74 | Status gs = Ok; | 75 | Status gs = Ok; |
75 | 76 | ||
77 | // Use ResReadData (RT_RCDATA) instead of Bitmap::FromResource (RT_BITMAP) to support all file formats that GDI+ supports. | ||
76 | hr = ResReadData(hinst, szId, &pvData, &cbData); | 78 | hr = ResReadData(hinst, szId, &pvData, &cbData); |
77 | GdipExitOnFailure(hr, "Failed to load GDI+ bitmap from resource."); | 79 | GdipExitOnFailure(hr, "Failed to load GDI+ bitmap from resource."); |
78 | 80 | ||
@@ -159,6 +161,27 @@ LExit: | |||
159 | } | 161 | } |
160 | 162 | ||
161 | 163 | ||
164 | /******************************************************************** | ||
165 | GdipBitmapToGdiBitmap - convert Gdiplus::Bitmap to HBITMAP. | ||
166 | |||
167 | ********************************************************************/ | ||
168 | extern "C" HRESULT DAPI GdipBitmapToGdiBitmap( | ||
169 | __in Gdiplus::Bitmap* pBitmap, | ||
170 | __out HBITMAP* phBitmap | ||
171 | ) | ||
172 | { | ||
173 | HRESULT hr = S_OK; | ||
174 | Status gs = Ok; | ||
175 | Color black; | ||
176 | |||
177 | gs = pBitmap->GetHBITMAP(black, phBitmap); | ||
178 | GdipExitOnGdipFailure(gs, hr, "Failed to convert GDI+ bitmap into HBITMAP."); | ||
179 | |||
180 | LExit: | ||
181 | return hr; | ||
182 | } | ||
183 | |||
184 | |||
162 | HRESULT DAPI GdipHresultFromStatus( | 185 | HRESULT DAPI GdipHresultFromStatus( |
163 | __in Gdiplus::Status gs | 186 | __in Gdiplus::Status gs |
164 | ) | 187 | ) |