[PATCH 4/4] shell32: Implement IShellImageData::Draw()

Nikolay Sivov nsivov at codeweavers.com
Mon Feb 6 17:12:54 CST 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/shell32/shellole.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index 8fb981c017..d3d972b96d 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -920,10 +920,30 @@ static HRESULT WINAPI ShellImageData_Decode(IShellImageData *iface, DWORD flags,
 static HRESULT WINAPI ShellImageData_Draw(IShellImageData *iface, HDC hdc, RECT *dest, RECT *src)
 {
     ShellImageData *This = impl_from_IShellImageData(iface);
+    GpGraphics *graphics;
+    HRESULT hr;
 
-    FIXME("%p, %p, %s, %s: stub\n", This, hdc, wine_dbgstr_rect(dest), wine_dbgstr_rect(src));
+    TRACE("%p, %p, %s, %s\n", This, hdc, wine_dbgstr_rect(dest), wine_dbgstr_rect(src));
 
-    return E_NOTIMPL;
+    if (!This->image)
+        return E_FAIL;
+
+    if (!dest)
+        return E_INVALIDARG;
+
+    if (!src)
+        return S_OK;
+
+    hr = gpstatus_to_hresult(GdipCreateFromHDC(hdc, &graphics));
+    if (FAILED(hr))
+        return hr;
+
+    hr = gpstatus_to_hresult(GdipDrawImageRectRectI(graphics, This->image, dest->left, dest->top, dest->right - dest->left,
+        dest->bottom - dest->top, src->left, src->top, src->right - src->left, src->bottom - src->top,
+        UnitPixel, NULL, NULL, NULL));
+    GdipDeleteGraphics(graphics);
+
+    return hr;
 }
 
 static HRESULT WINAPI ShellImageData_NextFrame(IShellImageData *iface)
-- 
2.11.0




More information about the wine-patches mailing list