[PATCH 1/2] windowscodecs: Correct IWICBitmapScaler::CopyPixels() error for not initialized case.

Dmitry Timoshkov dmitry at baikal.ru
Wed May 15 21:53:00 CDT 2019


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/windowscodecs/scaler.c       | 2 +-
 dlls/windowscodecs/tests/bitmap.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c
index c6c758d320..201cf5fc7a 100644
--- a/dlls/windowscodecs/scaler.c
+++ b/dlls/windowscodecs/scaler.c
@@ -225,7 +225,7 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
 
     if (!This->source)
     {
-        hr = WINCODEC_ERR_WRONGSTATE;
+        hr = WINCODEC_ERR_NOTINITIALIZED;
         goto end;
     }
 
diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c
index 748082032d..278c8a8f8d 100644
--- a/dlls/windowscodecs/tests/bitmap.c
+++ b/dlls/windowscodecs/tests/bitmap.c
@@ -1163,6 +1163,7 @@ static void test_bitmap_scaler(void)
     double res_x, res_y;
     IWICBitmap *bitmap;
     UINT width, height;
+    BYTE buf[16];
     HRESULT hr;
 
     hr = IWICImagingFactory_CreateBitmap(factory, 4, 2, &GUID_WICPixelFormat24bppBGR, WICBitmapCacheOnLoad, &bitmap);
@@ -1240,6 +1241,9 @@ static void test_bitmap_scaler(void)
     hr = IWICBitmapScaler_GetSize(scaler, &width, &height);
     ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
 
+    hr = IWICBitmapScaler_CopyPixels(scaler, NULL, 1, sizeof(buf), buf);
+    ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
+
     hr = IWICBitmapScaler_Initialize(scaler, (IWICBitmapSource *)bitmap, 0, 2,
         WICBitmapInterpolationModeNearestNeighbor);
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
-- 
2.20.1




More information about the wine-devel mailing list