On Thu, Nov 29, 2018 at 7:04 AM Nikolay Sivov nsivov@codeweavers.com wrote:
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
dlls/windowscodecs/bmpencode.c | 5 +++++ dlls/windowscodecs/jpegformat.c | 12 ++++++++---- dlls/windowscodecs/pngformat.c | 12 ++++++++---- dlls/windowscodecs/tests/converter.c | 24 ++++++++++++++++++++++++ dlls/windowscodecs/tiffformat.c | 5 +++++ 5 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c index fb04f9ddb2..b8783a499e 100644 --- a/dlls/windowscodecs/bmpencode.c +++ b/dlls/windowscodecs/bmpencode.c @@ -472,6 +472,11 @@ static HRESULT WINAPI BmpEncoder_Initialize(IWICBitmapEncoder *iface, static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) {
- TRACE("(%p,%p)\n", iface, pguidContainerFormat);
- if (!pguidContainerFormat)
return E_INVALIDARG;
- memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID)); return S_OK;
} diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index bb3d418667..451d725eb8 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -1381,11 +1381,15 @@ static HRESULT WINAPI JpegEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) {
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
- TRACE("(%p,%p)\n", iface, format);
- if (!format)
return E_INVALIDARG;
- memcpy(format, &GUID_ContainerFormatJpeg, sizeof(*format));
Nitpick: It could be written as "*pguidContainerFormat = GUID_ContainerFormatJpeg;".
- return S_OK;
}
static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 3ac7dee896..fc1f7569e9 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -1968,11 +1968,15 @@ static HRESULT WINAPI PngEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) {
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
- TRACE("(%p,%p)\n", iface, format);
- if (!format)
return E_INVALIDARG;
- memcpy(format, &GUID_ContainerFormatPng, sizeof(*format));
- return S_OK;
}
static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index 5f9f1d88a3..1e557a7fb8 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -849,6 +849,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette) {
- const GUID *container_format = NULL; HRESULT hr; IWICBitmapEncoder *encoder; BitmapTestSrc *src_obj;
@@ -859,6 +860,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *framedecode; WICPixelFormatGUID pixelformat;
GUID guid; int i;
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
@@ -868,6 +870,28 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
- hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
- ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
container_format = &GUID_ContainerFormatPng;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder))
container_format = &GUID_ContainerFormatBmp;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder))
container_format = &GUID_ContainerFormatTiff;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder))
container_format = &GUID_ContainerFormatJpeg;
- else
ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder));
- if (container_format)
- {
memset(&guid, 0, sizeof(guid));
hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr);
ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
- }
- hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache); ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index 67773fd32f..f9a61d4ac1 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -1884,6 +1884,11 @@ exit: static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) {
- TRACE("(%p,%p)\n", iface, pguidContainerFormat);
- if (!pguidContainerFormat)
return E_INVALIDARG;
- memcpy(pguidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)); return S_OK;
}
2.19.2