Author: akhaldi
Date: Sun Jun 4 01:48:14 2017
New Revision: 74862
URL:
http://svn.reactos.org/svn/reactos?rev=74862&view=rev
Log:
[PSDK] Update wincodecsdk.idl. CORE-13362
[WINDOWSCODECS] Sync with Wine Staging 2.9. CORE-13362
00d3b89 windowscodecs: Simplify a bit comparison of two PROPVARIANTs.
5ea8f41 windowscodecs: Implement IWICMetadataQueryReader::GetContainerFormat.
8890f2e windowscodecs: Implement WICMapSchemaToName.
dd7fa09 windowscodecs: Implement WICMapShortNameToGuid.
4cf250c windowscodecs: Implement WICMapGuidToShortName.
bb57e0c windowscodecs: Fix 32bppRGB to 32bppRGBA conversion.
b1037a9 windowscodecs: Add support for 32bppRGB, 32bppRGBA and 32bppPRGBA to format
converter.
4e2cdd5 windowscodecs: Tolerate partial reads in the IFD metadata loader.
213b395 windowscodecs: Add support for 16bpp RGBA format to TIFF decoder.
2133dd1 windowscodecs: Add support for 4bpp RGBA format to TIFF decoder.
41827e1 windowscodecs: Add support for 32bppCMYK and 64bppCMYK formats to TIFF decoder.
306b4d3 windowscodecs: Add support for 128bppRGBAFloat format to TIFF decoder.
74f105d windowscodecs: Add support for 12bpp RGB format to TIFF decoder.
76bbf38 windowscodecs: Add support for 3bps RGB format to TIFF decoder.
2103e19 windowscodecs: Add support for 16bppGray and 32bppGrayFloat formats to TIFF
decoder.
150fc32 windowscodecs: Avoid redundant checks when reading a TIFF tile.
266e4ec windowscodecs: Fail earlier in TIFF decoder's Initialize method for
unsupported pixel formats.
b7306a4 windowscodecs: Fix the SupportsTransparency flag value for various pixel formats.
35483da include: Fix typos in WICPersistOptions enumeration names.
2d5c861 windowscodecs: Fixed loading png from streams.
fdccccb windowscodecs: Fix IWICImagingFactory_CreateDecoderFromFileHandle_Proxy spec file
entry.
376b075 windowscodecs: Remove dead assignment (clang).
b0d04e6 wincodecs: Simplify property name allocation.
5107ef7 wincodecs: Implement FilterOption property for PNG encoder.
6283014 wincodecs: Trigger conversion to target format in WriteSource().
Modified:
trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt
trunk/reactos/dll/win32/windowscodecs/converter.c
trunk/reactos/dll/win32/windowscodecs/gifformat.c
trunk/reactos/dll/win32/windowscodecs/imgfactory.c
trunk/reactos/dll/win32/windowscodecs/info.c
trunk/reactos/dll/win32/windowscodecs/main.c
trunk/reactos/dll/win32/windowscodecs/metadatahandler.c
trunk/reactos/dll/win32/windowscodecs/metadataquery.c
trunk/reactos/dll/win32/windowscodecs/pngformat.c
trunk/reactos/dll/win32/windowscodecs/propertybag.c
trunk/reactos/dll/win32/windowscodecs/regsvr.c
trunk/reactos/dll/win32/windowscodecs/tiffformat.c
trunk/reactos/dll/win32/windowscodecs/typeof.h
trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec
trunk/reactos/media/doc/README.WINE
trunk/reactos/sdk/include/psdk/wincodecsdk.idl
Modified: trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/CM…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -76,6 +76,6 @@
set_module_type(windowscodecs win32dll)
target_link_libraries(windowscodecs wine uuid ${PSEH_LIB})
-add_importlibs(windowscodecs ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32
advapi32_vista msvcrt kernel32 ntdll)
+add_importlibs(windowscodecs ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32
advapi32_vista propsys msvcrt kernel32 ntdll)
add_pch(windowscodecs wincodecs_private.h SOURCE)
add_cd_file(TARGET windowscodecs DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/windowscodecs/converter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/co…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/converter.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/converter.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -40,8 +40,11 @@
format_24bppRGB,
format_32bppGrayFloat,
format_32bppBGR,
+ format_32bppRGB,
format_32bppBGRA,
+ format_32bppRGBA,
format_32bppPBGRA,
+ format_32bppPRGBA,
format_48bppRGB,
format_64bppRGBA,
format_32bppCMYK,
@@ -845,6 +848,27 @@
}
}
+static HRESULT copypixels_to_32bppRGBA(struct FormatConverter *This, const WICRect *prc,
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
+{
+ HRESULT hr;
+
+ switch (source_format)
+ {
+ case format_32bppRGB:
+ case format_32bppRGBA:
+ case format_32bppPRGBA:
+ if (prc)
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride,
cbBufferSize, pbBuffer);
+ return S_OK;
+ default:
+ hr = copypixels_to_32bppBGRA(This, prc, cbStride, cbBufferSize, pbBuffer,
source_format);
+ if (SUCCEEDED(hr) && prc)
+ reverse_bgr8(4, pbBuffer, prc->Width, prc->Height, cbStride);
+ return hr;
+ }
+}
+
static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRect *prc,
UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
{
@@ -861,6 +885,22 @@
}
}
+static HRESULT copypixels_to_32bppRGB(struct FormatConverter *This, const WICRect *prc,
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
+{
+ switch (source_format)
+ {
+ case format_32bppRGB:
+ case format_32bppRGBA:
+ case format_32bppPRGBA:
+ if (prc)
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride,
cbBufferSize, pbBuffer);
+ return S_OK;
+ default:
+ return copypixels_to_32bppRGBA(This, prc, cbStride, cbBufferSize, pbBuffer,
source_format);
+ }
+}
+
static HRESULT copypixels_to_32bppPBGRA(struct FormatConverter *This, const WICRect
*prc,
UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
{
@@ -874,6 +914,39 @@
return S_OK;
default:
hr = copypixels_to_32bppBGRA(This, prc, cbStride, cbBufferSize, pbBuffer,
source_format);
+ if (SUCCEEDED(hr) && prc)
+ {
+ INT x, y;
+
+ for (y=0; y<prc->Height; y++)
+ for (x=0; x<prc->Width; x++)
+ {
+ BYTE alpha = pbBuffer[cbStride*y+4*x+3];
+ if (alpha != 255)
+ {
+ pbBuffer[cbStride*y+4*x] = pbBuffer[cbStride*y+4*x] * alpha /
255;
+ pbBuffer[cbStride*y+4*x+1] = pbBuffer[cbStride*y+4*x+1] * alpha /
255;
+ pbBuffer[cbStride*y+4*x+2] = pbBuffer[cbStride*y+4*x+2] * alpha /
255;
+ }
+ }
+ }
+ return hr;
+ }
+}
+
+static HRESULT copypixels_to_32bppPRGBA(struct FormatConverter *This, const WICRect
*prc,
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
+{
+ HRESULT hr;
+
+ switch (source_format)
+ {
+ case format_32bppPRGBA:
+ if (prc)
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride,
cbBufferSize, pbBuffer);
+ return S_OK;
+ default:
+ hr = copypixels_to_32bppRGBA(This, prc, cbStride, cbBufferSize, pbBuffer,
source_format);
if (SUCCEEDED(hr) && prc)
{
INT x, y;
@@ -1275,8 +1348,11 @@
{format_24bppRGB, &GUID_WICPixelFormat24bppRGB, copypixels_to_24bppRGB},
{format_32bppGrayFloat, &GUID_WICPixelFormat32bppGrayFloat,
copypixels_to_32bppGrayFloat},
{format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR},
+ {format_32bppRGB, &GUID_WICPixelFormat32bppRGB, copypixels_to_32bppRGB},
{format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA},
+ {format_32bppRGBA, &GUID_WICPixelFormat32bppRGBA, copypixels_to_32bppRGBA},
{format_32bppPBGRA, &GUID_WICPixelFormat32bppPBGRA, copypixels_to_32bppPBGRA},
+ {format_32bppPRGBA, &GUID_WICPixelFormat32bppPRGBA, copypixels_to_32bppPRGBA},
{format_48bppRGB, &GUID_WICPixelFormat48bppRGB, NULL},
{format_64bppRGBA, &GUID_WICPixelFormat64bppRGBA, NULL},
{format_32bppCMYK, &GUID_WICPixelFormat32bppCMYK, NULL},
Modified: trunk/reactos/dll/win32/windowscodecs/gifformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/gi…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/gifformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/gifformat.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -553,7 +553,7 @@
}
stream = create_stream(data, data_size);
- IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionsDefault);
+ IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionDefault);
IStream_Release(stream);
IWICPersistStream_Release(persist);
@@ -923,7 +923,7 @@
}
stream = create_stream(&IMD_data, sizeof(IMD_data));
- IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionsDefault);
+ IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionDefault);
IStream_Release(stream);
IWICPersistStream_Release(persist);
Modified: trunk/reactos/dll/win32/windowscodecs/imgfactory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/im…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/imgfactory.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/imgfactory.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -1028,7 +1028,7 @@
if (SUCCEEDED(hr))
{
hr = IWICPersistStream_LoadEx(wicpersiststream,
- stream, vendor, options & WICPersistOptionsMask);
+ stream, vendor, options & WICPersistOptionMask);
IWICPersistStream_Release(wicpersiststream);
}
@@ -1072,7 +1072,7 @@
if (SUCCEEDED(hr))
{
- hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options
& WICPersistOptionsMask);
+ hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options
& WICPersistOptionMask);
IWICPersistStream_Release(wicpersiststream);
}
Modified: trunk/reactos/dll/win32/windowscodecs/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/in…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/info.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/info.c [iso-8859-1] Sun Jun 4 01:48:14 2017
@@ -2269,6 +2269,12 @@
return hr;
}
+static BOOL is_1bpp_format(const WICPixelFormatGUID *format)
+{
+ return IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite) ||
+ IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed);
+}
+
HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource
*pISrc, IWICBitmapSource **ppIDst)
{
HRESULT res;
@@ -2281,10 +2287,12 @@
BOOL canconvert;
ULONG num_fetched;
+ TRACE("%s,%p,%p\n", debugstr_guid(dstFormat), pISrc, ppIDst);
+
res = IWICBitmapSource_GetPixelFormat(pISrc, &srcFormat);
if (FAILED(res)) return res;
- if (IsEqualGUID(&srcFormat, dstFormat))
+ if (IsEqualGUID(&srcFormat, dstFormat) || (is_1bpp_format(&srcFormat)
&& is_1bpp_format(dstFormat)))
{
IWICBitmapSource_AddRef(pISrc);
*ppIDst = pISrc;
@@ -2330,7 +2338,6 @@
IWICFormatConverter_Release(converter);
converter = NULL;
}
- res = S_OK;
}
}
Modified: trunk/reactos/dll/win32/windowscodecs/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ma…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/main.c [iso-8859-1] Sun Jun 4 01:48:14 2017
@@ -103,41 +103,25 @@
}
}
-static BOOL is_1bpp_format(const WICPixelFormatGUID *format)
-{
- return IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite) ||
- IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed);
-}
-
HRESULT configure_write_source(IWICBitmapFrameEncode *iface,
IWICBitmapSource *source, const WICRect *prc,
const WICPixelFormatGUID *format,
INT width, INT height, double xres, double yres)
{
- HRESULT hr=S_OK;
- WICPixelFormatGUID src_format, dst_format;
+ HRESULT hr = S_OK;
if (width == 0 || height == 0)
return WINCODEC_ERR_WRONGSTATE;
- hr = IWICBitmapSource_GetPixelFormat(source, &src_format);
- if (FAILED(hr)) return hr;
-
if (!format)
{
- dst_format = src_format;
-
- hr = IWICBitmapFrameEncode_SetPixelFormat(iface, &dst_format);
- if (FAILED(hr)) return hr;
-
- format = &dst_format;
- }
-
- if (!IsEqualGUID(&src_format, format) &&
!(is_1bpp_format(&src_format) && is_1bpp_format(format)))
- {
- /* FIXME: should use WICConvertBitmapSource to convert */
- FIXME("format %s unsupported\n", debugstr_guid(&src_format));
- return E_NOTIMPL;
+ WICPixelFormatGUID src_format;
+
+ hr = IWICBitmapSource_GetPixelFormat(source, &src_format);
+ if (FAILED(hr)) return hr;
+
+ hr = IWICBitmapFrameEncode_SetPixelFormat(iface, &src_format);
+ if (FAILED(hr)) return hr;
}
if (xres == 0.0 || yres == 0.0)
@@ -156,6 +140,7 @@
const WICPixelFormatGUID *format, UINT bpp,
INT width, INT height)
{
+ IWICBitmapSource *converted_source;
HRESULT hr=S_OK;
WICRect rc;
UINT stride;
@@ -176,12 +161,23 @@
if (prc->Width != width || prc->Height <= 0)
return E_INVALIDARG;
+ hr = WICConvertBitmapSource(format, source, &converted_source);
+ if (FAILED(hr))
+ {
+ ERR("Failed to convert source, target format %s, %#x\n",
debugstr_guid(format), hr);
+ return hr;
+ }
+
stride = (bpp * width + 7)/8;
pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
- if (!pixeldata) return E_OUTOFMEMORY;
-
- hr = IWICBitmapSource_CopyPixels(source, prc, stride,
+ if (!pixeldata)
+ {
+ IWICBitmapSource_Release(converted_source);
+ return E_OUTOFMEMORY;
+ }
+
+ hr = IWICBitmapSource_CopyPixels(converted_source, prc, stride,
stride*prc->Height, pixeldata);
if (SUCCEEDED(hr))
@@ -191,6 +187,7 @@
}
HeapFree(GetProcessHeap(), 0, pixeldata);
+ IWICBitmapSource_Release(converted_source);
return hr;
}
Modified: trunk/reactos/dll/win32/windowscodecs/metadatahandler.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/me…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/metadatahandler.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/metadatahandler.c [iso-8859-1] Sun Jun 4
01:48:14 2017
@@ -20,7 +20,8 @@
#include "wincodecs_private.h"
#include <stdio.h>
-#include <winternl.h>
+#include <wine/winternl.h>
+#include <propvarutil.h>
typedef struct MetadataHandler {
IWICMetadataWriter IWICMetadataWriter_iface;
@@ -197,43 +198,6 @@
return hr;
}
-static BOOL get_int_value(const PROPVARIANT *pv, LONGLONG *value)
-{
- switch (pv->vt)
- {
- case VT_NULL:
- case VT_EMPTY:
- *value = 0;
- break;
- case VT_I1:
- *value = pv->u.cVal;
- break;
- case VT_UI1:
- *value = pv->u.bVal;
- break;
- case VT_I2:
- *value = pv->u.iVal;
- break;
- case VT_UI2:
- *value = pv->u.uiVal;
- break;
- case VT_I4:
- *value = pv->u.lVal;
- break;
- case VT_UI4:
- *value = pv->u.ulVal;
- break;
- case VT_I8:
- case VT_UI8:
- *value = pv->u.hVal.QuadPart;
- break;
- default:
- FIXME("not supported variant type %d\n", pv->vt);
- return FALSE;
- }
- return TRUE;
-}
-
/* FiXME: Use propsys.PropVariantCompareEx once it's implemented */
static int propvar_cmp(const PROPVARIANT *v1, const PROPVARIANT *v2)
{
@@ -249,8 +213,8 @@
return lstrcmpiW(v1->u.pwszVal, v2->u.pwszVal);
}
- if (!get_int_value(v1, &value1)) return -1;
- if (!get_int_value(v2, &value2)) return -1;
+ if (PropVariantToInt64(v1, &value1) != S_OK) return -1;
+ if (PropVariantToInt64(v2, &value2) != S_OK) return -1;
value1 -= value2;
if (value1) return value1 < 0 ? -1 : 1;
@@ -376,7 +340,7 @@
{
MetadataHandler *This = impl_from_IWICPersistStream(iface);
TRACE("(%p,%p)\n", iface, pStm);
- return IWICPersistStream_LoadEx(&This->IWICPersistStream_iface, pStm, NULL,
WICPersistOptionsDefault);
+ return IWICPersistStream_LoadEx(&This->IWICPersistStream_iface, pStm, NULL,
WICPersistOptionDefault);
}
static HRESULT WINAPI MetadataHandler_Save(IWICPersistStream *iface,
@@ -763,7 +727,7 @@
static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
MetadataItem *item, BOOL native_byte_order)
{
- ULONG count, value, i, bytesread;
+ ULONG count, value, i;
SHORT type;
LARGE_INTEGER pos;
HRESULT hr;
@@ -805,7 +769,7 @@
item->value.vt |= VT_VECTOR;
item->value.u.caub.cElems = count;
- item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), 0, count);
+ item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
count);
if (!item->value.u.caub.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
@@ -815,9 +779,8 @@
HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.caub.pElems, count, &bytesread);
- if (bytesread != count) hr = E_FAIL;
- if (hr != S_OK)
+ hr = IStream_Read(input, item->value.u.caub.pElems, count, NULL);
+ if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems);
return hr;
@@ -850,7 +813,7 @@
item->value.vt |= VT_VECTOR;
item->value.u.caui.cElems = count;
- item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), 0, count * 2);
+ item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
count * 2);
if (!item->value.u.caui.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
@@ -860,9 +823,8 @@
HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.caui.pElems, count * 2,
&bytesread);
- if (bytesread != count * 2) hr = E_FAIL;
- if (hr != S_OK)
+ hr = IStream_Read(input, item->value.u.caui.pElems, count * 2, NULL);
+ if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems);
return hr;
@@ -883,7 +845,7 @@
item->value.vt |= VT_VECTOR;
item->value.u.caul.cElems = count;
- item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), 0, count * 4);
+ item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
count * 4);
if (!item->value.u.caul.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
@@ -893,9 +855,8 @@
HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.caul.pElems, count * 4,
&bytesread);
- if (bytesread != count * 4) hr = E_FAIL;
- if (hr != S_OK)
+ hr = IStream_Read(input, item->value.u.caul.pElems, count * 4, NULL);
+ if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems);
return hr;
@@ -921,8 +882,7 @@
hr = IStream_Seek(input, pos, SEEK_SET, NULL);
if (FAILED(hr)) return hr;
- hr = IStream_Read(input, &ull, sizeof(ull), &bytesread);
- if (bytesread != sizeof(ull)) hr = E_FAIL;
+ hr = IStream_Read(input, &ull, sizeof(ull), NULL);
if (hr != S_OK) return hr;
item->value.u.uhVal.QuadPart = ull;
@@ -940,7 +900,7 @@
{
item->value.vt |= VT_VECTOR;
item->value.u.cauh.cElems = count;
- item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), 0, count * 8);
+ item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
count * 8);
if (!item->value.u.cauh.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
@@ -950,9 +910,8 @@
HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8,
&bytesread);
- if (bytesread != count * 8) hr = E_FAIL;
- if (hr != S_OK)
+ hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8, NULL);
+ if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems);
return hr;
@@ -970,7 +929,7 @@
}
break;
case IFD_ASCII:
- item->value.u.pszVal = HeapAlloc(GetProcessHeap(), 0, count + 1);
+ item->value.u.pszVal = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count +
1);
if (!item->value.u.pszVal) return E_OUTOFMEMORY;
if (count <= 4)
@@ -988,9 +947,8 @@
HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
return hr;
}
- hr = IStream_Read(input, item->value.u.pszVal, count, &bytesread);
- if (bytesread != count) hr = E_FAIL;
- if (hr != S_OK)
+ hr = IStream_Read(input, item->value.u.pszVal, count, NULL);
+ if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
return hr;
@@ -1005,7 +963,7 @@
break;
}
- item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), 0, count);
+ item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
count);
if (!item->value.u.blob.pBlobData) return E_OUTOFMEMORY;
item->value.u.blob.cbSize = count;
@@ -1024,9 +982,8 @@
HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
return hr;
}
- hr = IStream_Read(input, item->value.u.blob.pBlobData, count,
&bytesread);
- if (bytesread != count) hr = E_FAIL;
- if (hr != S_OK)
+ hr = IStream_Read(input, item->value.u.blob.pBlobData, count, NULL);
+ if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
return hr;
@@ -1052,9 +1009,9 @@
TRACE("\n");
#ifdef WORDS_BIGENDIAN
- if (persist_options & WICPersistOptionsLittleEndian)
+ if (persist_options & WICPersistOptionLittleEndian)
#else
- if (persist_options & WICPersistOptionsBigEndian)
+ if (persist_options & WICPersistOptionBigEndian)
#endif
native_byte_order = FALSE;
Modified: trunk/reactos/dll/win32/windowscodecs/metadataquery.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/me…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/metadataquery.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/metadataquery.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -1,5 +1,6 @@
/*
* Copyright 2016 Andrew Eikum for CodeWeavers
+ * Copyright 2017 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -74,12 +75,13 @@
return ref;
}
-static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface,
- GUID *pguidContainerFormat)
-{
- QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
- FIXME("(%p,%p)\n", This, pguidContainerFormat);
- return E_NOTIMPL;
+static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, GUID
*format)
+{
+ QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+
+ TRACE("(%p,%p)\n", This, format);
+
+ return IWICMetadataBlockReader_GetContainerFormat(This->block, format);
}
static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface,
@@ -134,3 +136,278 @@
return S_OK;
}
+
+static const WCHAR bmpW[] = { 'b','m','p',0 };
+static const WCHAR pngW[] = { 'p','n','g',0 };
+static const WCHAR icoW[] = { 'i','c','o',0 };
+static const WCHAR jpgW[] = { 'j','p','g',0 };
+static const WCHAR tiffW[] = { 't','i','f','f',0 };
+static const WCHAR gifW[] = { 'g','i','f',0 };
+static const WCHAR wmphotoW[] = {
'w','m','p','h','o','t','o',0 };
+static const WCHAR unknownW[] = {
'u','n','k','n','o','w','n',0 };
+static const WCHAR ifdW[] = { 'i','f','d',0 };
+static const WCHAR subW[] = { 's','u','b',0 };
+static const WCHAR exifW[] = { 'e','x','i','f',0 };
+static const WCHAR gpsW[] = { 'g','p','s',0 };
+static const WCHAR interopW[] = {
'i','n','t','e','r','o','p',0 };
+static const WCHAR app0W[] = { 'a','p','p','0',0 };
+static const WCHAR app1W[] = { 'a','p','p','1',0 };
+static const WCHAR app13W[] = {
'a','p','p','1','3',0 };
+static const WCHAR iptcW[] = { 'i','p','t','c',0 };
+static const WCHAR irbW[] = { 'i','r','b',0 };
+static const WCHAR _8bimiptcW[] = {
'8','b','i','m','i','p','t','c',0
};
+static const WCHAR _8bimResInfoW[] = {
'8','b','i','m','R','e','s','I','n','f','o',0
};
+static const WCHAR _8bimiptcdigestW[] = {
'8','b','i','m','i','p','t','c','d','i','g','e','s','t',0
};
+static const WCHAR xmpW[] = { 'x','m','p',0 };
+static const WCHAR thumbW[] = {
't','h','u','m','b',0 };
+static const WCHAR tEXtW[] = { 't','E','X','t',0 };
+static const WCHAR xmpstructW[] = {
'x','m','p','s','t','r','u','c','t',0
};
+static const WCHAR xmpbagW[] = {
'x','m','p','b','a','g',0 };
+static const WCHAR xmpseqW[] = {
'x','m','p','s','e','q',0 };
+static const WCHAR xmpaltW[] = {
'x','m','p','a','l','t',0 };
+static const WCHAR logscrdescW[] = {
'l','o','g','s','c','r','d','e','s','c',0
};
+static const WCHAR imgdescW[] = {
'i','m','g','d','e','s','c',0 };
+static const WCHAR grctlextW[] = {
'g','r','c','t','l','e','x','t',0
};
+static const WCHAR appextW[] = {
'a','p','p','e','x','t',0 };
+static const WCHAR chrominanceW[] = {
'c','h','r','o','m','i','n','a','n','c','e',0
};
+static const WCHAR luminanceW[] = {
'l','u','m','i','n','a','n','c','e',0
};
+static const WCHAR comW[] = { 'c','o','m',0 };
+static const WCHAR commentextW[] = {
'c','o','m','m','e','n','t','e','x','t',0
};
+static const WCHAR gAMAW[] = { 'g','A','M','A',0 };
+static const WCHAR bKGDW[] = { 'b','K','G','D',0 };
+static const WCHAR iTXtW[] = { 'i','T','X','t',0 };
+static const WCHAR cHRMW[] = { 'c','H','R','M',0 };
+static const WCHAR hISTW[] = { 'h','I','S','T',0 };
+static const WCHAR iCCPW[] = { 'i','C','C','P',0 };
+static const WCHAR sRGBW[] = { 's','R','G','B',0 };
+static const WCHAR tIMEW[] = { 't','I','M','E',0 };
+
+static const struct
+{
+ const GUID *guid;
+ const WCHAR *name;
+} guid2name[] =
+{
+ { &GUID_ContainerFormatBmp, bmpW },
+ { &GUID_ContainerFormatPng, pngW },
+ { &GUID_ContainerFormatIco, icoW },
+ { &GUID_ContainerFormatJpeg, jpgW },
+ { &GUID_ContainerFormatTiff, tiffW },
+ { &GUID_ContainerFormatGif, gifW },
+ { &GUID_ContainerFormatWmp, wmphotoW },
+ { &GUID_MetadataFormatUnknown, unknownW },
+ { &GUID_MetadataFormatIfd, ifdW },
+ { &GUID_MetadataFormatSubIfd, subW },
+ { &GUID_MetadataFormatExif, exifW },
+ { &GUID_MetadataFormatGps, gpsW },
+ { &GUID_MetadataFormatInterop, interopW },
+ { &GUID_MetadataFormatApp0, app0W },
+ { &GUID_MetadataFormatApp1, app1W },
+ { &GUID_MetadataFormatApp13, app13W },
+ { &GUID_MetadataFormatIPTC, iptcW },
+ { &GUID_MetadataFormatIRB, irbW },
+ { &GUID_MetadataFormat8BIMIPTC, _8bimiptcW },
+ { &GUID_MetadataFormat8BIMResolutionInfo, _8bimResInfoW },
+ { &GUID_MetadataFormat8BIMIPTCDigest, _8bimiptcdigestW },
+ { &GUID_MetadataFormatXMP, xmpW },
+ { &GUID_MetadataFormatThumbnail, thumbW },
+ { &GUID_MetadataFormatChunktEXt, tEXtW },
+ { &GUID_MetadataFormatXMPStruct, xmpstructW },
+ { &GUID_MetadataFormatXMPBag, xmpbagW },
+ { &GUID_MetadataFormatXMPSeq, xmpseqW },
+ { &GUID_MetadataFormatXMPAlt, xmpaltW },
+ { &GUID_MetadataFormatLSD, logscrdescW },
+ { &GUID_MetadataFormatIMD, imgdescW },
+ { &GUID_MetadataFormatGCE, grctlextW },
+ { &GUID_MetadataFormatAPE, appextW },
+ { &GUID_MetadataFormatJpegChrominance, chrominanceW },
+ { &GUID_MetadataFormatJpegLuminance, luminanceW },
+ { &GUID_MetadataFormatJpegComment, comW },
+ { &GUID_MetadataFormatGifComment, commentextW },
+ { &GUID_MetadataFormatChunkgAMA, gAMAW },
+ { &GUID_MetadataFormatChunkbKGD, bKGDW },
+ { &GUID_MetadataFormatChunkiTXt, iTXtW },
+ { &GUID_MetadataFormatChunkcHRM, cHRMW },
+ { &GUID_MetadataFormatChunkhIST, hISTW },
+ { &GUID_MetadataFormatChunkiCCP, iCCPW },
+ { &GUID_MetadataFormatChunksRGB, sRGBW },
+ { &GUID_MetadataFormatChunktIME, tIMEW }
+};
+
+HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT *ret_len)
+{
+ UINT i;
+
+ TRACE("%s,%u,%p,%p\n", wine_dbgstr_guid(guid), len, name, ret_len);
+
+ if (!guid) return E_INVALIDARG;
+
+ for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ {
+ if (IsEqualGUID(guid, guid2name[i].guid))
+ {
+ if (name)
+ {
+ if (!len) return E_INVALIDARG;
+
+ len = min(len - 1, strlenW(guid2name[i].name));
+ memcpy(name, guid2name[i].name, len * sizeof(WCHAR));
+ name[len] = 0;
+
+ if (len < strlenW(guid2name[i].name))
+ return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
+ }
+ if (ret_len) *ret_len = strlenW(guid2name[i].name) + 1;
+ return S_OK;
+ }
+ }
+
+ return WINCODEC_ERR_PROPERTYNOTFOUND;
+}
+
+HRESULT WINAPI WICMapShortNameToGuid(const WCHAR *name, GUID *guid)
+{
+ UINT i;
+
+ TRACE("%s,%p\n", debugstr_w(name), guid);
+
+ if (!name || !guid) return E_INVALIDARG;
+
+ for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ {
+ if (!strcmpiW(name, guid2name[i].name))
+ {
+ *guid = *guid2name[i].guid;
+ return S_OK;
+ }
+ }
+
+ return WINCODEC_ERR_PROPERTYNOTFOUND;
+}
+
+static const WCHAR rdf[] = { 'r','d','f',0 };
+static const WCHAR rdf_scheme[] = {
'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/','1','9','9','9','/','0','2','/','2','2','-','r','d','f','-','s','y','n','t','a','x','-','n','s','#',0
};
+static const WCHAR dc[] = { 'd','c',0 };
+static const WCHAR dc_scheme[] = {
'h','t','t','p',':','/','/','p','u','r','l','.','o','r','g','/','d','c','/','e','l','e','m','e','n','t','s','/','1','.','1','/',0
};
+static const WCHAR xmp[] = { 'x','m','p',0 };
+static const WCHAR xmp_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/',0
};
+static const WCHAR xmpidq[] = {
'x','m','p','i','d','q',0 };
+static const WCHAR xmpidq_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','I','d','e','n','t','i','f','i','e','r','/','q','u','a','l','/','1','.','0','/',0
};
+static const WCHAR xmpRights[] = {
'x','m','p','R','i','g','h','t','s',0
};
+static const WCHAR xmpRights_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','r','i','g','h','t','s','/',0
};
+static const WCHAR xmpMM[] = {
'x','m','p','M','M',0 };
+static const WCHAR xmpMM_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','m','m','/',0
};
+static const WCHAR xmpBJ[] = {
'x','m','p','B','J',0 };
+static const WCHAR xmpBJ_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','b','j','/',0
};
+static const WCHAR xmpTPg[] = {
'x','m','p','T','P','g',0 };
+static const WCHAR xmpTPg_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','t','/','p','g','/',0
};
+static const WCHAR pdf[] = { 'p','d','f',0 };
+static const WCHAR pdf_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','d','f','/','1','.','3','/',0
};
+static const WCHAR photoshop[] = {
'p','h','o','t','o','s','h','o','p',0
};
+static const WCHAR photoshop_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','h','o','t','o','s','h','o','p','/','1','.','0','/',0
};
+static const WCHAR tiff[] = { 't','i','f','f',0 };
+static const WCHAR tiff_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','t','i','f','f','/','1','.','0','/',0
};
+static const WCHAR exif[] = { 'e','x','i','f',0 };
+static const WCHAR exif_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/',0
};
+static const WCHAR stDim[] = {
's','t','D','i','m',0 };
+static const WCHAR stDim_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','D','i','m','e','n','s','i','o','n','s','#',0
};
+static const WCHAR xapGImg[] = {
'x','a','p','G','I','m','g',0 };
+static const WCHAR xapGImg_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','g','/','i','m','g','/',0
};
+static const WCHAR stEvt[] = {
's','t','E','v','t',0 };
+static const WCHAR stEvt_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','E','v','e','n','t','#',0
};
+static const WCHAR stRef[] = {
's','t','R','e','f',0 };
+static const WCHAR stRef_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','R','e','f','#',0
};
+static const WCHAR stVer[] = {
's','t','V','e','r',0 };
+static const WCHAR stVer_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','V','e','r','s','i','o','n','#',0
};
+static const WCHAR stJob[] = {
's','t','J','o','b',0 };
+static const WCHAR stJob_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','J','o','b','#',0
};
+static const WCHAR aux[] = { 'a','u','x',0 };
+static const WCHAR aux_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/','a','u','x','/',0
};
+static const WCHAR crs[] = { 'c','r','s',0 };
+static const WCHAR crs_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','c','a','m','e','r','a','-','r','a','w','-','s','e','t','t','i','n','g','s','/','1','.','0','/',0
};
+static const WCHAR xmpDM[] = {
'x','m','p','D','M',0 };
+static const WCHAR xmpDM_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','1','.','0','/','D','y','n','a','m','i','c','M','e','d','i','a','/',0
};
+static const WCHAR Iptc4xmpCore[] = {
'I','p','t','c','4','x','m','p','C','o','r','e',0
};
+static const WCHAR Iptc4xmpCore_scheme[] = {
'h','t','t','p',':','/','/','i','p','t','c','.','o','r','g','/','s','t','d','/','I','p','t','c','4','x','m','p','C','o','r','e','/','1','.','0','/','x','m','l','n','s','/',0
};
+static const WCHAR MicrosoftPhoto[] = {
'M','i','c','r','o','s','o','f','t','P','h','o','t','o',0
};
+static const WCHAR MicrosoftPhoto_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','0','/',0
};
+static const WCHAR MP[] = { 'M','P',0 };
+static const WCHAR MP_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/',0
};
+static const WCHAR MPRI[] = { 'M','P','R','I',0 };
+static const WCHAR MPRI_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','I','n','f','o','#',0
};
+static const WCHAR MPReg[] = {
'M','P','R','e','g',0 };
+static const WCHAR MPReg_scheme[] = {
'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','#',0
};
+
+static const struct
+{
+ const WCHAR *name;
+ const WCHAR *schema;
+} name2schema[] =
+{
+ { rdf, rdf_scheme },
+ { dc, dc_scheme },
+ { xmp, xmp_scheme },
+ { xmpidq, xmpidq_scheme },
+ { xmpRights, xmpRights_scheme },
+ { xmpMM, xmpMM_scheme },
+ { xmpBJ, xmpBJ_scheme },
+ { xmpTPg, xmpTPg_scheme },
+ { pdf, pdf_scheme },
+ { photoshop, photoshop_scheme },
+ { tiff, tiff_scheme },
+ { exif, exif_scheme },
+ { stDim, stDim_scheme },
+ { xapGImg, xapGImg_scheme },
+ { stEvt, stEvt_scheme },
+ { stRef, stRef_scheme },
+ { stVer, stVer_scheme },
+ { stJob, stJob_scheme },
+ { aux, aux_scheme },
+ { crs, crs_scheme },
+ { xmpDM, xmpDM_scheme },
+ { Iptc4xmpCore, Iptc4xmpCore_scheme },
+ { MicrosoftPhoto, MicrosoftPhoto_scheme },
+ { MP, MP_scheme },
+ { MPRI, MPRI_scheme },
+ { MPReg, MPReg_scheme }
+};
+
+HRESULT WINAPI WICMapSchemaToName(REFGUID format, const WCHAR *schema, UINT len, WCHAR
*name, UINT *ret_len)
+{
+ UINT i;
+
+ TRACE("%s,%s,%u,%p,%p\n", wine_dbgstr_guid(format), debugstr_w(schema),
len, name, ret_len);
+
+ if (!format || !schema || !ret_len)
+ return E_INVALIDARG;
+
+ /* It appears that the only metadata formats
+ * that support schemas are xmp and xmpstruct.
+ */
+ if (!IsEqualGUID(format, &GUID_MetadataFormatXMP) &&
+ !IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
+ return WINCODEC_ERR_PROPERTYNOTFOUND;
+
+ for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ {
+ if (!strcmpW(name2schema[i].schema, schema))
+ {
+ if (name)
+ {
+ if (!len) return E_INVALIDARG;
+
+ len = min(len - 1, strlenW(name2schema[i].name));
+ memcpy(name, name2schema[i].name, len * sizeof(WCHAR));
+ name[len] = 0;
+
+ if (len < lstrlenW(name2schema[i].name))
+ return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
+ }
+
+ if (ret_len) *ret_len = strlenW(name2schema[i].name) + 1;
+ return S_OK;
+ }
+ }
+
+ return WINCODEC_ERR_PROPERTYNOTFOUND;
+}
Modified: trunk/reactos/dll/win32/windowscodecs/pngformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/pn…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -24,8 +24,6 @@
#ifdef HAVE_PNG_H
#include <png.h>
#endif
-
-static const WCHAR wszPngInterlaceOption[] =
{'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0};
static inline ULONG read_ulong_be(BYTE* data)
{
@@ -308,6 +306,7 @@
MAKE_FUNCPTR(png_set_crc_action);
MAKE_FUNCPTR(png_set_error_fn);
MAKE_FUNCPTR(png_set_filler);
+MAKE_FUNCPTR(png_set_filter);
MAKE_FUNCPTR(png_set_gray_to_rgb);
MAKE_FUNCPTR(png_set_interlace_handling);
MAKE_FUNCPTR(png_set_IHDR);
@@ -335,6 +334,9 @@
0, 0, { (DWORD_PTR)(__FILE__ ": init_png_cs") }
};
static CRITICAL_SECTION init_png_cs = { &init_png_cs_debug, -1, 0, 0, 0, 0 };
+
+static const WCHAR wszPngInterlaceOption[] =
{'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0};
+static const WCHAR wszPngFilterOption[] =
{'F','i','l','t','e','r','O','p','t','i','o','n',0};
static void *load_libpng(void)
{
@@ -370,6 +372,7 @@
LOAD_FUNCPTR(png_set_crc_action);
LOAD_FUNCPTR(png_set_error_fn);
LOAD_FUNCPTR(png_set_filler);
+ LOAD_FUNCPTR(png_set_filter);
LOAD_FUNCPTR(png_set_gray_to_rgb);
LOAD_FUNCPTR(png_set_interlace_handling);
LOAD_FUNCPTR(png_set_IHDR);
@@ -747,11 +750,12 @@
/* Find the metadata chunks in the file. */
seek.QuadPart = 8;
- hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, &chunk_start);
- if (FAILED(hr)) goto end;
do
{
+ hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, &chunk_start);
+ if (FAILED(hr)) goto end;
+
hr = read_png_chunk(pIStream, chunk_type, NULL, &chunk_size);
if (FAILED(hr)) goto end;
@@ -789,8 +793,6 @@
}
seek.QuadPart = chunk_start.QuadPart + chunk_size + 12; /* skip data and CRC */
- hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, &chunk_start);
- if (FAILED(hr)) goto end;
} while (memcmp(chunk_type, "IEND", 4));
This->stream = pIStream;
@@ -1340,6 +1342,7 @@
BOOL committed;
CRITICAL_SECTION lock;
BOOL interlace;
+ WICPngFilterOption filter;
BYTE *data;
UINT stride;
UINT passes;
@@ -1396,31 +1399,44 @@
IPropertyBag2 *pIEncoderOptions)
{
PngEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
+ WICPngFilterOption filter;
BOOL interlace;
- PROPBAG2 opts[1]= {{0}};
- VARIANT opt_values[1];
- HRESULT opt_hres[1];
+ PROPBAG2 opts[2]= {{0}};
+ VARIANT opt_values[2];
+ HRESULT opt_hres[2];
HRESULT hr;
TRACE("(%p,%p)\n", iface, pIEncoderOptions);
opts[0].pstrName = (LPOLESTR)wszPngInterlaceOption;
opts[0].vt = VT_BOOL;
+ opts[1].pstrName = (LPOLESTR)wszPngFilterOption;
+ opts[1].vt = VT_UI1;
if (pIEncoderOptions)
{
- hr = IPropertyBag2_Read(pIEncoderOptions, 1, opts, NULL, opt_values, opt_hres);
+ hr = IPropertyBag2_Read(pIEncoderOptions, sizeof(opts)/sizeof(opts[0]), opts,
NULL, opt_values, opt_hres);
if (FAILED(hr))
return hr;
+
+ if (V_VT(&opt_values[0]) == VT_EMPTY)
+ interlace = FALSE;
+ else
+ interlace = (V_BOOL(&opt_values[0]) != 0);
+
+ filter = V_UI1(&opt_values[1]);
+ if (filter > WICPngFilterAdaptive)
+ {
+ WARN("Unrecognized filter option value %u.\n", filter);
+ filter = WICPngFilterUnspecified;
+ }
}
else
- memset(opt_values, 0, sizeof(opt_values));
-
- if (V_VT(&opt_values[0]) == VT_EMPTY)
+ {
interlace = FALSE;
- else
- interlace = (V_BOOL(&opt_values[0]) != 0);
+ filter = WICPngFilterUnspecified;
+ }
EnterCriticalSection(&This->lock);
@@ -1431,6 +1447,7 @@
}
This->interlace = interlace;
+ This->filter = filter;
This->frame_initialized = TRUE;
@@ -1653,6 +1670,22 @@
if (This->interlace)
This->passes = ppng_set_interlace_handling(This->png_ptr);
+ if (This->filter != WICPngFilterUnspecified)
+ {
+ static const int png_filter_map[] =
+ {
+ /* WICPngFilterUnspecified */ PNG_NO_FILTERS,
+ /* WICPngFilterNone */ PNG_FILTER_NONE,
+ /* WICPngFilterSub */ PNG_FILTER_SUB,
+ /* WICPngFilterUp */ PNG_FILTER_UP,
+ /* WICPngFilterAverage */ PNG_FILTER_AVG,
+ /* WICPngFilterPaeth */ PNG_FILTER_PAETH,
+ /* WICPngFilterAdaptive */ PNG_ALL_FILTERS,
+ };
+
+ ppng_set_filter(This->png_ptr, 0, png_filter_map[This->filter]);
+ }
+
This->info_written = TRUE;
}
@@ -1983,7 +2016,7 @@
{
PngEncoder *This = impl_from_IWICBitmapEncoder(iface);
HRESULT hr;
- PROPBAG2 opts[1]= {{0}};
+ PROPBAG2 opts[2]= {{0}};
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
@@ -2004,8 +2037,11 @@
opts[0].pstrName = (LPOLESTR)wszPngInterlaceOption;
opts[0].vt = VT_BOOL;
opts[0].dwType = PROPBAG2_TYPE_DATA;
-
- hr = CreatePropertyBag2(opts, 1, ppIEncoderOptions);
+ 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))
{
LeaveCriticalSection(&This->lock);
Modified: trunk/reactos/dll/win32/windowscodecs/propertybag.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/pr…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/propertybag.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/propertybag.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -79,7 +79,7 @@
{
for (i=0; i < This->prop_count; i++)
{
- HeapFree(GetProcessHeap(), 0, This->properties[i].pstrName);
+ CoTaskMemFree(This->properties[i].pstrName);
VariantClear( This->values+i );
}
}
@@ -198,18 +198,14 @@
return S_OK;
}
-static HRESULT copy_propbag2(PROPBAG2 *dest, PROPBAG2 *src, BOOL useCoAlloc)
+static HRESULT copy_propbag2(PROPBAG2 *dest, PROPBAG2 *src)
{
dest->cfType = src->cfType;
dest->clsid = src->clsid;
dest->dwHint = src->dwHint;
dest->dwType = src->dwType;
dest->vt = src->vt;
- if(useCoAlloc)
- dest->pstrName = CoTaskMemAlloc((strlenW(src->pstrName)+1) *
sizeof(WCHAR));
- else
- dest->pstrName = HeapAlloc(GetProcessHeap(), 0, (strlenW(src->pstrName)+1)
* sizeof(WCHAR));
-
+ dest->pstrName = CoTaskMemAlloc((strlenW(src->pstrName)+1) * sizeof(WCHAR));
if(!dest->pstrName)
return E_OUTOFMEMORY;
@@ -236,7 +232,7 @@
for (i=0; i < *pcProperties; i++)
{
- res = copy_propbag2(pPropBag+i, This->properties+iProperty+i, TRUE);
+ res = copy_propbag2(pPropBag+i, This->properties+iProperty+i);
if (FAILED(res))
{
do {
@@ -296,7 +292,7 @@
else
for (i=0; i < count; i++)
{
- res = copy_propbag2(This->properties+i, options+i, FALSE);
+ res = copy_propbag2(This->properties+i, options+i);
if (FAILED(res))
break;
This->properties[i].dwHint = i+1; /* 0 means unset, so we start with 1
*/
Modified: trunk/reactos/dll/win32/windowscodecs/regsvr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/re…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/regsvr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/regsvr.c [iso-8859-1] Sun Jun 4 01:48:14 2017
@@ -1194,6 +1194,8 @@
&GUID_WICPixelFormatBlackWhite,
&GUID_WICPixelFormat4bppGray,
&GUID_WICPixelFormat8bppGray,
+ &GUID_WICPixelFormat16bppGray,
+ &GUID_WICPixelFormat32bppGrayFloat,
&GUID_WICPixelFormat1bppIndexed,
&GUID_WICPixelFormat2bppIndexed,
&GUID_WICPixelFormat4bppIndexed,
@@ -1205,6 +1207,9 @@
&GUID_WICPixelFormat48bppRGB,
&GUID_WICPixelFormat64bppRGBA,
&GUID_WICPixelFormat64bppPRGBA,
+ &GUID_WICPixelFormat32bppCMYK,
+ &GUID_WICPixelFormat64bppCMYK,
+ &GUID_WICPixelFormat128bppRGBAFloat,
NULL
};
@@ -1458,8 +1463,11 @@
&GUID_WICPixelFormat24bppBGR,
&GUID_WICPixelFormat24bppRGB,
&GUID_WICPixelFormat32bppBGR,
+ &GUID_WICPixelFormat32bppRGB,
&GUID_WICPixelFormat32bppBGRA,
+ &GUID_WICPixelFormat32bppRGBA,
&GUID_WICPixelFormat32bppPBGRA,
+ &GUID_WICPixelFormat32bppPRGBA,
&GUID_WICPixelFormat32bppGrayFloat,
&GUID_WICPixelFormat48bppRGB,
&GUID_WICPixelFormat64bppRGBA,
@@ -1733,6 +1741,11 @@
static BYTE const channel_mask_32bit[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
};
+static BYTE const channel_mask_128bit1[] = {
0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+static BYTE const channel_mask_128bit2[] = {
0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+static BYTE const channel_mask_128bit3[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00 };
+static BYTE const channel_mask_128bit4[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff };
+
static BYTE const channel_mask_5bit[] = { 0x1f, 0x00 };
static BYTE const channel_mask_5bit2[] = { 0xe0, 0x03 };
static BYTE const channel_mask_5bit3[] = { 0x00, 0x7c };
@@ -1750,6 +1763,7 @@
channel_mask_16bit2, channel_mask_16bit3, channel_mask_16bit4};
static BYTE const * const channel_masks_32bit[] = { channel_mask_32bit };
+static BYTE const * const channel_masks_128bit[] = { channel_mask_128bit1,
channel_mask_128bit2, channel_mask_128bit3, channel_mask_128bit4 };
static BYTE const * const channel_masks_BGRA5551[] = { channel_mask_5bit,
channel_mask_5bit2, channel_mask_5bit3, channel_mask_5bit4 };
@@ -1767,7 +1781,7 @@
1, /* channel count */
channel_masks_1bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormat2bppIndexed,
"The Wine Project",
@@ -1778,7 +1792,7 @@
1, /* channel count */
channel_masks_2bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormat4bppIndexed,
"The Wine Project",
@@ -1789,7 +1803,7 @@
1, /* channel count */
channel_masks_4bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormat8bppIndexed,
"The Wine Project",
@@ -1800,7 +1814,7 @@
1, /* channel count */
channel_masks_8bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormatBlackWhite,
"The Wine Project",
@@ -1923,6 +1937,17 @@
WICPixelFormatNumericRepresentationUnsignedInteger,
0
},
+ { &GUID_WICPixelFormat32bppRGB,
+ "The Wine Project",
+ "32bpp RGB",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 32, /* bitsperpixel */
+ 3, /* channel count */
+ channel_masks_8bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 0
+ },
{ &GUID_WICPixelFormat32bppBGRA,
"The Wine Project",
"32bpp BGRA",
@@ -1934,9 +1959,9 @@
WICPixelFormatNumericRepresentationUnsignedInteger,
1
},
- { &GUID_WICPixelFormat32bppPBGRA,
- "The Wine Project",
- "32bpp PBGRA",
+ { &GUID_WICPixelFormat32bppRGBA,
+ "The Wine Project",
+ "32bpp RGBA",
NULL, /* no version */
&GUID_VendorMicrosoft,
32, /* bitsperpixel */
@@ -1945,6 +1970,28 @@
WICPixelFormatNumericRepresentationUnsignedInteger,
1
},
+ { &GUID_WICPixelFormat32bppPBGRA,
+ "The Wine Project",
+ "32bpp PBGRA",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 32, /* bitsperpixel */
+ 4, /* channel count */
+ channel_masks_8bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 1
+ },
+ { &GUID_WICPixelFormat32bppPRGBA,
+ "The Wine Project",
+ "32bpp PRGBA",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 32, /* bitsperpixel */
+ 4, /* channel count */
+ channel_masks_8bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 1
+ },
{ &GUID_WICPixelFormat32bppGrayFloat,
"The Wine Project",
"32bpp GrayFloat",
@@ -1954,7 +2001,7 @@
1, /* channel count */
channel_masks_32bit,
WICPixelFormatNumericRepresentationFloat,
- 1
+ 0
},
{ &GUID_WICPixelFormat48bppRGB,
"The Wine Project",
@@ -1999,6 +2046,28 @@
channel_masks_8bit,
WICPixelFormatNumericRepresentationUnsignedInteger,
0
+ },
+ { &GUID_WICPixelFormat64bppCMYK,
+ "The Wine Project",
+ "64bpp CMYK",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 64, /* bitsperpixel */
+ 4, /* channel count */
+ channel_masks_16bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 0
+ },
+ { &GUID_WICPixelFormat128bppRGBAFloat,
+ "The Wine Project",
+ "128bpp RGBAFloat",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 128, /* bitsperpixel */
+ 4, /* channel count */
+ channel_masks_128bit,
+ WICPixelFormatNumericRepresentationFloat,
+ 1
},
{ NULL } /* list terminator */
};
Modified: trunk/reactos/dll/win32/windowscodecs/tiffformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ti…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/tiffformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/tiffformat.c [iso-8859-1] Sun Jun 4 01:48:14
2017
@@ -303,6 +303,8 @@
}
}
decode_info->planar = planar;
+
+ TRACE("planar %u, photometric %u, samples %u, bps %u\n", planar,
photometric, samples, bps);
switch(photometric)
{
@@ -368,14 +370,28 @@
}
}
break;
+ case 16:
+ if (samples != 1)
+ {
+ FIXME("unhandled 16bpp grayscale sample count %u\n", samples);
+ return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
+ }
+ decode_info->format = &GUID_WICPixelFormat16bppGray;
+ break;
+ case 32:
+ if (samples != 1)
+ {
+ FIXME("unhandled 32bpp grayscale sample count %u\n", samples);
+ return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
+ }
+ decode_info->format = &GUID_WICPixelFormat32bppGrayFloat;
+ break;
default:
- FIXME("unhandled greyscale bit count %u\n", bps);
- return E_FAIL;
+ WARN("unhandled greyscale bit count %u\n", bps);
+ return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
}
break;
case 2: /* RGB */
- decode_info->bpp = bps * samples;
-
if (samples == 4)
{
ret = pTIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_sample_count,
&extra_samples);
@@ -392,8 +408,12 @@
return E_FAIL;
}
+ decode_info->bpp = max(bps, 8) * samples;
+ decode_info->source_bpp = bps * samples;
switch(bps)
{
+ case 1:
+ case 4:
case 8:
decode_info->reverse_bgr = 1;
if (samples == 3)
@@ -431,9 +451,17 @@
return E_FAIL;
}
break;
+ case 32:
+ if (samples != 4)
+ {
+ FIXME("unhandled 32bpp RGB sample count %u\n", samples);
+ return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
+ }
+ decode_info->format = &GUID_WICPixelFormat128bppRGBAFloat;
+ break;
default:
- FIXME("unhandled RGB bit count %u\n", bps);
- return E_FAIL;
+ WARN("unhandled RGB bit count %u\n", bps);
+ return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
}
break;
case 3: /* RGB Palette */
@@ -464,8 +492,31 @@
return E_FAIL;
}
break;
+
+ case 5: /* Separated */
+ if (samples != 4)
+ {
+ FIXME("unhandled Separated sample count %u\n", samples);
+ return E_FAIL;
+ }
+
+ decode_info->bpp = bps * samples;
+ switch(bps)
+ {
+ case 8:
+ decode_info->format = &GUID_WICPixelFormat32bppCMYK;
+ break;
+ case 16:
+ decode_info->format = &GUID_WICPixelFormat64bppCMYK;
+ break;
+
+ default:
+ WARN("unhandled Separated bit count %u\n", bps);
+ return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
+ }
+ break;
+
case 4: /* Transparency mask */
- case 5: /* CMYK */
case 6: /* YCbCr */
case 8: /* CIELab */
default:
@@ -616,6 +667,7 @@
{
TiffDecoder *This = impl_from_IWICBitmapDecoder(iface);
TIFF *tiff;
+ tiff_decode_info decode_info;
HRESULT hr=S_OK;
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions);
@@ -629,10 +681,17 @@
}
tiff = tiff_open_stream(pIStream, "r");
-
if (!tiff)
{
hr = E_FAIL;
+ goto exit;
+ }
+
+ /* make sure that TIFF format is supported */
+ hr = tiff_get_decode_info(tiff, &decode_info);
+ if (hr != S_OK)
+ {
+ pTIFFClose(tiff);
goto exit;
}
@@ -951,34 +1010,183 @@
static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT tile_y)
{
- HRESULT hr=S_OK;
tsize_t ret;
int swap_bytes;
swap_bytes = pTIFFIsByteSwapped(This->parent->tiff);
ret = pTIFFSetDirectory(This->parent->tiff, This->index);
-
if (ret == -1)
- hr = E_FAIL;
-
- if (hr == S_OK)
- {
- if (This->decode_info.tiled)
- {
- ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y *
This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size);
- }
- else
- {
- ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y,
This->cached_tile, This->decode_info.tile_size);
- }
-
- if (ret == -1)
- hr = E_FAIL;
- }
-
+ return E_FAIL;
+
+ if (This->decode_info.tiled)
+ ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y *
This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size);
+ else
+ ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y,
This->cached_tile, This->decode_info.tile_size);
+
+ if (ret == -1)
+ return E_FAIL;
+
+ /* 3bpp RGB */
+ if (This->decode_info.source_bpp == 3 && This->decode_info.samples == 3
&& This->decode_info.bpp == 24)
+ {
+ BYTE *srcdata, *src, *dst;
+ DWORD x, y, count, width_bytes = (This->decode_info.tile_width * 3 + 7) / 8;
+
+ count = width_bytes * This->decode_info.tile_height;
+
+ srcdata = HeapAlloc(GetProcessHeap(), 0, count);
+ if (!srcdata) return E_OUTOFMEMORY;
+ memcpy(srcdata, This->cached_tile, count);
+
+ for (y = 0; y < This->decode_info.tile_height; y++)
+ {
+ src = srcdata + y * width_bytes;
+ dst = This->cached_tile + y * This->decode_info.tile_width * 3;
+
+ for (x = 0; x < This->decode_info.tile_width; x += 8)
+ {
+ dst[2] = (src[0] & 0x80) ? 0xff : 0; /* R */
+ dst[1] = (src[0] & 0x40) ? 0xff : 0; /* G */
+ dst[0] = (src[0] & 0x20) ? 0xff : 0; /* B */
+ if (x + 1 < This->decode_info.tile_width)
+ {
+ dst[5] = (src[0] & 0x10) ? 0xff : 0; /* R */
+ dst[4] = (src[0] & 0x08) ? 0xff : 0; /* G */
+ dst[3] = (src[0] & 0x04) ? 0xff : 0; /* B */
+ }
+ if (x + 2 < This->decode_info.tile_width)
+ {
+ dst[8] = (src[0] & 0x02) ? 0xff : 0; /* R */
+ dst[7] = (src[0] & 0x01) ? 0xff : 0; /* G */
+ dst[6] = (src[1] & 0x80) ? 0xff : 0; /* B */
+ }
+ if (x + 3 < This->decode_info.tile_width)
+ {
+ dst[11] = (src[1] & 0x40) ? 0xff : 0; /* R */
+ dst[10] = (src[1] & 0x20) ? 0xff : 0; /* G */
+ dst[9] = (src[1] & 0x10) ? 0xff : 0; /* B */
+ }
+ if (x + 4 < This->decode_info.tile_width)
+ {
+ dst[14] = (src[1] & 0x08) ? 0xff : 0; /* R */
+ dst[13] = (src[1] & 0x04) ? 0xff : 0; /* G */
+ dst[12] = (src[1] & 0x02) ? 0xff : 0; /* B */
+ }
+ if (x + 5 < This->decode_info.tile_width)
+ {
+ dst[17] = (src[1] & 0x01) ? 0xff : 0; /* R */
+ dst[16] = (src[2] & 0x80) ? 0xff : 0; /* G */
+ dst[15] = (src[2] & 0x40) ? 0xff : 0; /* B */
+ }
+ if (x + 6 < This->decode_info.tile_width)
+ {
+ dst[20] = (src[2] & 0x20) ? 0xff : 0; /* R */
+ dst[19] = (src[2] & 0x10) ? 0xff : 0; /* G */
+ dst[18] = (src[2] & 0x08) ? 0xff : 0; /* B */
+ }
+ if (x + 7 < This->decode_info.tile_width)
+ {
+ dst[23] = (src[2] & 0x04) ? 0xff : 0; /* R */
+ dst[22] = (src[2] & 0x02) ? 0xff : 0; /* G */
+ dst[21] = (src[2] & 0x01) ? 0xff : 0; /* B */
+ }
+ src += 3;
+ dst += 24;
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, srcdata);
+ }
+ /* 12bpp RGB */
+ else if (This->decode_info.source_bpp == 12 &&
This->decode_info.samples == 3 && This->decode_info.bpp == 24)
+ {
+ BYTE *srcdata, *src, *dst;
+ DWORD x, y, count, width_bytes = (This->decode_info.tile_width * 12 + 7) / 8;
+
+ count = width_bytes * This->decode_info.tile_height;
+
+ srcdata = HeapAlloc(GetProcessHeap(), 0, count);
+ if (!srcdata) return E_OUTOFMEMORY;
+ memcpy(srcdata, This->cached_tile, count);
+
+ for (y = 0; y < This->decode_info.tile_height; y++)
+ {
+ src = srcdata + y * width_bytes;
+ dst = This->cached_tile + y * This->decode_info.tile_width * 3;
+
+ for (x = 0; x < This->decode_info.tile_width; x += 2)
+ {
+ dst[0] = ((src[1] & 0xf0) >> 4) * 17; /* B */
+ dst[1] = (src[0] & 0x0f) * 17; /* G */
+ dst[2] = ((src[0] & 0xf0) >> 4) * 17; /* R */
+ if (x + 1 < This->decode_info.tile_width)
+ {
+ dst[5] = (src[1] & 0x0f) * 17; /* B */
+ dst[4] = ((src[2] & 0xf0) >> 4) * 17; /* G */
+ dst[3] = (src[2] & 0x0f) * 17; /* R */
+ }
+ src += 3;
+ dst += 6;
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, srcdata);
+ }
+ /* 4bpp RGBA */
+ else if (This->decode_info.source_bpp == 4 && This->decode_info.samples
== 4 && This->decode_info.bpp == 32)
+ {
+ BYTE *src, *dst;
+ DWORD count;
+
+ /* 1 source byte expands to 2 BGRA samples */
+ count = (This->decode_info.tile_width * This->decode_info.tile_height + 1)
/ 2;
+
+ src = This->cached_tile + count - 1;
+ dst = This->cached_tile + This->decode_info.tile_size;
+
+ while (count--)
+ {
+ BYTE b = *src--;
+
+ dst -= 8;
+ dst[2] = (b & 0x80) ? 0xff : 0; /* R */
+ dst[1] = (b & 0x40) ? 0xff : 0; /* G */
+ dst[0] = (b & 0x20) ? 0xff : 0; /* B */
+ dst[3] = (b & 0x10) ? 0xff : 0; /* A */
+ dst[6] = (b & 0x08) ? 0xff : 0; /* R */
+ dst[5] = (b & 0x04) ? 0xff : 0; /* G */
+ dst[4] = (b & 0x02) ? 0xff : 0; /* B */
+ dst[7] = (b & 0x01) ? 0xff : 0; /* A */
+ }
+ }
+ /* 16bpp RGBA */
+ else if (This->decode_info.source_bpp == 16 &&
This->decode_info.samples == 4 && This->decode_info.bpp == 32)
+ {
+ BYTE *src, *dst;
+ DWORD count = This->decode_info.tile_width *
This->decode_info.tile_height;
+
+ src = This->cached_tile + count * 2;
+ dst = This->cached_tile + This->decode_info.tile_size;
+
+ while (count--)
+ {
+ BYTE b[2];
+
+ src -= 2;
+ dst -= 4;
+
+ b[0] = src[0];
+ b[1] = src[1];
+
+ dst[0] = ((b[1] & 0xf0) >> 4) * 17; /* B */
+ dst[1] = (b[0] & 0x0f) * 17; /* G */
+ dst[2] = ((b[0] & 0xf0) >> 4) * 17; /* R */
+ dst[3] = (b[1] & 0x0f) * 17; /* A */
+ }
+ }
/* 8bpp grayscale with extra alpha */
- if (hr == S_OK && This->decode_info.source_bpp == 16 &&
This->decode_info.samples == 2 && This->decode_info.bpp == 32)
+ else if (This->decode_info.source_bpp == 16 &&
This->decode_info.samples == 2 && This->decode_info.bpp == 32)
{
BYTE *src;
DWORD *dst, count = This->decode_info.tile_width *
This->decode_info.tile_height;
@@ -993,7 +1201,7 @@
}
}
- if (hr == S_OK && This->decode_info.reverse_bgr)
+ if (This->decode_info.reverse_bgr)
{
if (This->decode_info.bps == 8)
{
@@ -1004,7 +1212,7 @@
}
}
- if (hr == S_OK && swap_bytes && This->decode_info.bps > 8)
+ if (swap_bytes && This->decode_info.bps > 8)
{
UINT row, i, samples_per_row;
BYTE *sample, temp;
@@ -1032,7 +1240,7 @@
}
}
- if (hr == S_OK && This->decode_info.invert_grayscale)
+ if (This->decode_info.invert_grayscale)
{
BYTE *byte, *end;
@@ -1048,13 +1256,10 @@
*byte = ~(*byte);
}
- if (hr == S_OK)
- {
- This->cached_tile_x = tile_x;
- This->cached_tile_y = tile_y;
- }
-
- return hr;
+ This->cached_tile_x = tile_x;
+ This->cached_tile_y = tile_y;
+
+ return S_OK;
}
static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
@@ -1297,11 +1502,11 @@
{
BOOL byte_swapped = pTIFFIsByteSwapped(This->parent->tiff);
#ifdef WORDS_BIGENDIAN
- DWORD persist_options = byte_swapped ? WICPersistOptionsLittleEndian :
WICPersistOptionsBigEndian;
+ DWORD persist_options = byte_swapped ? WICPersistOptionLittleEndian :
WICPersistOptionBigEndian;
#else
- DWORD persist_options = byte_swapped ? WICPersistOptionsBigEndian :
WICPersistOptionsLittleEndian;
+ DWORD persist_options = byte_swapped ? WICPersistOptionBigEndian :
WICPersistOptionLittleEndian;
#endif
- persist_options |= WICPersistOptionsNoCacheStream;
+ persist_options |= WICPersistOptionNoCacheStream;
hr = IWICPersistStream_LoadEx(persist, This->parent->stream, NULL,
persist_options);
if (FAILED(hr))
ERR("IWICPersistStream_LoadEx error %#x\n", hr);
@@ -1698,7 +1903,7 @@
for (i = 0; i < This->colors; i++)
{
- red[i] = (This->palette[i] >> 0) & 0xff00;
+ red[i] = (This->palette[i] >> 8) & 0xff00;
green[i] = This->palette[i] & 0xff00;
blue[i] = (This->palette[i] << 8) & 0xff00;
}
Modified: trunk/reactos/dll/win32/windowscodecs/typeof.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ty…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/typeof.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/typeof.h [iso-8859-1] Sun Jun 4 01:48:14 2017
@@ -78,6 +78,7 @@
typedef void (__cdecl typeof(png_set_crc_action))(struct png_struct_def *, int, int);
typedef void (__stdcall typeof(png_set_PLTE))(struct png_struct_def *, struct
png_info_def *, const struct png_color_struct *, int);
typedef void (__stdcall typeof(png_set_tRNS))(struct png_struct_def *, struct
png_info_def *, const unsigned char *, int, const struct png_color_16_struct *);
+typedef void (__cdecl typeof(png_set_filter))(struct png_struct_def *, int, int);
typedef void *thandle_t_1;
typedef int (*TIFFReadWriteProc_1)(thandle_t_1, void *, __typeof_intptr);
typedef unsigned int (*TIFFSeekProc_1)(void *, unsigned int, int);
Modified: trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/wi…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec [iso-8859-1] Sun Jun 4
01:48:14 2017
@@ -72,7 +72,7 @@
@ stdcall IWICImagingFactory_CreateBitmapScaler_Proxy(ptr ptr)
IWICImagingFactory_CreateBitmapScaler_Proxy_W
@ stdcall IWICImagingFactory_CreateBitmap_Proxy(ptr long long ptr long ptr)
IWICImagingFactory_CreateBitmap_Proxy_W
@ stdcall IWICImagingFactory_CreateComponentInfo_Proxy(ptr ptr ptr)
IWICImagingFactory_CreateComponentInfo_Proxy_W
-@ stdcall IWICImagingFactory_CreateDecoderFromFileHandle_Proxy(ptr ptr ptr long ptr)
IWICImagingFactory_CreateDecoderFromFileHandle_Proxy_W
+@ stdcall IWICImagingFactory_CreateDecoderFromFileHandle_Proxy(ptr long ptr long ptr)
IWICImagingFactory_CreateDecoderFromFileHandle_Proxy_W
@ stdcall IWICImagingFactory_CreateDecoderFromFilename_Proxy(ptr wstr ptr long long ptr)
IWICImagingFactory_CreateDecoderFromFilename_Proxy_W
@ stdcall IWICImagingFactory_CreateDecoderFromStream_Proxy(ptr ptr ptr long ptr)
IWICImagingFactory_CreateDecoderFromStream_Proxy_W
@ stdcall IWICImagingFactory_CreateEncoder_Proxy(ptr ptr ptr ptr)
IWICImagingFactory_CreateEncoder_Proxy_W
@@ -110,9 +110,9 @@
@ stdcall WICCreateColorContext_Proxy(ptr ptr)
@ stdcall WICCreateImagingFactory_Proxy(long ptr)
@ stub WICGetMetadataContentSize
-@ stub WICMapGuidToShortName
-@ stub WICMapSchemaToName
-@ stub WICMapShortNameToGuid
+@ stdcall WICMapGuidToShortName(ptr long ptr ptr)
+@ stdcall WICMapSchemaToName(ptr wstr long ptr ptr)
+@ stdcall WICMapShortNameToGuid(wstr ptr)
@ stub WICMatchMetadataContent
@ stub WICSerializeMetadataContent
@ stdcall WICSetEncoderFormat_Proxy(ptr ptr ptr ptr)
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 4 01:48:14 2017
@@ -196,7 +196,7 @@
reactos/dll/win32/vssapi # Synced to WineStaging-1.9.11
reactos/dll/win32/wbemdisp # Synced to WineStaging-2.9
reactos/dll/win32/wbemprox # Synced to WineStaging-2.9
-reactos/dll/win32/windowscodecs # Synced to WineStaging-1.9.23
+reactos/dll/win32/windowscodecs # Synced to WineStaging-2.9
reactos/dll/win32/windowscodecsext # Synced to WineStaging-1.9.11
reactos/dll/win32/winemp3.acm # Synced to WineStaging-2.2
reactos/dll/win32/wing32 # Synced to WineStaging-1.9.11
Modified: trunk/reactos/sdk/include/psdk/wincodecsdk.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/wincodecs…
==============================================================================
--- trunk/reactos/sdk/include/psdk/wincodecsdk.idl [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/psdk/wincodecsdk.idl [iso-8859-1] Sun Jun 4 01:48:14 2017
@@ -20,13 +20,13 @@
import "wincodec.idl";
typedef enum WICPersistOptions {
- WICPersistOptionsDefault = 0x00000000,
- WICPersistOptionsLittleEndian = 0x00000000,
- WICPersistOptionsBigEndian = 0x00000001,
- WICPersistOptionsStrictFormat = 0x00000002,
- WICPersistOptionsNoCacheStream = 0x00000004,
+ WICPersistOptionDefault = 0x00000000,
+ WICPersistOptionLittleEndian = 0x00000000,
+ WICPersistOptionBigEndian = 0x00000001,
+ WICPersistOptionStrictFormat = 0x00000002,
+ WICPersistOptionNoCacheStream = 0x00000004,
WICPersistOptionPreferUTF8 = 0x00000008,
- WICPersistOptionsMask = 0x0000FFFF
+ WICPersistOptionMask = 0x0000FFFF
} WICPersistOptions;
typedef enum WICMetadataCreationOptions {
@@ -50,6 +50,29 @@
cpp_quote("DEFINE_GUID(GUID_MetadataFormatGCE,
0x2a25cad8,0xdeeb,0x4c69,0xa7,0x88,0x0e,0xc2,0x26,0x6d,0xca,0xfd);")
cpp_quote("DEFINE_GUID(GUID_MetadataFormatAPE,
0x2e043dc2,0xc967,0x4e05,0x87,0x5e,0x61,0x8b,0xf6,0x7e,0x85,0xc3);")
cpp_quote("DEFINE_GUID(GUID_MetadataFormatGifComment,
0xc4b6e0e0,0xcfb4,0x4ad3,0xab,0x33,0x9a,0xad,0x23,0x55,0xa3,0x4a);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatSubIfd,
0x58a2e128,0x2db9,0x4e57,0xbb,0x14,0x51,0x77,0x89,0x1e,0xd3,0x31);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatGps,
0x7134ab8a,0x9351,0x44ad,0xaf,0x62,0x44,0x8d,0xb6,0xb5,0x02,0xec);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatInterop,
0xed686f8e,0x681f,0x4c8b,0xbd,0x41,0xa8,0xad,0xdb,0xf6,0xb3,0xfc);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatApp0,
0x79007028,0x268d,0x45d6,0xa3,0xc2,0x35,0x4e,0x6a,0x50,0x4b,0xc9);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatApp1,
0x8fd3dfc3,0xf951,0x492b,0x81,0x7f,0x69,0xc2,0xe6,0xd9,0xa5,0xb0);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatApp13,
0x326556a2,0xf502,0x4354,0x9c,0xc0,0x8e,0x3f,0x48,0xea,0xf6,0xb5);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatIPTC,
0x4fab0914,0xe129,0x4087,0xa1,0xd1,0xbc,0x81,0x2d,0x45,0xa7,0xb5);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatIRB,
0x16100d66,0x8570,0x4bb9,0xb9,0x2d,0xfd,0xa4,0xb2,0x3e,0xce,0x67);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormat8BIMIPTC,
0x0010568c,0x0852,0x4e6a,0xb1,0x91,0x5c,0x33,0xac,0x5b,0x04,0x30);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormat8BIMResolutionInfo,
0x739f305d,0x81db,0x43cb,0xac,0x5e,0x55,0x01,0x3e,0xf9,0xf0,0x03);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormat8BIMIPTCDigest,
0x1ca32285,0x9ccd,0x4786,0x8b,0xd8,0x79,0x53,0x9d,0xb6,0xa0,0x06);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatThumbnail,
0x243dcee9,0x8703,0x40ee,0x8e,0xf0,0x22,0xa6,0x0,0xb8,0x5,0x8c);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPBag,
0x833cca5f,0xdcb7,0x4516,0x80,0x6f,0x65,0x96,0xab,0x26,0xdc,0xe4);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPSeq,
0x63e8df02,0xeb6c,0x456c,0xa2,0x24,0xb2,0x5e,0x79,0x4f,0xd6,0x48);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPAlt,
0x7b08a675,0x91aa,0x481b,0xa7,0x98,0x4d,0xa9,0x49,0x08,0x61,0x3b);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatJpegChrominance,
0xf73d0dcf,0xcec6,0x4f85,0x9b,0x0e,0x1c,0x39,0x56,0xb1,0xbe,0xf7);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatJpegLuminance,
0x86908007,0xedfc,0x4860,0x8d,0x4b,0x4e,0xe6,0xe8,0x3e,0x60,0x58);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatJpegComment,
0x220e5f33,0xafd3,0x474e,0x9d,0x31,0x7d,0x4f,0xe7,0x30,0xf5,0x57);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkbKGD,
0xe14d3571,0x6b47,0x4dea,0xb6,0xa,0x87,0xce,0xa,0x78,0xdf,0xb7);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkiTXt,
0xc2bec729,0xb68,0x4b77,0xaa,0xe,0x62,0x95,0xa6,0xac,0x18,0x14);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkhIST,
0xc59a82da,0xdb74,0x48a4,0xbd,0x6a,0xb6,0x9c,0x49,0x31,0xef,0x95);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkiCCP,
0xeb4349ab,0xb685,0x450f,0x91,0xb5,0xe8,0x2,0xe8,0x92,0x53,0x6c);")
+cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunksRGB,
0xc115fd36,0xcc6f,0x4e3f,0x83,0x63,0x52,0x4b,0x87,0xc6,0xb0,0xd9);")
cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataReader,
0x699745c2,0x5066,0x4b82,0xa8,0xe3,0xd4,0x04,0x78,0xdb,0xec,0x8c);")
cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataWriter,
0xa09cca86,0x27ba,0x4f39,0x90,0x53,0x12,0x1f,0xa4,0xdc,0x08,0xfc);")