Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
No changes in 1/2.
dlls/windowscodecs/jpegformat.c | 31 ++++++++++---------------------
dlls/windowscodecs/pngformat.c | 13 +++++--------
dlls/windowscodecs/propertybag.c | 4 ++--
dlls/windowscodecs/tiffformat.c | 20 +++++++-------------
dlls/windowscodecs/wincodecs_private.h | 2 +-
5 files changed, 25 insertions(+), 45 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index ef050ba688..6617ec7b8e 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1440,7 +1440,15 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
{
JpegEncoder *This = impl_from_IWICBitmapEncoder(iface);
HRESULT hr;
- PROPBAG2 opts[6] = {{0}};
+ static const PROPBAG2 opts[6] =
+ {
+ { PROPBAG2_TYPE_DATA, VT_R4, 0, 0, (LPOLESTR)wszImageQuality },
+ { PROPBAG2_TYPE_DATA, VT_UI1, 0, 0, (LPOLESTR)wszBitmapTransform },
+ { PROPBAG2_TYPE_DATA, VT_I4 | VT_ARRAY, 0, 0, (LPOLESTR)wszLuminance },
+ { PROPBAG2_TYPE_DATA, VT_I4 | VT_ARRAY, 0, 0, (LPOLESTR)wszChrominance },
+ { PROPBAG2_TYPE_DATA, VT_UI1, 0, 0, (LPOLESTR)wszJpegYCrCbSubsampling },
+ { PROPBAG2_TYPE_DATA, VT_BOOL, 0, 0, (LPOLESTR)wszSuppressApp0 },
+ };
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
@@ -1458,26 +1466,7 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return WINCODEC_ERR_NOTINITIALIZED;
}
- opts[0].pstrName = (LPOLESTR)wszImageQuality;
- opts[0].vt = VT_R4;
- opts[0].dwType = PROPBAG2_TYPE_DATA;
- opts[1].pstrName = (LPOLESTR)wszBitmapTransform;
- opts[1].vt = VT_UI1;
- opts[1].dwType = PROPBAG2_TYPE_DATA;
- opts[2].pstrName = (LPOLESTR)wszLuminance;
- opts[2].vt = VT_I4|VT_ARRAY;
- opts[2].dwType = PROPBAG2_TYPE_DATA;
- opts[3].pstrName = (LPOLESTR)wszChrominance;
- opts[3].vt = VT_I4|VT_ARRAY;
- opts[3].dwType = PROPBAG2_TYPE_DATA;
- opts[4].pstrName = (LPOLESTR)wszJpegYCrCbSubsampling;
- opts[4].vt = VT_UI1;
- opts[4].dwType = PROPBAG2_TYPE_DATA;
- opts[5].pstrName = (LPOLESTR)wszSuppressApp0;
- opts[5].vt = VT_BOOL;
- opts[5].dwType = PROPBAG2_TYPE_DATA;
-
- hr = CreatePropertyBag2(opts, 6, ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index 1ab2c8573b..117761c335 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -2033,7 +2033,11 @@ static HRESULT WINAPI PngEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
{
PngEncoder *This = impl_from_IWICBitmapEncoder(iface);
HRESULT hr;
- PROPBAG2 opts[2]= {{0}};
+ static const PROPBAG2 opts[2] =
+ {
+ { PROPBAG2_TYPE_DATA, VT_BOOL, 0, 0, (LPOLESTR)wszPngInterlaceOption },
+ { PROPBAG2_TYPE_DATA, VT_UI1, 0, 0, (LPOLESTR)wszPngFilterOption },
+ };
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
@@ -2051,13 +2055,6 @@ static HRESULT WINAPI PngEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return WINCODEC_ERR_NOTINITIALIZED;
}
- opts[0].pstrName = (LPOLESTR)wszPngInterlaceOption;
- opts[0].vt = VT_BOOL;
- opts[0].dwType = PROPBAG2_TYPE_DATA;
- opts[1].pstrName = (LPOLESTR)wszPngFilterOption;
- opts[1].vt = VT_UI1;
- opts[1].dwType = PROPBAG2_TYPE_DATA;
-
hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
if (FAILED(hr))
{
diff --git a/dlls/windowscodecs/propertybag.c b/dlls/windowscodecs/propertybag.c
index 2f3015ca6d..e9d1af9670 100644
--- a/dlls/windowscodecs/propertybag.c
+++ b/dlls/windowscodecs/propertybag.c
@@ -213,7 +213,7 @@ static HRESULT WINAPI PropertyBag_CountProperties(IPropertyBag2 *iface, ULONG *p
return S_OK;
}
-static HRESULT copy_propbag2(PROPBAG2 *dest, PROPBAG2 *src)
+static HRESULT copy_propbag2(PROPBAG2 *dest, const PROPBAG2 *src)
{
dest->cfType = src->cfType;
dest->clsid = src->clsid;
@@ -278,7 +278,7 @@ static const IPropertyBag2Vtbl PropertyBag_Vtbl = {
PropertyBag_LoadObject
};
-HRESULT CreatePropertyBag2(PROPBAG2 *options, UINT count,
+HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
IPropertyBag2 **ppPropertyBag2)
{
UINT i;
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index a0eec53f5f..f165e18934 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1936,7 +1936,11 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
{
TiffEncoder *This = impl_from_IWICBitmapEncoder(iface);
TiffFrameEncode *result;
-
+ static const PROPBAG2 opts[2] =
+ {
+ { PROPBAG2_TYPE_DATA, VT_UI1, 0, 0, (LPOLESTR)wszTiffCompressionMethod },
+ { PROPBAG2_TYPE_DATA, VT_R4, 0, 0, (LPOLESTR)wszCompressionQuality },
+ };
HRESULT hr=S_OK;
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
@@ -1955,24 +1959,14 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (SUCCEEDED(hr))
{
- PROPBAG2 opts[2]= {{0}};
- opts[0].pstrName = (LPOLESTR)wszTiffCompressionMethod;
- opts[0].vt = VT_UI1;
- opts[0].dwType = PROPBAG2_TYPE_DATA;
-
- opts[1].pstrName = (LPOLESTR)wszCompressionQuality;
- opts[1].vt = VT_R4;
- opts[1].dwType = PROPBAG2_TYPE_DATA;
-
- hr = CreatePropertyBag2(opts, 2, ppIEncoderOptions);
-
+ hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
if (SUCCEEDED(hr))
{
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_UI1;
V_UNION(&v, bVal) = WICTiffCompressionDontCare;
- hr = IPropertyBag2_Write(*ppIEncoderOptions, 1, opts, &v);
+ hr = IPropertyBag2_Write(*ppIEncoderOptions, 1, (PROPBAG2 *)opts, &v);
VariantClear(&v);
if (FAILED(hr))
{
diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h
index 2249c13843..8bba811250 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -120,7 +120,7 @@ extern void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT heigh
extern HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp) DECLSPEC_HIDDEN;
-extern HRESULT CreatePropertyBag2(PROPBAG2 *options, UINT count,
+extern HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
IPropertyBag2 **property) DECLSPEC_HIDDEN;
extern HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) DECLSPEC_HIDDEN;
--
2.15.1