From 2dff0d6075547a864431b0722698f3ffe0db92cd Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 15 May 2016 19:09:59 +0200 Subject: [PATCH] oleaut32-OLEPictureImpl_SaveAsFile: Implement SaveAsFile for PICTYPE_ENHMETAFILE. --- ...nt-SaveAsFile-for-PICTYPE_ENHMETAFIL.patch | 64 +++++++++++++++++++ .../definition | 1 + patches/patchinstall.sh | 48 ++++++++------ 3 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 patches/oleaut32-OLEPictureImpl_SaveAsFile/0003-oleaut32-Implement-SaveAsFile-for-PICTYPE_ENHMETAFIL.patch diff --git a/patches/oleaut32-OLEPictureImpl_SaveAsFile/0003-oleaut32-Implement-SaveAsFile-for-PICTYPE_ENHMETAFIL.patch b/patches/oleaut32-OLEPictureImpl_SaveAsFile/0003-oleaut32-Implement-SaveAsFile-for-PICTYPE_ENHMETAFIL.patch new file mode 100644 index 00000000..b158d1cf --- /dev/null +++ b/patches/oleaut32-OLEPictureImpl_SaveAsFile/0003-oleaut32-Implement-SaveAsFile-for-PICTYPE_ENHMETAFIL.patch @@ -0,0 +1,64 @@ +From 517bb10261069abd3ffd642dddd6338b7cacd094 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sun, 15 May 2016 19:08:44 +0200 +Subject: oleaut32: Implement SaveAsFile for PICTYPE_ENHMETAFILE. + +--- + dlls/oleaut32/olepicture.c | 17 +++++++++++++++-- + dlls/oleaut32/tests/olepicture.c | 3 --- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c +index 7d13942..db90c4c 100644 +--- a/dlls/oleaut32/olepicture.c ++++ b/dlls/oleaut32/olepicture.c +@@ -1961,9 +1961,22 @@ static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface, + case PICTYPE_METAFILE: + FIXME("PICTYPE_METAFILE is not implemented\n"); + return E_NOTIMPL; ++ + case PICTYPE_ENHMETAFILE: +- FIXME("ENHMETAFILE is not implemented\n"); +- return E_NOTIMPL; ++ if (!mem_copy) return E_FAIL; ++ ++ if (This->bIsDirty || !This->data) ++ { ++ if (!serializeEMF(This->desc.u.emf.hemf, &data, &data_size)) ++ return E_FAIL; ++ HeapFree(GetProcessHeap(), 0, This->data); ++ This->data = data; ++ This->datalen = data_size; ++ } ++ hr = IStream_Write(stream, This->data, This->datalen, &written); ++ if (hr == S_OK && size) *size = written; ++ return hr; ++ + default: + FIXME("%#x is not implemented\n", This->desc.picType); + break; +diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c +index 29d787e..7b1178e 100644 +--- a/dlls/oleaut32/tests/olepicture.c ++++ b/dlls/oleaut32/tests/olepicture.c +@@ -1338,7 +1338,6 @@ static void test_load_save_emf(void) + size = -1; + hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size); + ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr); +-todo_wine + ok(size == 128, "expected 128, got %d\n", size); + emh = GlobalLock(hmem); + if (size) +@@ -1350,9 +1349,7 @@ if (size) + + size = -1; + hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size); +-todo_wine + ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr); +-todo_wine + ok(size == -1, "expected -1, got %d\n", size); + + offset.QuadPart = 0; +-- +2.8.0 + diff --git a/patches/oleaut32-OLEPictureImpl_SaveAsFile/definition b/patches/oleaut32-OLEPictureImpl_SaveAsFile/definition index 41c23ea7..26889d7a 100644 --- a/patches/oleaut32-OLEPictureImpl_SaveAsFile/definition +++ b/patches/oleaut32-OLEPictureImpl_SaveAsFile/definition @@ -1 +1,2 @@ Fixes: [8532] Implement a better stub for IPicture::SaveAsFile +Depends: oleaut32-Load_Save_EMF diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 310923b0..50295175 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -2222,6 +2222,13 @@ if test "$enable_gdiplus_GdipCreateMetafileFromStream" -eq 1; then enable_oleaut32_OLEPictureImpl_SaveAsFile=1 fi +if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -eq 1; then + if test "$enable_oleaut32_Load_Save_EMF" -gt 1; then + abort "Patchset oleaut32-Load_Save_EMF disabled, but oleaut32-OLEPictureImpl_SaveAsFile depends on that." + fi + enable_oleaut32_Load_Save_EMF=1 +fi + if test "$enable_dxva2_Video_Decoder" -eq 1; then if test "$enable_winecfg_Staging" -gt 1; then abort "Patchset winecfg-Staging disabled, but dxva2-Video_Decoder depends on that." @@ -3692,8 +3699,28 @@ if test "$enable_gdi32_Symbol_Truetype_Font" -eq 1; then ) >> "$patchlist" fi +# Patchset oleaut32-Load_Save_EMF +# | +# | This patchset fixes the following Wine bugs: +# | * [#40523] Implement support for loading and saving EMF to IPicture interface +# | +# | Modified files: +# | * dlls/oleaut32/olepicture.c, dlls/oleaut32/tests/olepicture.c +# | +if test "$enable_oleaut32_Load_Save_EMF" -eq 1; then + patch_apply oleaut32-Load_Save_EMF/0001-oleaut32-tests-Add-some-tests-for-loading-and-saving.patch + patch_apply oleaut32-Load_Save_EMF/0002-oleaut32-Add-support-for-loading-and-saving-EMF-to-I.patch + ( + echo '+ { "Dmitry Timoshkov", "oleaut32/tests: Add some tests for loading and saving EMF using IPicture interface.", 1 },'; + echo '+ { "Dmitry Timoshkov", "oleaut32: Add support for loading and saving EMF to IPicture interface.", 1 },'; + ) >> "$patchlist" +fi + # Patchset oleaut32-OLEPictureImpl_SaveAsFile # | +# | This patchset has the following (direct or indirect) dependencies: +# | * oleaut32-Load_Save_EMF +# | # | This patchset fixes the following Wine bugs: # | * [#8532] Implement a better stub for IPicture::SaveAsFile # | @@ -3704,16 +3731,18 @@ fi if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -eq 1; then patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0001-gdiplus-Reimplement-metafile-loading-using-gdi32-ins.patch patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0002-oleaut32-Implement-a-better-stub-for-IPicture-SaveAs.patch + patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0003-oleaut32-Implement-SaveAsFile-for-PICTYPE_ENHMETAFIL.patch ( echo '+ { "Dmitry Timoshkov", "gdiplus: Reimplement metafile loading using gdi32 instead of IPicture.", 2 },'; echo '+ { "Dmitry Timoshkov", "oleaut32: Implement a better stub for IPicture::SaveAsFile.", 1 },'; + echo '+ { "Sebastian Lackner", "oleaut32: Implement SaveAsFile for PICTYPE_ENHMETAFILE.", 1 },'; ) >> "$patchlist" fi # Patchset gdiplus-GdipCreateMetafileFromStream # | # | This patchset has the following (direct or indirect) dependencies: -# | * oleaut32-OLEPictureImpl_SaveAsFile +# | * oleaut32-Load_Save_EMF, oleaut32-OLEPictureImpl_SaveAsFile # | # | This patchset fixes the following Wine bugs: # | * [#40325] Implement GdipCreateMetafileFromStream @@ -5535,23 +5564,6 @@ if test "$enable_oleaut32_CreateTypeLib" -eq 1; then ) >> "$patchlist" fi -# Patchset oleaut32-Load_Save_EMF -# | -# | This patchset fixes the following Wine bugs: -# | * [#40523] Implement support for loading and saving EMF to IPicture interface -# | -# | Modified files: -# | * dlls/oleaut32/olepicture.c, dlls/oleaut32/tests/olepicture.c -# | -if test "$enable_oleaut32_Load_Save_EMF" -eq 1; then - patch_apply oleaut32-Load_Save_EMF/0001-oleaut32-tests-Add-some-tests-for-loading-and-saving.patch - patch_apply oleaut32-Load_Save_EMF/0002-oleaut32-Add-support-for-loading-and-saving-EMF-to-I.patch - ( - echo '+ { "Dmitry Timoshkov", "oleaut32/tests: Add some tests for loading and saving EMF using IPicture interface.", 1 },'; - echo '+ { "Dmitry Timoshkov", "oleaut32: Add support for loading and saving EMF to IPicture interface.", 1 },'; - ) >> "$patchlist" -fi - # Patchset oleaut32-OleLoadPicture # | # | This patchset fixes the following Wine bugs: