Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/bmpencode.c | 11 ++++++++++- dlls/windowscodecs/tests/converter.c | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c index 047154e6cc..afd0baf12d 100644 --- a/dlls/windowscodecs/bmpencode.c +++ b/dlls/windowscodecs/bmpencode.c @@ -72,6 +72,8 @@ typedef struct BmpFrameEncode { BOOL committed; } BmpFrameEncode;
+static const WCHAR wszEnableV5Header32bppBGRA[] = {'E','n','a','b','l','e','V','5','H','e','a','d','e','r','3','2','b','p','p','B','G','R','A',0}; + static inline BmpFrameEncode *impl_from_IWICBitmapFrameEncode(IWICBitmapFrameEncode *iface) { return CONTAINING_RECORD(iface, BmpFrameEncode, IWICBitmapFrameEncode_iface); @@ -135,6 +137,9 @@ static HRESULT WINAPI BmpFrameEncode_Initialize(IWICBitmapFrameEncode *iface,
if (This->initialized) return WINCODEC_ERR_WRONGSTATE;
+ if (pIEncoderOptions) + WARN("ignoring encoder options.\n"); + This->initialized = TRUE;
return S_OK; @@ -501,6 +506,10 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface, BmpEncoder *This = impl_from_IWICBitmapEncoder(iface); BmpFrameEncode *encode; HRESULT hr; + static const PROPBAG2 opts[1] = + { + { PROPBAG2_TYPE_DATA, VT_BOOL, 0, 0, (LPOLESTR)wszEnableV5Header32bppBGRA }, + };
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
@@ -510,7 +519,7 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions) { - hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions); + hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions); if (FAILED(hr)) return hr; }
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index 80423dc54e..690e787be6 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -467,6 +467,7 @@ static const WCHAR wszLuminance[] = {'L','u','m','i','n','a','n','c','e',0}; static const WCHAR wszChrominance[] = {'C','h','r','o','m','i','n','a','n','c','e',0}; static const WCHAR wszJpegYCrCbSubsampling[] = {'J','p','e','g','Y','C','r','C','b','S','u','b','s','a','m','p','l','i','n','g',0}; static const WCHAR wszSuppressApp0[] = {'S','u','p','p','r','e','s','s','A','p','p','0',0}; +static const WCHAR wszEnableV5Header32bppBGRA[] = {'E','n','a','b','l','e','V','5','H','e','a','d','e','r','3','2','b','p','p','B','G','R','A',0};
static const struct property_opt_test_data testdata_tiff_props[] = { { wszTiffCompressionMethod, VT_UI1, VT_UI1, WICTiffCompressionDontCare }, @@ -490,6 +491,11 @@ static const struct property_opt_test_data testdata_jpeg_props[] = { { NULL } };
+static const struct property_opt_test_data testdata_bmp_props[] = { + { wszEnableV5Header32bppBGRA, VT_BOOL, VT_BOOL, VARIANT_FALSE, 0.0f, TRUE }, /* Supported since Win7 */ + { NULL } +}; + static int find_property_index(const WCHAR* name, PROPBAG2* all_props, int all_prop_cnt) { int i; @@ -616,6 +622,8 @@ static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *o test_specific_encoder_properties(options, testdata_png_props, all_props, cProperties2); else if (IsEqualCLSID(clsid_encoder, &CLSID_WICJpegEncoder)) test_specific_encoder_properties(options, testdata_jpeg_props, all_props, cProperties2); + else if (IsEqualCLSID(clsid_encoder, &CLSID_WICBmpEncoder)) + test_specific_encoder_properties(options, testdata_bmp_props, all_props, cProperties2);
for (i=0; i < cProperties2; i++) {