const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
return copy_pixels(This->bpp, This->data, This->width, This->height,
This->stride, prc, cbStride, cbBufferSize, pbBuffer);
BitmapLockImpl *result;
WICRect rc;
- TRACE("(%p,%p,%x,%p)\n", iface, prcLock, flags, ppILock);
+ TRACE("(%p,%s,%x,%p)\n", iface, debug_wic_rect(prcLock), flags, ppILock);
if (!(flags & (WICBitmapLockRead|WICBitmapLockWrite)) || !ppILock)
return E_INVALIDARG;
*format = 0;
- for (i = 0; i < sizeof(pixel_fmt_map)/sizeof(pixel_fmt_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(pixel_fmt_map); i++)
{
if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat))
{
BmpDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
HRESULT hr=S_OK;
UINT width, height;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
EnterCriticalSection(&This->lock);
if (!This->imagedata)
if (!This->initialized || This->bits) return WINCODEC_ERR_WRONGSTATE;
+ if (IsEqualGUID(pPixelFormat, &GUID_WICPixelFormatBlackWhite))
+ *pPixelFormat = GUID_WICPixelFormat1bppIndexed;
+ else if (IsEqualGUID(pPixelFormat, &GUID_WICPixelFormat2bppIndexed))
+ *pPixelFormat = GUID_WICPixelFormat4bppIndexed;
+
for (i=0; formats[i].guid; i++)
{
if (IsEqualGUID(formats[i].guid, pPixelFormat))
}
if (!formats[i].guid) i = 0;
- else if (IsEqualGUID(pPixelFormat, &GUID_WICPixelFormatBlackWhite))
- i = 2; /* GUID_WICPixelFormat1bppIndexed */
This->format = &formats[i];
memcpy(pPixelFormat, This->format->guid, sizeof(GUID));
{
BmpFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
+ TRACE("(%p,%p,%s)\n", iface, pIBitmapSource, debug_wic_rect(prc));
if (!This->initialized)
return WINCODEC_ERR_WRONGSTATE;
static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
GUID *pguidContainerFormat)
{
+ TRACE("(%p,%p)\n", iface, pguidContainerFormat);
+
+ if (!pguidContainerFormat)
+ return E_INVALIDARG;
+
memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID));
return S_OK;
}
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr)) return hr;
}
BitmapClipper *This = impl_from_IWICBitmapClipper(iface);
WICRect rect;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, buffer_size, buffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(rc), stride, buffer_size, buffer);
if (!This->source)
return WINCODEC_ERR_WRONGSTATE;
UINT width, height;
HRESULT hr = S_OK;
- TRACE("(%p,%p,%p)\n", iface, source, rc);
+ TRACE("(%p,%p,%s)\n", iface, source, debug_wic_rect(rc));
EnterCriticalSection(&This->lock);
} classinfo;
static const classinfo wic_classes[] = {
- {&CLSID_WICImagingFactory, ComponentFactory_CreateInstance},
+ {&CLSID_WICImagingFactory, ImagingFactory_CreateInstance},
+ {&CLSID_WICImagingFactory2, ImagingFactory_CreateInstance},
{&CLSID_WICBmpDecoder, BmpDecoder_CreateInstance},
{&CLSID_WICPngDecoder, PngDecoder_CreateInstance},
{&CLSID_WICPngEncoder, PngEncoder_CreateInstance},
const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
ColorTransform *This = impl_from_IWICColorTransform(iface);
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
return IWICBitmapSource_CopyPixels(This->dst, prc, cbStride, cbBufferSize, pbBuffer);
}
FormatConverter *This = impl_from_IWICFormatConverter(iface);
WICRect rc;
HRESULT hr;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
if (This->source)
{
WICRect rc;
WICRect rect;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
if (!This->source) return WINCODEC_ERR_WRONGSTATE;
const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
GifFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
if (This->frame->ImageDesc.Interlace)
{
IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
+ TRACE("(%p,%p,%s)\n", iface, pIBitmapSource, debug_wic_rect(prc));
if (!This->initialized)
return WINCODEC_ERR_WRONGSTATE;
const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
IcoFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
return copy_pixels(32, This->bits, This->width, This->height, This->width * 4,
prc, cbStride, cbBufferSize, pbBuffer);
LARGE_INTEGER seek;
HRESULT hr;
ULONG bytesread;
+ STATSTG statstg;
+ unsigned int i;
+
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions);
EnterCriticalSection(&This->lock);
hr = IStream_Read(pIStream, &This->header, sizeof(ICONHEADER), &bytesread);
if (FAILED(hr)) goto end;
- if (bytesread != sizeof(ICONHEADER) ||
- This->header.idReserved != 0 ||
+
+ if (bytesread != sizeof(ICONHEADER))
+ {
+ hr = WINCODEC_ERR_STREAMREAD;
+ goto end;
+ }
+
+ if (This->header.idReserved != 0 ||
This->header.idType != 1)
{
hr = E_FAIL;
goto end;
}
+ hr = IStream_Stat(pIStream, &statstg, STATFLAG_NONAME);
+ if (FAILED(hr))
+ {
+ WARN("Stat() failed, hr %#x.\n", hr);
+ goto end;
+ }
+
+ for (i = 0; i < This->header.idCount; i++)
+ {
+ ICONDIRENTRY direntry;
+
+ hr = IStream_Read(pIStream, &direntry, sizeof(direntry), &bytesread);
+ if (FAILED(hr)) goto end;
+
+ if (bytesread != sizeof(direntry) || (direntry.dwDIBSize + direntry.dwDIBOffset > statstg.cbSize.QuadPart))
+ {
+ hr = WINCODEC_ERR_BADIMAGE;
+ goto end;
+ }
+ }
+
This->initialized = TRUE;
This->stream = pIStream;
IStream_AddRef(pIStream);
#include "config.h"
+#include <assert.h>
#include <stdarg.h>
#define COBJMACROS
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef struct {
+ IWICImagingFactory2 IWICImagingFactory2_iface;
IWICComponentFactory IWICComponentFactory_iface;
LONG ref;
-} ComponentFactory;
+} ImagingFactory;
-static inline ComponentFactory *impl_from_IWICComponentFactory(IWICComponentFactory *iface)
+static inline ImagingFactory *impl_from_IWICComponentFactory(IWICComponentFactory *iface)
{
- return CONTAINING_RECORD(iface, ComponentFactory, IWICComponentFactory_iface);
+ return CONTAINING_RECORD(iface, ImagingFactory, IWICComponentFactory_iface);
}
-static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, REFIID iid,
+static inline ImagingFactory *impl_from_IWICImagingFactory2(IWICImagingFactory2 *iface)
+{
+ return CONTAINING_RECORD(iface, ImagingFactory, IWICImagingFactory2_iface);
+}
+
+static HRESULT WINAPI ImagingFactory_QueryInterface(IWICImagingFactory2 *iface, REFIID iid,
void **ppv)
{
- ComponentFactory *This = impl_from_IWICComponentFactory(iface);
+ ImagingFactory *This = impl_from_IWICImagingFactory2(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
{
*ppv = &This->IWICComponentFactory_iface;
}
+ else if (IsEqualIID(&IID_IWICImagingFactory2, iid))
+ {
+ *ppv = &This->IWICImagingFactory2_iface;
+ }
else
{
*ppv = NULL;
return S_OK;
}
-static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
+static ULONG WINAPI ImagingFactory_AddRef(IWICImagingFactory2 *iface)
{
- ComponentFactory *This = impl_from_IWICComponentFactory(iface);
+ ImagingFactory *This = impl_from_IWICImagingFactory2(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
return ref;
}
-static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
+static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory2 *iface)
{
- ComponentFactory *This = impl_from_IWICComponentFactory(iface);
+ ImagingFactory *This = impl_from_IWICImagingFactory2(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
return ref;
}
-static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(
- IWICComponentFactory *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
+static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename(
+ IWICImagingFactory2 *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
DWORD dwDesiredAccess, WICDecodeOptions metadataOptions,
IWICBitmapDecoder **ppIDecoder)
{
if (SUCCEEDED(hr))
{
- hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream,
+ hr = IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream,
pguidVendor, metadataOptions, ppIDecoder);
}
IWICBitmapDecoder_Release(*decoder);
IWICBitmapDecoderInfo_Release(decoderinfo);
IUnknown_Release(unkdecoderinfo);
+ IEnumUnknown_Release(enumdecoders);
*decoder = NULL;
return res;
}
return WINCODEC_ERR_COMPONENTNOTFOUND;
}
-static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(
- IWICComponentFactory *iface, IStream *pIStream, const GUID *pguidVendor,
+static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
+ IWICImagingFactory2 *iface, IStream *pIStream, const GUID *pguidVendor,
WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
{
HRESULT res;
}
}
-static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle(
- IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor,
+static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle(
+ IWICImagingFactory2 *iface, ULONG_PTR hFile, const GUID *pguidVendor,
WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
{
IWICStream *stream;
hr = stream_initialize_from_filehandle(stream, (HANDLE)hFile);
if (SUCCEEDED(hr))
{
- hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream,
+ hr = IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream,
pguidVendor, metadataOptions, ppIDecoder);
}
IWICStream_Release(stream);
return hr;
}
-static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateComponentInfo(IWICImagingFactory2 *iface,
REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
{
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
return CreateComponentInfo(clsidComponent, ppIInfo);
}
-static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateDecoder(IWICImagingFactory2 *iface,
REFGUID guidContainerFormat, const GUID *pguidVendor,
IWICBitmapDecoder **ppIDecoder)
{
return WINCODEC_ERR_COMPONENTNOTFOUND;
}
-static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateEncoder(IWICImagingFactory2 *iface,
REFGUID guidContainerFormat, const GUID *pguidVendor,
IWICBitmapEncoder **ppIEncoder)
{
}
}
-static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreatePalette(IWICImagingFactory2 *iface,
IWICPalette **ppIPalette)
{
TRACE("(%p,%p)\n", iface, ppIPalette);
return PaletteImpl_Create(ppIPalette);
}
-static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateFormatConverter(IWICImagingFactory2 *iface,
IWICFormatConverter **ppIFormatConverter)
{
return FormatConverter_CreateInstance(&IID_IWICFormatConverter, (void**)ppIFormatConverter);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapScaler(IWICImagingFactory2 *iface,
IWICBitmapScaler **ppIBitmapScaler)
{
TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
return BitmapScaler_Create(ppIBitmapScaler);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapClipper(IWICImagingFactory2 *iface,
IWICBitmapClipper **ppIBitmapClipper)
{
TRACE("(%p,%p)\n", iface, ppIBitmapClipper);
return BitmapClipper_Create(ppIBitmapClipper);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapFlipRotator(IWICImagingFactory2 *iface,
IWICBitmapFlipRotator **ppIBitmapFlipRotator)
{
TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
return FlipRotator_Create(ppIBitmapFlipRotator);
}
-static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateStream(IWICImagingFactory2 *iface,
IWICStream **ppIWICStream)
{
TRACE("(%p,%p)\n", iface, ppIWICStream);
return StreamImpl_Create(ppIWICStream);
}
-static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateColorContext(IWICImagingFactory2 *iface,
IWICColorContext **ppIColorContext)
{
TRACE("(%p,%p)\n", iface, ppIColorContext);
return ColorContext_Create(ppIColorContext);
}
-static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateColorTransformer(IWICImagingFactory2 *iface,
IWICColorTransform **ppIColorTransform)
{
TRACE("(%p,%p)\n", iface, ppIColorTransform);
return ColorTransform_Create(ppIColorTransform);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmap(IWICImagingFactory2 *iface,
UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
{
return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, 0, pixelFormat, option, ppIBitmap);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory *iface,
- IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
- IWICBitmap **ppIBitmap)
+static HRESULT create_bitmap_from_source_rect(IWICBitmapSource *piBitmapSource, const WICRect *rect,
+ WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
{
IWICBitmap *result;
IWICBitmapLock *lock;
IWICPixelFormatInfo2 *formatinfo;
WICPixelFormatNumericRepresentation format_type;
- TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
+ assert(!rect || option == WICBitmapCacheOnLoad);
if (!piBitmapSource || !ppIBitmap)
return E_INVALIDARG;
+ if (option == WICBitmapNoCache && SUCCEEDED(IWICBitmapSource_QueryInterface(piBitmapSource,
+ &IID_IWICBitmap, (void **)&result)))
+ {
+ *ppIBitmap = result;
+ return S_OK;
+ }
+
hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
+ if (SUCCEEDED(hr) && rect)
+ {
+ if (rect->X >= width || rect->Y >= height || rect->Width == 0 || rect->Height == 0)
+ return E_INVALIDARG;
+
+ width = min(width - rect->X, rect->Width);
+ height = min(height - rect->Y, rect->Height);
+ }
+
if (SUCCEEDED(hr))
hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
{
UINT stride, buffersize;
BYTE *buffer;
- rc.X = rc.Y = 0;
+
+ if (rect)
+ {
+ rc.X = rect->X;
+ rc.Y = rect->Y;
+ }
+ else
+ rc.X = rc.Y = 0;
rc.Width = width;
rc.Height = height;
return hr;
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapFromSource(IWICImagingFactory2 *iface,
+ IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
+ IWICBitmap **ppIBitmap)
+{
+ TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
+
+ return create_bitmap_from_source_rect(piBitmapSource, NULL, option, ppIBitmap);
+}
+
+static HRESULT WINAPI ImagingFactory_CreateBitmapFromSourceRect(IWICImagingFactory2 *iface,
IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
IWICBitmap **ppIBitmap)
{
- FIXME("(%p,%p,%u,%u,%u,%u,%p): stub\n", iface, piBitmapSource, x, y, width,
+ WICRect rect;
+
+ TRACE("(%p,%p,%u,%u,%u,%u,%p)\n", iface, piBitmapSource, x, y, width,
height, ppIBitmap);
- return E_NOTIMPL;
+
+ rect.X = x;
+ rect.Y = y;
+ rect.Width = width;
+ rect.Height = height;
+
+ return create_bitmap_from_source_rect(piBitmapSource, &rect, WICBitmapCacheOnLoad, ppIBitmap);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapFromMemory(IWICImagingFactory2 *iface,
UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride,
UINT size, BYTE *buffer, IWICBitmap **bitmap)
{
return ret;
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapFromHBITMAP(IWICImagingFactory2 *iface,
HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap)
{
BITMAP bm;
return hr;
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *iface,
HICON hicon, IWICBitmap **bitmap)
{
IWICBitmapLock *lock;
return hr;
}
-static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateComponentEnumerator(IWICImagingFactory2 *iface,
DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
{
TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
}
-static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(
- IWICComponentFactory *iface, IWICBitmapDecoder *pIDecoder,
+static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder(
+ IWICImagingFactory2 *iface, IWICBitmapDecoder *pIDecoder,
IWICFastMetadataEncoder **ppIFastEncoder)
{
FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
return E_NOTIMPL;
}
-static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(
- IWICComponentFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
+static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode(
+ IWICImagingFactory2 *iface, IWICBitmapFrameDecode *pIFrameDecoder,
IWICFastMetadataEncoder **ppIFastEncoder)
{
FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
return E_NOTIMPL;
}
-static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateQueryWriter(IWICImagingFactory2 *iface,
REFGUID guidMetadataFormat, const GUID *pguidVendor,
IWICMetadataQueryWriter **ppIQueryWriter)
{
return E_NOTIMPL;
}
-static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader(IWICImagingFactory2 *iface,
IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor,
IWICMetadataQueryWriter **ppIQueryWriter)
{
return E_NOTIMPL;
}
+#ifndef __REACTOS__
+static HRESULT WINAPI ImagingFactory_CreateImageEncoder(IWICImagingFactory2 *iface, ID2D1Device *device, IWICImageEncoder **encoder)
+{
+ FIXME("%p,%p,%p stub.\n", iface, device, encoder);
+ return E_NOTIMPL;
+}
+#endif
+
+static const IWICImagingFactory2Vtbl ImagingFactory_Vtbl = {
+ ImagingFactory_QueryInterface,
+ ImagingFactory_AddRef,
+ ImagingFactory_Release,
+ ImagingFactory_CreateDecoderFromFilename,
+ ImagingFactory_CreateDecoderFromStream,
+ ImagingFactory_CreateDecoderFromFileHandle,
+ ImagingFactory_CreateComponentInfo,
+ ImagingFactory_CreateDecoder,
+ ImagingFactory_CreateEncoder,
+ ImagingFactory_CreatePalette,
+ ImagingFactory_CreateFormatConverter,
+ ImagingFactory_CreateBitmapScaler,
+ ImagingFactory_CreateBitmapClipper,
+ ImagingFactory_CreateBitmapFlipRotator,
+ ImagingFactory_CreateStream,
+ ImagingFactory_CreateColorContext,
+ ImagingFactory_CreateColorTransformer,
+ ImagingFactory_CreateBitmap,
+ ImagingFactory_CreateBitmapFromSource,
+ ImagingFactory_CreateBitmapFromSourceRect,
+ ImagingFactory_CreateBitmapFromMemory,
+ ImagingFactory_CreateBitmapFromHBITMAP,
+ ImagingFactory_CreateBitmapFromHICON,
+ ImagingFactory_CreateComponentEnumerator,
+ ImagingFactory_CreateFastMetadataEncoderFromDecoder,
+ ImagingFactory_CreateFastMetadataEncoderFromFrameDecode,
+ ImagingFactory_CreateQueryWriter,
+ ImagingFactory_CreateQueryWriterFromReader,
+#ifndef __REACTOS__
+ ImagingFactory_CreateImageEncoder,
+#endif
+};
+
+static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, REFIID iid, void **ppv)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, ppv);
+}
+
+static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_AddRef(&This->IWICImagingFactory2_iface);
+}
+
+static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(IWICComponentFactory *iface, LPCWSTR filename,
+ const GUID *vendor, DWORD desired_access, WICDecodeOptions options, IWICBitmapDecoder **decoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoderFromFilename(&This->IWICImagingFactory2_iface, filename, vendor,
+ desired_access, options, decoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(IWICComponentFactory *iface, IStream *stream,
+ const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder **decoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoderFromStream(&This->IWICImagingFactory2_iface, stream, vendor,
+ options, decoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle(IWICComponentFactory *iface, ULONG_PTR hFile,
+ const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder **decoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoderFromFileHandle(&This->IWICImagingFactory2_iface, hFile, vendor,
+ options, decoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface, REFCLSID component,
+ IWICComponentInfo **info)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateComponentInfo(&This->IWICImagingFactory2_iface, component, info);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface, REFGUID format, const GUID *vendor,
+ IWICBitmapDecoder **decoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoder(&This->IWICImagingFactory2_iface, format, vendor, decoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface, REFGUID format, const GUID *vendor,
+ IWICBitmapEncoder **encoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateEncoder(&This->IWICImagingFactory2_iface, format, vendor, encoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface, IWICPalette **palette)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreatePalette(&This->IWICImagingFactory2_iface, palette);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface, IWICFormatConverter **converter)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateFormatConverter(&This->IWICImagingFactory2_iface, converter);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface, IWICBitmapScaler **scaler)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapScaler(&This->IWICImagingFactory2_iface, scaler);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface, IWICBitmapClipper **clipper)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapClipper(&This->IWICImagingFactory2_iface, clipper);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory *iface, IWICBitmapFlipRotator **fliprotator)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFlipRotator(&This->IWICImagingFactory2_iface, fliprotator);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface, IWICStream **stream)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateStream(&This->IWICImagingFactory2_iface, stream);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *iface, IWICColorContext **context)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateColorContext(&This->IWICImagingFactory2_iface, context);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface, IWICColorTransform **transformer)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateColorTransformer(&This->IWICImagingFactory2_iface, transformer);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface, UINT width, UINT height, REFWICPixelFormatGUID pixel_format,
+ WICBitmapCreateCacheOption option, IWICBitmap **bitmap)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmap(&This->IWICImagingFactory2_iface, width, height, pixel_format, option, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory *iface, IWICBitmapSource *source,
+ WICBitmapCreateCacheOption option, IWICBitmap **bitmap)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromSource(&This->IWICImagingFactory2_iface, source, option, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface, IWICBitmapSource *source,
+ UINT x, UINT y, UINT width, UINT height, IWICBitmap **bitmap)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromSourceRect(&This->IWICImagingFactory2_iface, source, x, y, width, height, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory *iface, UINT width, UINT height,
+ REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromMemory(&This->IWICImagingFactory2_iface, width, height, format, stride,
+ size, buffer, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface, HBITMAP hbm, HPALETTE hpal,
+ WICBitmapAlphaChannelOption option, IWICBitmap **bitmap)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromHBITMAP(&This->IWICImagingFactory2_iface, hbm, hpal, option, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface, HICON hicon, IWICBitmap **bitmap)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromHICON(&This->IWICImagingFactory2_iface, hicon, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface, DWORD component_types,
+ DWORD options, IEnumUnknown **enumerator)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateComponentEnumerator(&This->IWICImagingFactory2_iface, component_types,
+ options, enumerator);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(IWICComponentFactory *iface, IWICBitmapDecoder *decoder,
+ IWICFastMetadataEncoder **encoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateFastMetadataEncoderFromDecoder(&This->IWICImagingFactory2_iface, decoder, encoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(IWICComponentFactory *iface,
+ IWICBitmapFrameDecode *frame_decode, IWICFastMetadataEncoder **encoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateFastMetadataEncoderFromFrameDecode(&This->IWICImagingFactory2_iface, frame_decode, encoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory *iface, REFGUID format, const GUID *vendor,
+ IWICMetadataQueryWriter **writer)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateQueryWriter(&This->IWICImagingFactory2_iface, format, vendor, writer);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface, IWICMetadataQueryReader *reader,
+ const GUID *vendor, IWICMetadataQueryWriter **writer)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateQueryWriterFromReader(&This->IWICImagingFactory2_iface, reader, vendor, writer);
+}
+
static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory *iface,
REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
{
ComponentFactory_CreateEncoderPropertyBag
};
-HRESULT ComponentFactory_CreateInstance(REFIID iid, void** ppv)
+HRESULT ImagingFactory_CreateInstance(REFIID iid, void** ppv)
{
- ComponentFactory *This;
+ ImagingFactory *This;
HRESULT ret;
TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
*ppv = NULL;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory));
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return E_OUTOFMEMORY;
+ This->IWICImagingFactory2_iface.lpVtbl = &ImagingFactory_Vtbl;
This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
This->ref = 1;
- ret = IWICComponentFactory_QueryInterface(&This->IWICComponentFactory_iface, iid, ppv);
- IWICComponentFactory_Release(&This->IWICComponentFactory_iface);
+ ret = IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, ppv);
+ IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
return ret;
}
static inline BitmapDecoderInfo *impl_from_IWICBitmapDecoderInfo(IWICBitmapDecoderInfo *iface)
{
- return CONTAINING_RECORD(iface, BitmapDecoderInfo, base.IWICComponentInfo_iface);
+ return CONTAINING_RECORD((IWICComponentInfo*)iface, BitmapDecoderInfo, base.IWICComponentInfo_iface);
}
static HRESULT WINAPI BitmapDecoderInfo_QueryInterface(IWICBitmapDecoderInfo *iface, REFIID iid,
static inline BitmapEncoderInfo *impl_from_IWICBitmapEncoderInfo(IWICBitmapEncoderInfo *iface)
{
- return CONTAINING_RECORD(iface, BitmapEncoderInfo, base.IWICComponentInfo_iface);
+ return CONTAINING_RECORD((IWICComponentInfo*)iface, BitmapEncoderInfo, base.IWICComponentInfo_iface);
}
static HRESULT WINAPI BitmapEncoderInfo_QueryInterface(IWICBitmapEncoderInfo *iface, REFIID iid,
static inline FormatConverterInfo *impl_from_IWICFormatConverterInfo(IWICFormatConverterInfo *iface)
{
- return CONTAINING_RECORD(iface, FormatConverterInfo, base.IWICComponentInfo_iface);
+ return CONTAINING_RECORD((IWICComponentInfo*)iface, FormatConverterInfo, base.IWICComponentInfo_iface);
}
static HRESULT WINAPI FormatConverterInfo_QueryInterface(IWICFormatConverterInfo *iface, REFIID iid,
static inline PixelFormatInfo *impl_from_IWICPixelFormatInfo2(IWICPixelFormatInfo2 *iface)
{
- return CONTAINING_RECORD(iface, PixelFormatInfo, base.IWICComponentInfo_iface);
+ return CONTAINING_RECORD((IWICComponentInfo*)iface, PixelFormatInfo, base.IWICComponentInfo_iface);
}
static HRESULT WINAPI PixelFormatInfo_QueryInterface(IWICPixelFormatInfo2 *iface, REFIID iid,
static inline MetadataReaderInfo *impl_from_IWICMetadataReaderInfo(IWICMetadataReaderInfo *iface)
{
- return CONTAINING_RECORD(iface, MetadataReaderInfo, base.IWICComponentInfo_iface);
+ return CONTAINING_RECORD((IWICComponentInfo*)iface, MetadataReaderInfo, base.IWICComponentInfo_iface);
}
static HRESULT WINAPI MetadataReaderInfo_QueryInterface(IWICMetadataReaderInfo *iface,
static HRESULT WINAPI JpegDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
IWICMetadataQueryReader **reader)
{
- FIXME("(%p,%p): stub\n", iface, reader);
+ TRACE("(%p,%p)\n", iface, reader);
if (!reader) return E_INVALIDARG;
{
JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
return copy_pixels(This->bpp, This->image_data,
This->cinfo.output_width, This->cinfo.output_height, This->stride,
{
JpegEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
+ TRACE("(%p,%p,%s)\n", iface, pIBitmapSource, debug_wic_rect(prc));
if (!This->frame_initialized)
return WINCODEC_ERR_WRONGSTATE;
return S_OK;
}
-static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format)
{
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
+ TRACE("(%p,%p)\n", iface, format);
+
+ if (!format)
+ return E_INVALIDARG;
+
+ memcpy(format, &GUID_ContainerFormatJpeg, sizeof(*format));
+ return S_OK;
}
static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info)
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
if (dststride < bytesperrow)
return E_INVALIDARG;
- if ((dststride * (rc->Height-1)) + ((rc->Width * bpp) + 7)/8 > dstbuffersize)
+ if ((dststride * (rc->Height-1)) + bytesperrow > dstbuffersize)
return E_INVALIDARG;
/* if the whole bitmap is copied and the buffer format matches then it's a matter of a single memcpy */
if (FAILED(hr))
{
ERR("Failed to convert source, target format %s, %#x\n", debugstr_guid(format), hr);
- return hr;
+ return E_NOTIMPL;
}
stride = (bpp * width + 7)/8;
{
UINT i;
- for (i = 0; i < sizeof(str2vt)/sizeof(str2vt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(str2vt); i++)
{
if (str2vt[i].len == str->len)
{
PropVariantClear(&tk_id);
PropVariantClear(&tk_schema);
- if (hr == S_OK)
+ if (hr == S_OK && value)
*value = new_value;
else
PropVariantClear(&new_value);
if (!guid) return E_INVALIDARG;
- for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid2name); i++)
{
if (IsEqualGUID(guid, guid2name[i].guid))
{
if (!name || !guid) return E_INVALIDARG;
- for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid2name); i++)
{
if (!lstrcmpiW(name, guid2name[i].name))
{
!IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
return NULL;
- for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(name2schema); i++)
{
if (!lstrcmpW(name2schema[i].name, name))
return name2schema[i].schema;
!IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
return WINCODEC_ERR_PROPERTYNOTFOUND;
- for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(name2schema); i++)
{
if (!lstrcmpW(name2schema[i].schema, schema))
{
else
rgb24_source = source;
- hr = ComponentFactory_CreateInstance(&IID_IWICImagingFactory, (void **)&factory);
+ hr = ImagingFactory_CreateInstance(&IID_IWICImagingFactory, (void **)&factory);
if (hr != S_OK) goto fail;
hr = IWICImagingFactory_CreateBitmapFromSource(factory, rgb24_source, WICBitmapCacheOnLoad, &rgb24_bitmap);
static HRESULT WINAPI PngDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
IWICMetadataQueryReader **reader)
{
- FIXME("(%p,%p): stub\n", iface, reader);
+ TRACE("(%p,%p)\n", iface, reader);
if (!reader) return E_INVALIDARG;
png_palette[i].blue);
}
}
- else if (color_type == PNG_COLOR_TYPE_GRAY) {
+ else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth <= 8) {
ret = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans_alpha, &num_trans, &trans_values);
if (!ret)
const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
PngDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
return copy_pixels(This->bpp, This->image_bits,
This->width, This->height, This->stride,
This->metadata_blocks[nIndex].ofs, This->metadata_blocks[nIndex].len);
if (SUCCEEDED(hr))
- hr = ComponentFactory_CreateInstance(&IID_IWICComponentFactory, (void**)&factory);
+ hr = ImagingFactory_CreateInstance(&IID_IWICComponentFactory, (void**)&factory);
if (SUCCEEDED(hr))
{
if (pIEncoderOptions)
{
- hr = IPropertyBag2_Read(pIEncoderOptions, sizeof(opts)/sizeof(opts[0]), opts, NULL, opt_values, opt_hres);
+ hr = IPropertyBag2_Read(pIEncoderOptions, ARRAY_SIZE(opts), opts, NULL, opt_values, opt_hres);
if (FAILED(hr))
return hr;
{
PngEncoder *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
+ TRACE("(%p,%p,%s)\n", iface, pIBitmapSource, debug_wic_rect(prc));
if (!This->frame_initialized)
return WINCODEC_ERR_WRONGSTATE;
return S_OK;
}
-static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format)
{
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
+ TRACE("(%p,%p)\n", iface, format);
+
+ if (!format)
+ return E_INVALIDARG;
+
+ memcpy(format, &GUID_ContainerFormatPng, sizeof(*format));
+ return S_OK;
}
static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info)
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
return IWICStream_InitializeFromMemory(iface, pbBuffer, cbBufferSize);
}
+HRESULT WINAPI IWICPixelFormatInfo_GetBitsPerPixel_Proxy_W(IWICPixelFormatInfo *iface, UINT *bpp)
+{
+ return IWICPixelFormatInfo_GetBitsPerPixel(iface, bpp);
+}
+
+HRESULT WINAPI IWICPixelFormatInfo_GetChannelCount_Proxy_W(IWICPixelFormatInfo *iface, UINT *count)
+{
+ return IWICPixelFormatInfo_GetChannelCount(iface, count);
+}
+
+HRESULT WINAPI IWICPixelFormatInfo_GetChannelMask_Proxy_W(IWICPixelFormatInfo *iface, UINT channel, UINT buffer_size, BYTE *buffer, UINT *actual)
+{
+ return IWICPixelFormatInfo_GetChannelMask(iface, channel, buffer_size, buffer, actual);
+}
+
HRESULT WINAPI WICCreateColorContext_Proxy(IWICImagingFactory *iface, IWICColorContext **ppIWICColorContext)
{
TRACE("%p, %p\n", iface, ppIWICColorContext);
{
TRACE("%x, %p\n", SDKVersion, ppIImagingFactory);
- return ComponentFactory_CreateInstance(&IID_IWICImagingFactory, (void**)ppIImagingFactory);
+ return ImagingFactory_CreateInstance(&IID_IWICImagingFactory, (void**)ppIImagingFactory);
}
HRESULT WINAPI WICSetEncoderFormat_Proxy(IWICBitmapSource *pSourceIn,
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
if (list->channelmasks) {
+ static const WCHAR valuename_format[] = {'%','d',0};
HKEY masks_key;
UINT i, mask_size;
WCHAR mask_valuename[11];
- const WCHAR valuename_format[] = {'%','d',0};
mask_size = (list->bitsperpixel + 7)/8;
&GUID_WICPixelFormat32bppBGR,
&GUID_WICPixelFormatBlackWhite,
&GUID_WICPixelFormat1bppIndexed,
- &GUID_WICPixelFormat2bppIndexed,
&GUID_WICPixelFormat4bppIndexed,
&GUID_WICPixelFormat8bppIndexed,
NULL
&GUID_WICPixelFormat4bppGray,
&GUID_WICPixelFormat8bppGray,
&GUID_WICPixelFormat1bppIndexed,
- &GUID_WICPixelFormat2bppIndexed,
&GUID_WICPixelFormat4bppIndexed,
&GUID_WICPixelFormat8bppIndexed,
&GUID_WICPixelFormat24bppBGR,
BitmapScaler *This = impl_from_IWICBitmapScaler(iface);
TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
+ if (!This->source)
+ return WINCODEC_ERR_NOTINITIALIZED;
+
if (!puiWidth || !puiHeight)
return E_INVALIDARG;
- if (!This->source)
- return WINCODEC_ERR_WRONGSTATE;
-
*puiWidth = This->width;
*puiHeight = This->height;
return E_INVALIDARG;
if (!This->source)
- return WINCODEC_ERR_WRONGSTATE;
+ {
+ memcpy(pPixelFormat, &GUID_WICPixelFormatDontCare, sizeof(*pPixelFormat));
+ return S_OK;
+ }
return IWICBitmapSource_GetPixelFormat(This->source, pPixelFormat);
}
BitmapScaler *This = impl_from_IWICBitmapScaler(iface);
TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
+ if (!This->source)
+ return WINCODEC_ERR_NOTINITIALIZED;
+
if (!pDpiX || !pDpiY)
return E_INVALIDARG;
- if (!This->source)
- return WINCODEC_ERR_WRONGSTATE;
-
return IWICBitmapSource_GetResolution(This->source, pDpiX, pDpiY);
}
return E_INVALIDARG;
if (!This->source)
- return WINCODEC_ERR_WRONGSTATE;
+ return WINCODEC_ERR_PALETTEUNAVAILABLE;
return IWICBitmapSource_CopyPalette(This->source, pIPalette);
}
ULONG buffer_size;
UINT y;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
EnterCriticalSection(&This->lock);
TRACE("(%p,%p,%u,%u,%u)\n", iface, pISource, uiWidth, uiHeight, mode);
+ if (!pISource || !uiWidth || !uiHeight)
+ return E_INVALIDARG;
+
EnterCriticalSection(&This->lock);
if (This->source)
{
StreamOnMemory *This = StreamOnMemory_from_IStream(iface);
ULONG uBytesRead;
- TRACE("(%p)\n", This);
+
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
if (!pv) return E_INVALIDARG;
{
StreamOnMemory *This = StreamOnMemory_from_IStream(iface);
HRESULT hr;
- TRACE("(%p)\n", This);
+
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbWritten);
if (!pv) return E_INVALIDARG;
StreamOnMemory *This = StreamOnMemory_from_IStream(iface);
LARGE_INTEGER NewPosition;
HRESULT hr=S_OK;
- TRACE("(%p)\n", This);
+
+ TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
EnterCriticalSection(&This->lock);
if (dwOrigin == STREAM_SEEK_SET) NewPosition.QuadPart = dlibMove.QuadPart;
static HRESULT WINAPI StreamOnMemory_SetSize(IStream *iface,
ULARGE_INTEGER libNewSize)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s)\n", iface, wine_dbgstr_longlong(libNewSize.QuadPart));
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnMemory_CopyTo(IStream *iface,
IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %p, %s, %p, %p)\n", iface, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnMemory_Commit(IStream *iface,
DWORD grfCommitFlags)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %#x)\n", iface, grfCommitFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnMemory_LockRegion(IStream *iface,
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnMemory_UnlockRegion(IStream *iface,
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
return E_NOTIMPL;
}
STATSTG *pstatstg, DWORD grfStatFlag)
{
StreamOnMemory *This = StreamOnMemory_from_IStream(iface);
- TRACE("(%p)\n", This);
+ TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
if (!pstatstg) return E_INVALIDARG;
static HRESULT WINAPI StreamOnMemory_Clone(IStream *iface,
IStream **ppstm)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %p)\n", iface, ppstm);
return E_NOTIMPL;
}
void *pv, ULONG cb, ULONG *pcbRead)
{
StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface);
- TRACE("(%p)\n", This);
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
return IWICStream_Read(This->stream, pv, cb, pcbRead);
}
static HRESULT WINAPI StreamOnFileHandle_Write(IStream *iface,
void const *pv, ULONG cb, ULONG *pcbWritten)
{
- ERR("(%p)\n", iface);
+ ERR("(%p, %p, %u, %p)\n", iface, pv, cb, pcbWritten);
return HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED);
}
LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface);
- TRACE("(%p)\n", This);
+ TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
return IWICStream_Seek(This->stream, dlibMove, dwOrigin, plibNewPosition);
}
static HRESULT WINAPI StreamOnFileHandle_SetSize(IStream *iface,
ULARGE_INTEGER libNewSize)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s)\n", iface, wine_dbgstr_longlong(libNewSize.QuadPart));
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnFileHandle_CopyTo(IStream *iface,
IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %p, %s, %p, %p)\n", iface, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnFileHandle_Commit(IStream *iface,
DWORD grfCommitFlags)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %#x)\n", iface, grfCommitFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnFileHandle_LockRegion(IStream *iface,
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnFileHandle_UnlockRegion(IStream *iface,
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
return E_NOTIMPL;
}
STATSTG *pstatstg, DWORD grfStatFlag)
{
StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface);
- TRACE("(%p)\n", This);
+ TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
return IWICStream_Stat(This->stream, pstatstg, grfStatFlag);
}
static HRESULT WINAPI StreamOnFileHandle_Clone(IStream *iface,
IStream **ppstm)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %p)\n", iface, ppstm);
return E_NOTIMPL;
}
-
static const IStreamVtbl StreamOnFileHandle_Vtbl =
{
/*** IUnknown methods ***/
HRESULT hr;
ULARGE_INTEGER OldPosition;
LARGE_INTEGER SetPosition;
- TRACE("(%p)\n", This);
+
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
if (!pv) return E_INVALIDARG;
ULARGE_INTEGER OldPosition;
LARGE_INTEGER SetPosition;
ULONG uBytesWritten=0;
- TRACE("(%p)\n", This);
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbWritten);
if (!pv) return E_INVALIDARG;
ULARGE_INTEGER NewPosition, actual_size;
HRESULT hr=S_OK;
STATSTG statstg;
- TRACE("(%p)\n", This);
+ TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
EnterCriticalSection(&This->lock);
actual_size = This->max_size;
static HRESULT WINAPI StreamOnStreamRange_SetSize(IStream *iface,
ULARGE_INTEGER libNewSize)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s)\n", iface, wine_dbgstr_longlong(libNewSize.QuadPart));
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnStreamRange_CopyTo(IStream *iface,
IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %p, %s, %p, %p)\n", iface, pstm, wine_dbgstr_longlong(cb.QuadPart),
+ pcbRead, pcbWritten);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnStreamRange_Commit(IStream *iface,
DWORD grfCommitFlags)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %#x)\n", iface, grfCommitFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnStreamRange_LockRegion(IStream *iface,
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
return E_NOTIMPL;
}
static HRESULT WINAPI StreamOnStreamRange_UnlockRegion(IStream *iface,
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
return E_NOTIMPL;
}
{
StreamOnStreamRange *This = StreamOnStreamRange_from_IStream(iface);
HRESULT hr;
- TRACE("(%p)\n", This);
+ TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
if (!pstatstg) return E_INVALIDARG;
static HRESULT WINAPI StreamOnStreamRange_Clone(IStream *iface,
IStream **ppstm)
{
- TRACE("(%p)\n", iface);
+ TRACE("(%p, %p)\n", iface, ppstm);
return E_NOTIMPL;
}
-
static const IStreamVtbl StreamOnStreamRange_Vtbl =
{
/*** IUnknown methods ***/
void *pv, ULONG cb, ULONG *pcbRead)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Read(This->pStream, pv, cb, pcbRead);
void const *pv, ULONG cb, ULONG *pcbWritten)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbWritten);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Write(This->pStream, pv, cb, pcbWritten);
LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart),
+ dwOrigin, plibNewPosition);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Seek(This->pStream, dlibMove, dwOrigin, plibNewPosition);
ULARGE_INTEGER libNewSize)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart));
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_SetSize(This->pStream, libNewSize);
IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_CopyTo(This->pStream, pstm, cb, pcbRead, pcbWritten);
DWORD grfCommitFlags)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %#x)\n", This, grfCommitFlags);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Commit(This->pStream, grfCommitFlags);
static HRESULT WINAPI IWICStreamImpl_Revert(IWICStream *iface)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p)\n", This);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Revert(This->pStream);
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %s, %s, %d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_LockRegion(This->pStream, libOffset, cb, dwLockType);
ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %s, %s, %d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart),
+ wine_dbgstr_longlong(cb.QuadPart), dwLockType);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_UnlockRegion(This->pStream, libOffset, cb, dwLockType);
STATSTG *pstatstg, DWORD grfStatFlag)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Stat(This->pStream, pstatstg, grfStatFlag);
IStream **ppstm)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
- TRACE("(%p): relay\n", This);
+ TRACE("(%p, %p)\n", This, ppstm);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Clone(This->pStream, ppstm);
}
-static HRESULT WINAPI IWICStreamImpl_InitializeFromIStream(IWICStream *iface,
- IStream *pIStream)
+static HRESULT WINAPI IWICStreamImpl_InitializeFromIStream(IWICStream *iface, IStream *stream)
{
- ULARGE_INTEGER offset, size;
- TRACE("(%p): relay\n", iface);
+ IWICStreamImpl *This = impl_from_IWICStream(iface);
+ HRESULT hr = S_OK;
+
+ TRACE("(%p, %p)\n", iface, stream);
+
+ if (!stream) return E_INVALIDARG;
+ if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
+
+ IStream_AddRef(stream);
- offset.QuadPart = 0;
- size.u.LowPart = 0xffffffff;
- size.u.HighPart = 0xffffffff;
- return IWICStream_InitializeFromIStreamRegion(iface, pIStream, offset, size);
+ if (InterlockedCompareExchangePointer((void **)&This->pStream, stream, NULL))
+ {
+ /* Some other thread set the stream first. */
+ IStream_Release(stream);
+ hr = WINCODEC_ERR_WRONGSTATE;
+ }
+
+ return hr;
}
static HRESULT WINAPI IWICStreamImpl_InitializeFromFilename(IWICStream *iface,
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
StreamOnMemory *pObject;
- TRACE("(%p,%p)\n", iface, pbBuffer);
+ TRACE("(%p, %p, %u)\n", iface, pbBuffer, cbBufferSize);
if (!pbBuffer) return E_INVALIDARG;
if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
StreamOnStreamRange *pObject;
- TRACE("(%p,%p)\n", iface, pIStream);
+
+ TRACE("(%p,%p,%s,%s)\n", iface, pIStream, wine_dbgstr_longlong(ulOffset.QuadPart),
+ wine_dbgstr_longlong(ulMaxSize.QuadPart));
if (!pIStream) return E_INVALIDARG;
if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
TgaDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
HRESULT hr;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
hr = TgaDecoder_ReadImage(This);
break;
default:
FIXME("unhandled indexed bit count %u\n", bps);
- return E_FAIL;
+ return E_NOTIMPL;
}
break;
result->IWICMetadataBlockReader_iface.lpVtbl = &TiffFrameDecode_BlockVtbl;
result->ref = 1;
result->parent = This;
+ IWICBitmapDecoder_AddRef(iface);
result->index = index;
result->decode_info = decode_info;
result->cached_tile_x = -1;
else
{
hr = E_OUTOFMEMORY;
- HeapFree(GetProcessHeap(), 0, result);
+ IWICBitmapFrameDecode_Release(&result->IWICBitmapFrameDecode_iface);
}
}
else hr = E_OUTOFMEMORY;
if (ref == 0)
{
+ IWICBitmapDecoder_Release(&This->parent->IWICBitmapDecoder_iface);
HeapFree(GetProcessHeap(), 0, This->cached_tile);
HeapFree(GetProcessHeap(), 0, This);
}
UINT bytesperrow;
WICRect rect;
- TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
if (!prc)
{
if (cbStride < bytesperrow)
return E_INVALIDARG;
- if ((cbStride * (prc->Height-1)) + ((prc->Width * This->decode_info.bpp) + 7)/8 > cbBufferSize)
+ if ((cbStride * (prc->Height-1)) + bytesperrow > cbBufferSize)
return E_INVALIDARG;
min_tile_x = prc->X / This->decode_info.tile_width;
{&GUID_WICPixelFormat64bppRGBA, 2, 16, 4, 64, 1, 2, 0},
{&GUID_WICPixelFormat64bppPRGBA, 2, 16, 4, 64, 1, 1, 0},
{&GUID_WICPixelFormat1bppIndexed, 3, 1, 1, 1, 0, 0, 0},
- {&GUID_WICPixelFormat2bppIndexed, 3, 2, 1, 2, 0, 0, 0},
{&GUID_WICPixelFormat4bppIndexed, 3, 4, 1, 4, 0, 0, 0},
{&GUID_WICPixelFormat8bppIndexed, 3, 8, 1, 8, 0, 0, 0},
{0}
return WINCODEC_ERR_WRONGSTATE;
}
+ if (IsEqualGUID(pPixelFormat, &GUID_WICPixelFormat2bppIndexed))
+ *pPixelFormat = GUID_WICPixelFormat4bppIndexed;
+
for (i=0; formats[i].guid; i++)
{
- if (memcmp(formats[i].guid, pPixelFormat, sizeof(GUID)) == 0)
+ if (IsEqualGUID(formats[i].guid, pPixelFormat))
break;
}
TiffFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
- TRACE("(%p,%p,%p)\n", iface, pIBitmapSource, prc);
+ TRACE("(%p,%p,%s)\n", iface, pIBitmapSource, debug_wic_rect(prc));
if (!This->initialized)
return WINCODEC_ERR_WRONGSTATE;
static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
GUID *pguidContainerFormat)
{
+ TRACE("(%p,%p)\n", iface, pguidContainerFormat);
+
+ if (!pguidContainerFormat)
+ return E_INVALIDARG;
+
memcpy(pguidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID));
return S_OK;
}
if (ppIEncoderOptions && SUCCEEDED(hr))
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (SUCCEEDED(hr))
{
VARIANT v;
#include "wincodec.h"
#include "wincodecsdk.h"
+
+#include "wine/debug.h"
#include "wine/unicode.h"
DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
typedef HRESULT(*class_constructor)(REFIID,void**);
extern HRESULT FormatConverter_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
-extern HRESULT ComponentFactory_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
+extern HRESULT ImagingFactory_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
extern HRESULT BmpDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
extern HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
extern HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
return dst;
}
+static inline const char *debug_wic_rect(const WICRect *rect)
+{
+ if (!rect) return "(null)";
+ return wine_dbg_sprintf("(%u,%u)-(%u,%u)", rect->X, rect->Y, rect->Width, rect->Height);
+}
+
#endif /* WINCODECS_PRIVATE_H */
@ stdcall IWICPalette_InitializeFromBitmap_Proxy(ptr ptr long long) IWICPalette_InitializeFromBitmap_Proxy_W
@ stdcall IWICPalette_InitializeFromPalette_Proxy(ptr ptr) IWICPalette_InitializeFromPalette_Proxy_W
@ stdcall IWICPalette_InitializePredefined_Proxy(ptr long long) IWICPalette_InitializePredefined_Proxy_W
-@ stdcall IWICPixelFormatInfo_GetBitsPerPixel_Proxy(ptr ptr)
-@ stdcall IWICPixelFormatInfo_GetChannelCount_Proxy(ptr ptr)
-@ stdcall IWICPixelFormatInfo_GetChannelMask_Proxy(ptr long long ptr ptr)
+@ stdcall IWICPixelFormatInfo_GetBitsPerPixel_Proxy(ptr ptr) IWICPixelFormatInfo_GetBitsPerPixel_Proxy_W
+@ stdcall IWICPixelFormatInfo_GetChannelCount_Proxy(ptr ptr) IWICPixelFormatInfo_GetChannelCount_Proxy_W
+@ stdcall IWICPixelFormatInfo_GetChannelMask_Proxy(ptr long long ptr ptr) IWICPixelFormatInfo_GetChannelMask_Proxy_W
@ stdcall IWICStream_InitializeFromIStream_Proxy(ptr ptr) IWICStream_InitializeFromIStream_Proxy_W
@ stdcall IWICStream_InitializeFromMemory_Proxy(ptr ptr long) IWICStream_InitializeFromMemory_Proxy_W
@ stdcall WICConvertBitmapSource(ptr ptr ptr)
reactos/dll/win32/vssapi # Synced to WineStaging-2.9
reactos/dll/win32/wbemdisp # Synced to WineStaging-4.0
reactos/dll/win32/wbemprox # Synced to WineStaging-4.0
-reactos/dll/win32/windowscodecs # Synced to WineStaging-3.9
+reactos/dll/win32/windowscodecs # Synced to WineStaging-4.0
reactos/dll/win32/windowscodecsext # Synced to WineStaging-2.9
reactos/dll/win32/winemp3.acm # Synced to WineStaging-3.3
reactos/dll/win32/wing32 # Synced to WineStaging-3.3