[PATCH] wincodecs: Return WINCODEC_ERR_PALETTEUNAVAILABLE for jpeg decoder frame.
Nikolay Sivov
nsivov at codeweavers.com
Fri Feb 14 07:20:47 CST 2020
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/windowscodecs/jpegformat.c | 5 +++--
dlls/windowscodecs/tests/jpegformat.c | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index 1df898f28c..0ecbbf48fc 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -635,8 +635,9 @@ static HRESULT WINAPI JpegDecoder_Frame_GetResolution(IWICBitmapFrameDecode *ifa
static HRESULT WINAPI JpegDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
IWICPalette *pIPalette)
{
- FIXME("(%p,%p): stub\n", iface, pIPalette);
- return E_NOTIMPL;
+ TRACE("(%p,%p)\n", iface, pIPalette);
+
+ return WINCODEC_ERR_PALETTEUNAVAILABLE;
}
static HRESULT WINAPI JpegDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface,
diff --git a/dlls/windowscodecs/tests/jpegformat.c b/dlls/windowscodecs/tests/jpegformat.c
index c1e46c4869..341e42c28c 100644
--- a/dlls/windowscodecs/tests/jpegformat.c
+++ b/dlls/windowscodecs/tests/jpegformat.c
@@ -47,6 +47,8 @@ static void test_decode_adobe_cmyk(void)
{
IWICBitmapDecoder *decoder;
IWICBitmapFrameDecode *framedecode;
+ IWICImagingFactory *factory;
+ IWICPalette *palette;
HRESULT hr;
HGLOBAL hjpegdata;
char *jpegdata;
@@ -77,6 +79,10 @@ static void test_decode_adobe_cmyk(void)
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
if (FAILED(hr)) return;
+ hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IWICImagingFactory, (void **)&factory);
+ ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
+
hjpegdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(jpeg_adobe_cmyk_1x5));
ok(hjpegdata != 0, "GlobalAlloc failed\n");
if (hjpegdata)
@@ -125,13 +131,27 @@ static void test_decode_adobe_cmyk(void)
broken(!memcmp(imagedata, expected_imagedata_24bpp, sizeof(expected_imagedata))), /* xp/2003 */
"unexpected image data\n");
}
+
+ hr = IWICImagingFactory_CreatePalette(factory, &palette);
+ ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
+
+ hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
+ ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
+
+ hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
+ ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
+
+ IWICPalette_Release(palette);
+
IWICBitmapFrameDecode_Release(framedecode);
}
IStream_Release(jpegstream);
}
GlobalFree(hjpegdata);
}
+
IWICBitmapDecoder_Release(decoder);
+ IWICImagingFactory_Release(factory);
}
--
2.25.0
More information about the wine-devel
mailing list