Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/windowscodecs/imgfactory.c | 10 ++++++++++ dlls/windowscodecs/tests/bitmap.c | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 78919a7387..b564efc332 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -19,6 +19,7 @@ #include "config.h" +#include <assert.h> #include <stdarg.h> #define COBJMACROS @@ -501,9 +502,18 @@ static HRESULT create_bitmap_from_source_rect(IWICBitmapSource *piBitmapSource, IWICPixelFormatInfo2 *formatinfo; WICPixelFormatNumericRepresentation format_type; + assert(!rect || (rect && option == WICBitmapCacheOnLoad)); + if (!piBitmapSource || !ppIBitmap) return E_INVALIDARG; + if (option == WICBitmapNoCache && SUCCEEDED(IWICBitmapSource_QueryInterface(piBitmapSource, + &IID_IWICBitmap, (void **)&result))) + { + *ppIBitmap = result; + return S_OK; + } + hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height); if (SUCCEEDED(hr) && rect) diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index 61e985a19a..5c225d2abb 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -456,7 +456,6 @@ static void test_createbitmapfromsource(void) hr = IWICImagingFactory_CreateBitmapFromSource(factory, (IWICBitmapSource *)bitmap, WICBitmapNoCache, &bitmap2); ok(hr == S_OK, "IWICImagingFactory_CreateBitmapFromSource failed hr=%x\n", hr); -todo_wine ok(bitmap2 == bitmap, "Unexpected bitmap instance.\n"); IWICBitmap_Release(bitmap2); -- 2.19.1