Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/scaler.c | 2 +- dlls/windowscodecs/tests/bitmap.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c index 3789831a97..eedc1bbac4 100644 --- a/dlls/windowscodecs/scaler.c +++ b/dlls/windowscodecs/scaler.c @@ -163,7 +163,7 @@ static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface, return E_INVALIDARG;
if (!This->source) - return WINCODEC_ERR_WRONGSTATE; + return WINCODEC_ERR_PALETTEUNAVAILABLE;
return IWICBitmapSource_CopyPalette(This->source, pIPalette); } diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index 2b5c373bf9..d4b597900d 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -1084,6 +1084,7 @@ static void test_bitmap_scaler(void) { WICPixelFormatGUID pixel_format; IWICBitmapScaler *scaler; + IWICPalette *palette; double res_x, res_y; IWICBitmap *bitmap; UINT width, height; @@ -1148,6 +1149,15 @@ static void test_bitmap_scaler(void) ok(width == 123, "Unexpected width %u.\n", width); ok(height == 321, "Unexpected height %u.\n", height);
+ hr = IWICBitmapScaler_CopyPalette(scaler, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "Failed to create a palette, hr %#x.\n", hr); + hr = IWICBitmapScaler_CopyPalette(scaler, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr); + IWICPalette_Release(palette); + hr = IWICBitmapScaler_Initialize(scaler, (IWICBitmapSource *)bitmap, 4, 0, WICBitmapInterpolationModeNearestNeighbor); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); @@ -1224,6 +1234,12 @@ static void test_bitmap_scaler(void) ok(hr == S_OK, "Failed to get scaler resolution, hr %#x.\n", hr); ok(res_x == 0.0 && res_y == 0.0, "Unexpected resolution %f x %f.\n", res_x, res_y);
+ hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "Failed to create a palette, hr %#x.\n", hr); + hr = IWICBitmapScaler_CopyPalette(scaler, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr); + IWICPalette_Release(palette); + IWICBitmapScaler_Release(scaler);
IWICBitmap_Release(bitmap);