Commit 93afd254 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wincodecs: Use static array for property bag descriptions.

parent 0eeaac7a
......@@ -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);
......
......@@ -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))
{
......
......@@ -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;
......
......@@ -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))
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment