windowscodecs: Fix return values for scaler's CopyPalette().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-11-29 12:36:41 +03:00 committed by Alexandre Julliard
parent a05ce6ac6f
commit 8d75d949a6
2 changed files with 17 additions and 1 deletions

View File

@ -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);
}

View File

@ -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);