Author: akhaldi
Date: Wed Oct 8 19:30:33 2014
New Revision: 64615
URL:
http://svn.reactos.org/svn/reactos?rev=64615&view=rev
Log:
[WINDOWSCODECS]
* Sync with Wine 1.7.27.
CORE-8540
Modified:
trunk/reactos/dll/win32/windowscodecs/bmpencode.c
trunk/reactos/dll/win32/windowscodecs/icnsformat.c
trunk/reactos/dll/win32/windowscodecs/imgfactory.c
trunk/reactos/dll/win32/windowscodecs/jpegformat.c
trunk/reactos/dll/win32/windowscodecs/main.c
trunk/reactos/dll/win32/windowscodecs/pngformat.c
trunk/reactos/dll/win32/windowscodecs/propertybag.c
trunk/reactos/dll/win32/windowscodecs/proxy.c
trunk/reactos/dll/win32/windowscodecs/tiffformat.c
trunk/reactos/dll/win32/windowscodecs/typeof.h
trunk/reactos/dll/win32/windowscodecs/ungif.c
trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/windowscodecs/bmpencode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/bm…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/bmpencode.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/bmpencode.c [iso-8859-1] Wed Oct 8 19:30:33
2014
@@ -245,63 +245,22 @@
{
BmpFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- WICRect rc;
- WICPixelFormatGUID guid;
TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
- if (!This->initialized || !This->width || !This->height)
+ if (!This->initialized)
return WINCODEC_ERR_WRONGSTATE;
- if (!This->format)
- {
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- hr = BmpFrameEncode_SetPixelFormat(iface, &guid);
- if (FAILED(hr)) return hr;
- }
-
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- if (memcmp(&guid, This->format->guid, sizeof(GUID)) != 0)
- {
- /* should use WICConvertBitmapSource to convert, but that's unimplemented */
- ERR("format %s unsupported\n", debugstr_guid(&guid));
- return E_FAIL;
- }
-
- if (This->xres == 0.0 || This->yres == 0.0)
- {
- double xres, yres;
- hr = IWICBitmapSource_GetResolution(pIBitmapSource, &xres, &yres);
- if (FAILED(hr)) return hr;
- hr = BmpFrameEncode_SetResolution(iface, xres, yres);
- if (FAILED(hr)) return hr;
- }
-
- if (!prc)
- {
- UINT width, height;
- hr = IWICBitmapSource_GetSize(pIBitmapSource, &width, &height);
- if (FAILED(hr)) return hr;
- rc.X = 0;
- rc.Y = 0;
- rc.Width = width;
- rc.Height = height;
- prc = &rc;
- }
-
- if (prc->Width != This->width) return E_INVALIDARG;
-
- hr = BmpFrameEncode_AllocateBits(This);
- if (FAILED(hr)) return hr;
-
- hr = IWICBitmapSource_CopyPixels(pIBitmapSource, prc, This->stride,
- This->stride*(This->height-This->lineswritten),
- This->bits + This->stride*This->lineswritten);
-
- This->lineswritten += prc->Height;
-
- return S_OK;
+ hr = configure_write_source(iface, pIBitmapSource, prc,
+ This->format ? This->format->guid : NULL, This->width,
This->height,
+ This->xres, This->yres);
+
+ if (SUCCEEDED(hr))
+ {
+ hr = write_source(iface, pIBitmapSource, prc,
+ This->format->guid, This->format->bpp, This->width,
This->height);
+ }
+
+ return hr;
}
static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface)
Modified: trunk/reactos/dll/win32/windowscodecs/icnsformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ic…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/icnsformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/icnsformat.c [iso-8859-1] Wed Oct 8 19:30:33
2014
@@ -374,66 +374,22 @@
{
IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- WICRect rc;
- WICPixelFormatGUID guid;
- UINT stride;
- BYTE *pixeldata = NULL;
TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
- if (!This->initialized || !This->size)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
-
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr))
- goto end;
- if (!IsEqualGUID(&guid, &GUID_WICPixelFormat32bppBGRA))
- {
- FIXME("format %s unsupported, could use WICConvertBitmapSource to
convert\n", debugstr_guid(&guid));
- hr = E_FAIL;
- goto end;
- }
-
- if (!prc)
- {
- UINT width, height;
- hr = IWICBitmapSource_GetSize(pIBitmapSource, &width, &height);
- if (FAILED(hr))
- goto end;
- rc.X = 0;
- rc.Y = 0;
- rc.Width = width;
- rc.Height = height;
- prc = &rc;
- }
-
- if (prc->Width != This->size)
- {
- hr = E_INVALIDARG;
- goto end;
- }
-
- stride = (32 * This->size + 7)/8;
- pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
- if (!pixeldata)
- {
- hr = E_OUTOFMEMORY;
- goto end;
- }
-
- hr = IWICBitmapSource_CopyPixels(pIBitmapSource, prc, stride,
- stride*prc->Height, pixeldata);
+ if (!This->initialized)
+ return WINCODEC_ERR_WRONGSTATE;
+
+ hr = configure_write_source(iface, pIBitmapSource, &prc,
+ &GUID_WICPixelFormat32bppBGRA, This->size, This->size,
+ 1.0, 1.0);
+
if (SUCCEEDED(hr))
{
- hr = IWICBitmapFrameEncode_WritePixels(iface, prc->Height, stride,
- stride*prc->Height, pixeldata);
- }
-
-end:
- HeapFree(GetProcessHeap(), 0, pixeldata);
+ hr = write_source(iface, pIBitmapSource, prc,
+ &GUID_WICPixelFormat32bppBGRA, 32, This->size, This->size);
+ }
+
return hr;
}
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] Wed Oct 8 19:30:33
2014
@@ -529,20 +529,22 @@
IWICBitmapLock_Release(lock);
}
- if (SUCCEEDED(hr))
- hr = PaletteImpl_Create(&palette);
-
if (SUCCEEDED(hr) && (format_type ==
WICPixelFormatNumericRepresentationUnspecified ||
format_type ==
WICPixelFormatNumericRepresentationIndexed))
{
- hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
+ hr = PaletteImpl_Create(&palette);
if (SUCCEEDED(hr))
- hr = IWICBitmap_SetPalette(result, palette);
- else
- hr = S_OK;
-
- IWICPalette_Release(palette);
+ {
+ hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
+
+ if (SUCCEEDED(hr))
+ hr = IWICBitmap_SetPalette(result, palette);
+ else
+ hr = S_OK;
+
+ IWICPalette_Release(palette);
+ }
}
if (SUCCEEDED(hr))
Modified: trunk/reactos/dll/win32/windowscodecs/jpegformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/jp…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/jpegformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/jpegformat.c [iso-8859-1] Wed Oct 8 19:30:33
2014
@@ -1088,70 +1088,20 @@
{
JpegEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- WICRect rc;
- WICPixelFormatGUID guid;
- UINT stride;
- BYTE *pixeldata;
TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
- if (!This->frame_initialized || !This->width || !This->height)
+ if (!This->frame_initialized)
return WINCODEC_ERR_WRONGSTATE;
- if (!This->format)
- {
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- hr = IWICBitmapFrameEncode_SetPixelFormat(iface, &guid);
- if (FAILED(hr)) return hr;
- }
-
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- if (memcmp(&guid, This->format->guid, sizeof(GUID)) != 0)
- {
- /* FIXME: should use WICConvertBitmapSource to convert */
- ERR("format %s unsupported\n", debugstr_guid(&guid));
- return E_FAIL;
- }
-
- if (This->xres == 0.0 || This->yres == 0.0)
- {
- double xres, yres;
- hr = IWICBitmapSource_GetResolution(pIBitmapSource, &xres, &yres);
- if (FAILED(hr)) return hr;
- hr = IWICBitmapFrameEncode_SetResolution(iface, xres, yres);
- if (FAILED(hr)) return hr;
- }
-
- if (!prc)
- {
- UINT width, height;
- hr = IWICBitmapSource_GetSize(pIBitmapSource, &width, &height);
- if (FAILED(hr)) return hr;
- rc.X = 0;
- rc.Y = 0;
- rc.Width = width;
- rc.Height = height;
- prc = &rc;
- }
-
- if (prc->Width != This->width) return E_INVALIDARG;
-
- stride = (This->format->bpp * This->width + 7)/8;
-
- pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
- if (!pixeldata) return E_OUTOFMEMORY;
-
- hr = IWICBitmapSource_CopyPixels(pIBitmapSource, prc, stride,
- stride*prc->Height, pixeldata);
+ hr = configure_write_source(iface, pIBitmapSource, prc,
+ This->format ? This->format->guid : NULL, This->width,
This->height,
+ This->xres, This->yres);
if (SUCCEEDED(hr))
{
- hr = IWICBitmapFrameEncode_WritePixels(iface, prc->Height, stride,
- stride*prc->Height, pixeldata);
- }
-
- HeapFree(GetProcessHeap(), 0, pixeldata);
+ hr = write_source(iface, pIBitmapSource, prc,
+ This->format->guid, This->format->bpp, This->width,
This->height);
+ }
return hr;
}
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] Wed Oct 8 19:30:33 2014
@@ -103,6 +103,92 @@
}
}
+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;
+
+ 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))
+ {
+ /* FIXME: should use WICConvertBitmapSource to convert */
+ ERR("format %s unsupported\n", debugstr_guid(&src_format));
+ return E_FAIL;
+ }
+
+ if (xres == 0.0 || yres == 0.0)
+ {
+ hr = IWICBitmapSource_GetResolution(source, &xres, &yres);
+ if (FAILED(hr)) return hr;
+ hr = IWICBitmapFrameEncode_SetResolution(iface, xres, yres);
+ if (FAILED(hr)) return hr;
+ }
+
+ return hr;
+}
+
+HRESULT write_source(IWICBitmapFrameEncode *iface,
+ IWICBitmapSource *source, const WICRect *prc,
+ const WICPixelFormatGUID *format, UINT bpp,
+ INT width, INT height)
+{
+ HRESULT hr=S_OK;
+ WICRect rc;
+ UINT stride;
+ BYTE* pixeldata;
+
+ if (!prc)
+ {
+ UINT src_width, src_height;
+ hr = IWICBitmapSource_GetSize(source, &src_width, &src_height);
+ if (FAILED(hr)) return hr;
+ rc.X = 0;
+ rc.Y = 0;
+ rc.Width = src_width;
+ rc.Height = src_height;
+ prc = &rc;
+ }
+
+ if (prc->Width != width || prc->Height <= 0)
+ return E_INVALIDARG;
+
+ stride = (bpp * width + 7)/8;
+
+ pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
+ if (!pixeldata) return E_OUTOFMEMORY;
+
+ hr = IWICBitmapSource_CopyPixels(source, prc, stride,
+ stride*prc->Height, pixeldata);
+
+ if (SUCCEEDED(hr))
+ {
+ hr = IWICBitmapFrameEncode_WritePixels(iface, prc->Height, stride,
+ stride*prc->Height, pixeldata);
+ }
+
+ HeapFree(GetProcessHeap(), 0, pixeldata);
+
+ return hr;
+}
+
void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride)
{
UINT x, y;
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] Wed Oct 8 19:30:33
2014
@@ -21,6 +21,8 @@
#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 HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG
*data_size)
{
@@ -164,6 +166,7 @@
#endif
MAKE_FUNCPTR(png_set_filler);
MAKE_FUNCPTR(png_set_gray_to_rgb);
+MAKE_FUNCPTR(png_set_interlace_handling);
MAKE_FUNCPTR(png_set_IHDR);
MAKE_FUNCPTR(png_set_pHYs);
MAKE_FUNCPTR(png_set_read_fn);
@@ -213,6 +216,7 @@
#endif
LOAD_FUNCPTR(png_set_filler);
LOAD_FUNCPTR(png_set_gray_to_rgb);
+ LOAD_FUNCPTR(png_set_interlace_handling);
LOAD_FUNCPTR(png_set_IHDR);
LOAD_FUNCPTR(png_set_pHYs);
LOAD_FUNCPTR(png_set_read_fn);
@@ -1041,6 +1045,10 @@
BOOL frame_committed;
BOOL committed;
CRITICAL_SECTION lock;
+ BOOL interlace;
+ BYTE *data;
+ UINT stride;
+ UINT passes;
} PngEncoder;
static inline PngEncoder *impl_from_IWICBitmapEncoder(IWICBitmapEncoder *iface)
@@ -1092,8 +1100,32 @@
IPropertyBag2 *pIEncoderOptions)
{
PngEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
+ BOOL interlace;
+ PROPBAG2 opts[1]= {{0}};
+ VARIANT opt_values[1];
+ HRESULT opt_hres[1];
+ HRESULT hr;
+
TRACE("(%p,%p)\n", iface, pIEncoderOptions);
+ opts[0].pstrName = (LPOLESTR)wszPngInterlaceOption;
+ opts[0].vt = VT_BOOL;
+
+ if (pIEncoderOptions)
+ {
+ hr = IPropertyBag2_Read(pIEncoderOptions, 1, opts, NULL, opt_values, opt_hres);
+
+ if (FAILED(hr))
+ return hr;
+ }
+ 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);
+
EnterCriticalSection(&This->lock);
if (This->frame_initialized)
@@ -1101,6 +1133,8 @@
LeaveCriticalSection(&This->lock);
return WINCODEC_ERR_WRONGSTATE;
}
+
+ This->interlace = interlace;
This->frame_initialized = TRUE;
@@ -1239,8 +1273,21 @@
if (!This->info_written)
{
+ if (This->interlace)
+ {
+ /* libpng requires us to write all data multiple times in this case. */
+ This->stride = (This->format->bpp * This->width + 7)/8;
+ This->data = HeapAlloc(GetProcessHeap(), 0, This->height *
This->stride);
+ if (!This->data)
+ {
+ LeaveCriticalSection(&This->lock);
+ return E_OUTOFMEMORY;
+ }
+ }
+
ppng_set_IHDR(This->png_ptr, This->info_ptr, This->width,
This->height,
- This->format->bit_depth, This->format->color_type,
PNG_INTERLACE_NONE,
+ This->format->bit_depth, This->format->color_type,
+ This->interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
if (This->xres != 0.0 && This->yres != 0.0)
@@ -1257,7 +1304,24 @@
if (This->format->swap_rgb)
ppng_set_bgr(This->png_ptr);
+ if (This->interlace)
+ This->passes = ppng_set_interlace_handling(This->png_ptr);
+
This->info_written = TRUE;
+ }
+
+ if (This->interlace)
+ {
+ /* Just store the data so we can write it in multiple passes in Commit. */
+ for (i=0; i<lineCount; i++)
+ memcpy(This->data + This->stride * (This->lines_written + i),
+ pbPixels + cbStride * i,
+ This->stride);
+
+ This->lines_written += lineCount;
+
+ LeaveCriticalSection(&This->lock);
+ return S_OK;
}
row_pointers = HeapAlloc(GetProcessHeap(), 0, lineCount * sizeof(png_byte*));
@@ -1285,70 +1349,20 @@
{
PngEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- WICRect rc;
- WICPixelFormatGUID guid;
- UINT stride;
- BYTE *pixeldata;
TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
- if (!This->frame_initialized || !This->width || !This->height)
+ if (!This->frame_initialized)
return WINCODEC_ERR_WRONGSTATE;
- if (!This->format)
- {
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- hr = IWICBitmapFrameEncode_SetPixelFormat(iface, &guid);
- if (FAILED(hr)) return hr;
- }
-
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- if (memcmp(&guid, This->format->guid, sizeof(GUID)) != 0)
- {
- /* FIXME: should use WICConvertBitmapSource to convert */
- ERR("format %s unsupported\n", debugstr_guid(&guid));
- return E_FAIL;
- }
-
- if (This->xres == 0.0 || This->yres == 0.0)
- {
- double xres, yres;
- hr = IWICBitmapSource_GetResolution(pIBitmapSource, &xres, &yres);
- if (FAILED(hr)) return hr;
- hr = IWICBitmapFrameEncode_SetResolution(iface, xres, yres);
- if (FAILED(hr)) return hr;
- }
-
- if (!prc)
- {
- UINT width, height;
- hr = IWICBitmapSource_GetSize(pIBitmapSource, &width, &height);
- if (FAILED(hr)) return hr;
- rc.X = 0;
- rc.Y = 0;
- rc.Width = width;
- rc.Height = height;
- prc = &rc;
- }
-
- if (prc->Width != This->width) return E_INVALIDARG;
-
- stride = (This->format->bpp * This->width + 7)/8;
-
- pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
- if (!pixeldata) return E_OUTOFMEMORY;
-
- hr = IWICBitmapSource_CopyPixels(pIBitmapSource, prc, stride,
- stride*prc->Height, pixeldata);
+ hr = configure_write_source(iface, pIBitmapSource, prc,
+ This->format ? This->format->guid : NULL, This->width,
This->height,
+ This->xres, This->yres);
if (SUCCEEDED(hr))
{
- hr = IWICBitmapFrameEncode_WritePixels(iface, prc->Height, stride,
- stride*prc->Height, pixeldata);
- }
-
- HeapFree(GetProcessHeap(), 0, pixeldata);
+ hr = write_source(iface, pIBitmapSource, prc,
+ This->format->guid, This->format->bpp, This->width,
This->height);
+ }
return hr;
}
@@ -1356,6 +1370,7 @@
static HRESULT WINAPI PngFrameEncode_Commit(IWICBitmapFrameEncode *iface)
{
PngEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
+ png_byte **row_pointers=NULL;
jmp_buf jmpbuf;
TRACE("(%p)\n", iface);
@@ -1371,13 +1386,34 @@
if (setjmp(jmpbuf))
{
LeaveCriticalSection(&This->lock);
+ HeapFree(GetProcessHeap(), 0, row_pointers);
return E_FAIL;
}
ppng_set_error_fn(This->png_ptr, jmpbuf, user_error_fn, user_warning_fn);
+ if (This->interlace)
+ {
+ int i;
+
+ row_pointers = HeapAlloc(GetProcessHeap(), 0, This->height *
sizeof(png_byte*));
+ if (!row_pointers)
+ {
+ LeaveCriticalSection(&This->lock);
+ return E_OUTOFMEMORY;
+ }
+
+ for (i=0; i<This->height; i++)
+ row_pointers[i] = This->data + This->stride * i;
+
+ for (i=0; i<This->passes; i++)
+ ppng_write_rows(This->png_ptr, row_pointers, This->height);
+ }
+
ppng_write_end(This->png_ptr, This->info_ptr);
This->frame_committed = TRUE;
+
+ HeapFree(GetProcessHeap(), 0, row_pointers);
LeaveCriticalSection(&This->lock);
@@ -1456,6 +1492,7 @@
ppng_destroy_write_struct(&This->png_ptr, &This->info_ptr);
if (This->stream)
IStream_Release(This->stream);
+ HeapFree(GetProcessHeap(), 0, This->data);
HeapFree(GetProcessHeap(), 0, This);
}
@@ -1579,6 +1616,8 @@
{
PngEncoder *This = impl_from_IWICBitmapEncoder(iface);
HRESULT hr;
+ PROPBAG2 opts[1]= {{0}};
+
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
EnterCriticalSection(&This->lock);
@@ -1595,7 +1634,11 @@
return WINCODEC_ERR_NOTINITIALIZED;
}
- hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions);
+ opts[0].pstrName = (LPOLESTR)wszPngInterlaceOption;
+ opts[0].vt = VT_BOOL;
+ opts[0].dwType = PROPBAG2_TYPE_DATA;
+
+ hr = CreatePropertyBag2(opts, 1, ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
@@ -1690,6 +1733,7 @@
This->lines_written = 0;
This->frame_committed = FALSE;
This->committed = FALSE;
+ This->data = NULL;
InitializeCriticalSection(&This->lock);
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
PngEncoder.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] Wed Oct 8 19:30:33
2014
@@ -232,7 +232,7 @@
if (iProperty+cProperties > This->prop_count )
return WINCODEC_ERR_VALUEOUTOFRANGE;
- *pcProperties = max(cProperties, This->prop_count-iProperty);
+ *pcProperties = min(cProperties, This->prop_count-iProperty);
for (i=0; i < *pcProperties; i++)
{
Modified: trunk/reactos/dll/win32/windowscodecs/proxy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/pr…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/proxy.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/proxy.c [iso-8859-1] Wed Oct 8 19:30:33 2014
@@ -208,6 +208,9 @@
HRESULT WINAPI IWICBitmapFrameEncode_WriteSource_Proxy_W(IWICBitmapFrameEncode *iface,
IWICBitmapSource *pIBitmapSource, WICRect *prc)
{
+ if (prc && (prc->Width <= 0 || prc->Height <= 0))
+ prc = NULL;
+
return IWICBitmapFrameEncode_WriteSource(iface, pIBitmapSource, prc);
}
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] Wed Oct 8 19:30:33
2014
@@ -1636,73 +1636,23 @@
{
TiffFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- WICRect rc;
- WICPixelFormatGUID guid;
- UINT stride;
- BYTE *pixeldata;
TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
- if (!This->initialized || !This->width || !This->height)
+ if (!This->initialized)
return WINCODEC_ERR_WRONGSTATE;
- if (!This->format)
- {
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- hr = IWICBitmapFrameEncode_SetPixelFormat(iface, &guid);
- if (FAILED(hr)) return hr;
- }
-
- hr = IWICBitmapSource_GetPixelFormat(pIBitmapSource, &guid);
- if (FAILED(hr)) return hr;
- if (memcmp(&guid, This->format->guid, sizeof(GUID)) != 0)
- {
- /* FIXME: should use WICConvertBitmapSource to convert */
- ERR("format %s unsupported\n", debugstr_guid(&guid));
- return E_FAIL;
- }
-
- if (This->xres == 0.0 || This->yres == 0.0)
- {
- double xres, yres;
- hr = IWICBitmapSource_GetResolution(pIBitmapSource, &xres, &yres);
- if (FAILED(hr)) return hr;
- hr = IWICBitmapFrameEncode_SetResolution(iface, xres, yres);
- if (FAILED(hr)) return hr;
- }
-
- if (!prc)
- {
- UINT width, height;
- hr = IWICBitmapSource_GetSize(pIBitmapSource, &width, &height);
- if (FAILED(hr)) return hr;
- rc.X = 0;
- rc.Y = 0;
- rc.Width = width;
- rc.Height = height;
- prc = &rc;
- }
-
- if (prc->Width != This->width) return E_INVALIDARG;
-
- stride = (This->format->bpp * This->width + 7)/8;
-
- pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
- if (!pixeldata) return E_OUTOFMEMORY;
-
- hr = IWICBitmapSource_CopyPixels(pIBitmapSource, prc, stride,
- stride*prc->Height, pixeldata);
+ hr = configure_write_source(iface, pIBitmapSource, prc,
+ This->format ? This->format->guid : NULL, This->width,
This->height,
+ This->xres, This->yres);
if (SUCCEEDED(hr))
{
- hr = IWICBitmapFrameEncode_WritePixels(iface, prc->Height, stride,
- stride*prc->Height, pixeldata);
- }
-
- HeapFree(GetProcessHeap(), 0, pixeldata);
-
- return S_OK;
+ hr = write_source(iface, pIBitmapSource, prc,
+ This->format->guid, This->format->bpp, This->width,
This->height);
+ }
+
+ return hr;
}
static HRESULT WINAPI TiffFrameEncode_Commit(IWICBitmapFrameEncode *iface)
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] Wed Oct 8 19:30:33 2014
@@ -60,6 +60,7 @@
typedef void (__cdecl typeof(png_set_error_fn))(struct png_struct_def *, void *,
png_error_ptr_1, png_error_ptr_1);
typedef void (__cdecl typeof(png_set_expand_gray_1_2_4_to_8))(struct png_struct_def *);
typedef void (__cdecl typeof(png_set_filler))(struct png_struct_def *, unsigned int,
int);
+typedef int (__cdecl typeof(png_set_interlace_handling))(struct png_struct_def *);
typedef void (__cdecl typeof(png_set_gray_to_rgb))(struct png_struct_def *);
typedef void (__cdecl typeof(png_set_IHDR))(struct png_struct_def *, struct png_info_def
*, unsigned int, unsigned int, int, int, int, int, int);
typedef void (__cdecl typeof(png_set_pHYs))(struct png_struct_def *, struct png_info_def
*, unsigned int, unsigned int, int);
Modified: trunk/reactos/dll/win32/windowscodecs/ungif.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/un…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/ungif.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/ungif.c [iso-8859-1] Wed Oct 8 19:30:33 2014
@@ -405,10 +405,7 @@
GifFile->Image.Interlace = (Buf[0] & 0x40);
if (Buf[0] & 0x80) { /* Does this image have local color map? */
- /*** FIXME: Why do we check both of these in order to do this?
- * Why do we have both Image and SavedImages? */
- if (GifFile->Image.ColorMap && GifFile->SavedImages == NULL)
- FreeMapObject(GifFile->Image.ColorMap);
+ FreeMapObject(GifFile->Image.ColorMap);
GifFile->Image.ColorMap = MakeMapObject(1 << BitsPerPixel, NULL);
if (GifFile->Image.ColorMap == NULL) {
Modified: trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/wi…
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h [iso-8859-1] Wed Oct 8
19:30:33 2014
@@ -126,6 +126,16 @@
UINT srcwidth, UINT srcheight, INT srcstride,
const WICRect *rc, UINT dststride, UINT dstbuffersize, BYTE *dstbuffer)
DECLSPEC_HIDDEN;
+extern HRESULT configure_write_source(IWICBitmapFrameEncode *iface,
+ IWICBitmapSource *source, const WICRect *prc,
+ const WICPixelFormatGUID *format,
+ INT width, INT height, double xres, double yres) DECLSPEC_HIDDEN;
+
+extern HRESULT write_source(IWICBitmapFrameEncode *iface,
+ IWICBitmapSource *source, const WICRect *prc,
+ const WICPixelFormatGUID *format, UINT bpp,
+ INT width, INT height) DECLSPEC_HIDDEN;
+
extern void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT
stride) DECLSPEC_HIDDEN;
extern HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp) DECLSPEC_HIDDEN;
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] Wed Oct 8 19:30:33 2014
@@ -208,7 +208,7 @@
reactos/dll/win32/wbemdisp # Synced to Wine-1.7.17
reactos/dll/win32/wbemprox # Synced to Wine-1.7.27
reactos/dll/win32/wer # Autosync
-reactos/dll/win32/windowscodecs # Synced to Wine-1.7.17
+reactos/dll/win32/windowscodecs # Synced to Wine-1.7.27
reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.17
reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.17
reactos/dll/win32/wing32 # Out of sync