ReactOS 0.4.16-dev-889-g9563c07
imgfactory.c File Reference
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "objbase.h"
#include "shellapi.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
Include dependency graph for imgfactory.c:

Go to the source code of this file.

Classes

struct  ImagingFactory
 
struct  iterator_context
 

Macros

#define COBJMACROS
 

Typedefs

typedef enum iterator_result(* iterator_func) (IUnknown *item, struct iterator_context *context)
 

Enumerations

enum  iterator_result { ITER_SKIP , ITER_DONE }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wincodecs)
 
static ImagingFactoryimpl_from_IWICComponentFactory (IWICComponentFactory *iface)
 
static ImagingFactoryimpl_from_IWICImagingFactory2 (IWICImagingFactory2 *iface)
 
static HRESULT WINAPI ImagingFactory_QueryInterface (IWICImagingFactory2 *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI ImagingFactory_AddRef (IWICImagingFactory2 *iface)
 
static ULONG WINAPI ImagingFactory_Release (IWICImagingFactory2 *iface)
 
static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename (IWICImagingFactory2 *iface, LPCWSTR wzFilename, const GUID *pguidVendor, DWORD dwDesiredAccess, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT find_decoder (IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream (IWICImagingFactory2 *iface, IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle (IWICImagingFactory2 *iface, ULONG_PTR hFile, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT WINAPI ImagingFactory_CreateComponentInfo (IWICImagingFactory2 *iface, REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
 
static HRESULT WINAPI ImagingFactory_CreateDecoder (IWICImagingFactory2 *iface, REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT WINAPI ImagingFactory_CreateEncoder (IWICImagingFactory2 *iface, REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapEncoder **ppIEncoder)
 
static HRESULT WINAPI ImagingFactory_CreatePalette (IWICImagingFactory2 *iface, IWICPalette **ppIPalette)
 
static HRESULT WINAPI ImagingFactory_CreateFormatConverter (IWICImagingFactory2 *iface, IWICFormatConverter **ppIFormatConverter)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapScaler (IWICImagingFactory2 *iface, IWICBitmapScaler **ppIBitmapScaler)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapClipper (IWICImagingFactory2 *iface, IWICBitmapClipper **ppIBitmapClipper)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFlipRotator (IWICImagingFactory2 *iface, IWICBitmapFlipRotator **ppIBitmapFlipRotator)
 
static HRESULT WINAPI ImagingFactory_CreateStream (IWICImagingFactory2 *iface, IWICStream **ppIWICStream)
 
static HRESULT WINAPI ImagingFactory_CreateColorContext (IWICImagingFactory2 *iface, IWICColorContext **ppIColorContext)
 
static HRESULT WINAPI ImagingFactory_CreateColorTransformer (IWICImagingFactory2 *iface, IWICColorTransform **ppIColorTransform)
 
static HRESULT WINAPI ImagingFactory_CreateBitmap (IWICImagingFactory2 *iface, UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
 
static HRESULT create_bitmap_from_source_rect (IWICBitmapSource *piBitmapSource, const WICRect *rect, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromSource (IWICImagingFactory2 *iface, IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromSourceRect (IWICImagingFactory2 *iface, IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height, IWICBitmap **ppIBitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromMemory (IWICImagingFactory2 *iface, UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap)
 
static BOOL get_16bpp_format (HBITMAP hbm, WICPixelFormatGUID *format)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromHBITMAP (IWICImagingFactory2 *iface, HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON (IWICImagingFactory2 *iface, HICON hicon, IWICBitmap **bitmap)
 
static HRESULT WINAPI ImagingFactory_CreateComponentEnumerator (IWICImagingFactory2 *iface, DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
 
static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder (IWICImagingFactory2 *iface, IWICBitmapDecoder *pIDecoder, IWICFastMetadataEncoder **ppIFastEncoder)
 
static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode (IWICImagingFactory2 *iface, IWICBitmapFrameDecode *pIFrameDecoder, IWICFastMetadataEncoder **ppIFastEncoder)
 
static HRESULT WINAPI ImagingFactory_CreateQueryWriter (IWICImagingFactory2 *iface, REFGUID guidMetadataFormat, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter)
 
static HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader (IWICImagingFactory2 *iface, IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter)
 
static HRESULT WINAPI ImagingFactory_CreateImageEncoder (IWICImagingFactory2 *iface, ID2D1Device *device, IWICImageEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_QueryInterface (IWICComponentFactory *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI ComponentFactory_AddRef (IWICComponentFactory *iface)
 
static ULONG WINAPI ComponentFactory_Release (IWICComponentFactory *iface)
 
static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename (IWICComponentFactory *iface, LPCWSTR filename, const GUID *vendor, DWORD desired_access, WICDecodeOptions options, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream (IWICComponentFactory *iface, IStream *stream, const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle (IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateComponentInfo (IWICComponentFactory *iface, REFCLSID component, IWICComponentInfo **info)
 
static HRESULT WINAPI ComponentFactory_CreateDecoder (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateEncoder (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, IWICBitmapEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_CreatePalette (IWICComponentFactory *iface, IWICPalette **palette)
 
static HRESULT WINAPI ComponentFactory_CreateFormatConverter (IWICComponentFactory *iface, IWICFormatConverter **converter)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapScaler (IWICComponentFactory *iface, IWICBitmapScaler **scaler)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapClipper (IWICComponentFactory *iface, IWICBitmapClipper **clipper)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator (IWICComponentFactory *iface, IWICBitmapFlipRotator **fliprotator)
 
static HRESULT WINAPI ComponentFactory_CreateStream (IWICComponentFactory *iface, IWICStream **stream)
 
static HRESULT WINAPI ComponentFactory_CreateColorContext (IWICComponentFactory *iface, IWICColorContext **context)
 
static HRESULT WINAPI ComponentFactory_CreateColorTransformer (IWICComponentFactory *iface, IWICColorTransform **transformer)
 
static HRESULT WINAPI ComponentFactory_CreateBitmap (IWICComponentFactory *iface, UINT width, UINT height, REFWICPixelFormatGUID pixel_format, WICBitmapCreateCacheOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource (IWICComponentFactory *iface, IWICBitmapSource *source, WICBitmapCreateCacheOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect (IWICComponentFactory *iface, IWICBitmapSource *source, UINT x, UINT y, UINT width, UINT height, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory (IWICComponentFactory *iface, UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP (IWICComponentFactory *iface, HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON (IWICComponentFactory *iface, HICON hicon, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator (IWICComponentFactory *iface, DWORD component_types, DWORD options, IEnumUnknown **enumerator)
 
static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder (IWICComponentFactory *iface, IWICBitmapDecoder *decoder, IWICFastMetadataEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode (IWICComponentFactory *iface, IWICBitmapFrameDecode *frame_decode, IWICFastMetadataEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_CreateQueryWriter (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, IWICMetadataQueryWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader (IWICComponentFactory *iface, IWICMetadataQueryReader *reader, const GUID *vendor, IWICMetadataQueryWriter **writer)
 
static enum iterator_result create_metadata_reader_from_container_iterator (IUnknown *item, struct iterator_context *context)
 
static enum iterator_result create_metadata_reader_iterator (IUnknown *item, struct iterator_context *context)
 
static HRESULT foreach_component (DWORD mask, iterator_func func, struct iterator_context *context)
 
static HRESULT create_unknown_metadata_reader (IStream *stream, DWORD options, IWICMetadataReader **reader)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataReader (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataWriter (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IWICMetadataWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader (IWICComponentFactory *iface, IWICMetadataReader *reader, const GUID *vendor, IWICMetadataWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader (IWICComponentFactory *iface, IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
 
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter (IWICComponentFactory *iface, IWICMetadataBlockWriter *block_writer, IWICMetadataQueryWriter **query_writer)
 
static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag (IWICComponentFactory *iface, PROPBAG2 *options, UINT count, IPropertyBag2 **property)
 
HRESULT ImagingFactory_CreateInstance (REFIID iid, void **ppv)
 
HRESULT WINAPI WICCreateBitmapFromSectionEx (UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap)
 
HRESULT WINAPI WICCreateBitmapFromSection (UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, IWICBitmap **bitmap)
 

Variables

static const IWICImagingFactory2Vtbl ImagingFactory_Vtbl
 
static const IWICComponentFactoryVtbl ComponentFactory_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file imgfactory.c.

Typedef Documentation

◆ iterator_func

Definition at line 1248 of file imgfactory.c.

Enumeration Type Documentation

◆ iterator_result

Enumerator
ITER_SKIP 
ITER_DONE 

Definition at line 1255 of file imgfactory.c.

1256{
1257 ITER_SKIP,
1258 ITER_DONE,
1259};
@ ITER_SKIP
Definition: imgfactory.c:1257
@ ITER_DONE
Definition: imgfactory.c:1258

Function Documentation

◆ ComponentFactory_AddRef()

static ULONG WINAPI ComponentFactory_AddRef ( IWICComponentFactory iface)
static

Definition at line 1072 of file imgfactory.c.

1073{
1075 return IWICImagingFactory2_AddRef(&This->IWICImagingFactory2_iface);
1076}
static ImagingFactory * impl_from_IWICComponentFactory(IWICComponentFactory *iface)
Definition: imgfactory.c:43

◆ ComponentFactory_CreateBitmap()

static HRESULT WINAPI ComponentFactory_CreateBitmap ( IWICComponentFactory iface,
UINT  width,
UINT  height,
REFWICPixelFormatGUID  pixel_format,
WICBitmapCreateCacheOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 1177 of file imgfactory.c.

1179{
1181 return IWICImagingFactory2_CreateBitmap(&This->IWICImagingFactory2_iface, width, height, pixel_format, option, bitmap);
1182}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
Definition: uimain.c:89
Definition: getopt.h:109

◆ ComponentFactory_CreateBitmapClipper()

static HRESULT WINAPI ComponentFactory_CreateBitmapClipper ( IWICComponentFactory iface,
IWICBitmapClipper **  clipper 
)
static

Definition at line 1147 of file imgfactory.c.

1148{
1150 return IWICImagingFactory2_CreateBitmapClipper(&This->IWICImagingFactory2_iface, clipper);
1151}

◆ ComponentFactory_CreateBitmapFlipRotator()

static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator ( IWICComponentFactory iface,
IWICBitmapFlipRotator **  fliprotator 
)
static

Definition at line 1153 of file imgfactory.c.

1154{
1156 return IWICImagingFactory2_CreateBitmapFlipRotator(&This->IWICImagingFactory2_iface, fliprotator);
1157}

◆ ComponentFactory_CreateBitmapFromHBITMAP()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP ( IWICComponentFactory iface,
HBITMAP  hbm,
HPALETTE  hpal,
WICBitmapAlphaChannelOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 1206 of file imgfactory.c.

1208{
1210 return IWICImagingFactory2_CreateBitmapFromHBITMAP(&This->IWICImagingFactory2_iface, hbm, hpal, option, bitmap);
1211}
_In_ HBITMAP hbm
Definition: ntgdi.h:2776

◆ ComponentFactory_CreateBitmapFromHICON()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON ( IWICComponentFactory iface,
HICON  hicon,
IWICBitmap **  bitmap 
)
static

Definition at line 1213 of file imgfactory.c.

1214{
1216 return IWICImagingFactory2_CreateBitmapFromHICON(&This->IWICImagingFactory2_iface, hicon, bitmap);
1217}

◆ ComponentFactory_CreateBitmapFromMemory()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory ( IWICComponentFactory iface,
UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
UINT  stride,
UINT  size,
BYTE buffer,
IWICBitmap **  bitmap 
)
static

Definition at line 1198 of file imgfactory.c.

1200{
1202 return IWICImagingFactory2_CreateBitmapFromMemory(&This->IWICImagingFactory2_iface, width, height, format, stride,
1203 size, buffer, bitmap);
1204}
GLsizei stride
Definition: glext.h:5848
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
Definition: format.c:58

◆ ComponentFactory_CreateBitmapFromSource()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource ( IWICComponentFactory iface,
IWICBitmapSource source,
WICBitmapCreateCacheOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 1184 of file imgfactory.c.

1186{
1188 return IWICImagingFactory2_CreateBitmapFromSource(&This->IWICImagingFactory2_iface, source, option, bitmap);
1189}

◆ ComponentFactory_CreateBitmapFromSourceRect()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect ( IWICComponentFactory iface,
IWICBitmapSource source,
UINT  x,
UINT  y,
UINT  width,
UINT  height,
IWICBitmap **  bitmap 
)
static

Definition at line 1191 of file imgfactory.c.

1193{
1195 return IWICImagingFactory2_CreateBitmapFromSourceRect(&This->IWICImagingFactory2_iface, source, x, y, width, height, bitmap);
1196}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ ComponentFactory_CreateBitmapScaler()

static HRESULT WINAPI ComponentFactory_CreateBitmapScaler ( IWICComponentFactory iface,
IWICBitmapScaler **  scaler 
)
static

Definition at line 1141 of file imgfactory.c.

1142{
1144 return IWICImagingFactory2_CreateBitmapScaler(&This->IWICImagingFactory2_iface, scaler);
1145}

◆ ComponentFactory_CreateColorContext()

static HRESULT WINAPI ComponentFactory_CreateColorContext ( IWICComponentFactory iface,
IWICColorContext **  context 
)
static

Definition at line 1165 of file imgfactory.c.

1166{
1168 return IWICImagingFactory2_CreateColorContext(&This->IWICImagingFactory2_iface, context);
1169}
Definition: http.c:7252

◆ ComponentFactory_CreateColorTransformer()

static HRESULT WINAPI ComponentFactory_CreateColorTransformer ( IWICComponentFactory iface,
IWICColorTransform **  transformer 
)
static

Definition at line 1171 of file imgfactory.c.

1172{
1174 return IWICImagingFactory2_CreateColorTransformer(&This->IWICImagingFactory2_iface, transformer);
1175}

◆ ComponentFactory_CreateComponentEnumerator()

static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator ( IWICComponentFactory iface,
DWORD  component_types,
DWORD  options,
IEnumUnknown **  enumerator 
)
static

Definition at line 1219 of file imgfactory.c.

1221{
1223 return IWICImagingFactory2_CreateComponentEnumerator(&This->IWICImagingFactory2_iface, component_types,
1224 options, enumerator);
1225}

◆ ComponentFactory_CreateComponentInfo()

static HRESULT WINAPI ComponentFactory_CreateComponentInfo ( IWICComponentFactory iface,
REFCLSID  component,
IWICComponentInfo **  info 
)
static

Definition at line 1108 of file imgfactory.c.

1110{
1112 return IWICImagingFactory2_CreateComponentInfo(&This->IWICImagingFactory2_iface, component, info);
1113}

◆ ComponentFactory_CreateDecoder()

static HRESULT WINAPI ComponentFactory_CreateDecoder ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1115 of file imgfactory.c.

1117{
1119 return IWICImagingFactory2_CreateDecoder(&This->IWICImagingFactory2_iface, format, vendor, decoder);
1120}
const WCHAR * vendor
Definition: db.cpp:872

◆ ComponentFactory_CreateDecoderFromFileHandle()

static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle ( IWICComponentFactory iface,
ULONG_PTR  hFile,
const GUID vendor,
WICDecodeOptions  options,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1100 of file imgfactory.c.

1102{
1104 return IWICImagingFactory2_CreateDecoderFromFileHandle(&This->IWICImagingFactory2_iface, hFile, vendor,
1105 options, decoder);
1106}
_In_ HANDLE hFile
Definition: mswsock.h:90

◆ ComponentFactory_CreateDecoderFromFilename()

static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename ( IWICComponentFactory iface,
LPCWSTR  filename,
const GUID vendor,
DWORD  desired_access,
WICDecodeOptions  options,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1084 of file imgfactory.c.

1086{
1088 return IWICImagingFactory2_CreateDecoderFromFilename(&This->IWICImagingFactory2_iface, filename, vendor,
1089 desired_access, options, decoder);
1090}
const char * filename
Definition: ioapi.h:137

◆ ComponentFactory_CreateDecoderFromStream()

static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream ( IWICComponentFactory iface,
IStream stream,
const GUID vendor,
WICDecodeOptions  options,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1092 of file imgfactory.c.

1094{
1096 return IWICImagingFactory2_CreateDecoderFromStream(&This->IWICImagingFactory2_iface, stream, vendor,
1097 options, decoder);
1098}
Definition: parse.h:23

◆ ComponentFactory_CreateEncoder()

static HRESULT WINAPI ComponentFactory_CreateEncoder ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
IWICBitmapEncoder **  encoder 
)
static

Definition at line 1122 of file imgfactory.c.

1124{
1126 return IWICImagingFactory2_CreateEncoder(&This->IWICImagingFactory2_iface, format, vendor, encoder);
1127}

◆ ComponentFactory_CreateEncoderPropertyBag()

static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag ( IWICComponentFactory iface,
PROPBAG2 *  options,
UINT  count,
IPropertyBag2 **  property 
)
static

Definition at line 1561 of file imgfactory.c.

1563{
1564 TRACE("(%p,%p,%u,%p)\n", iface, options, count, property);
1566}
HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, IPropertyBag2 **ppPropertyBag2)
Definition: propertybag.c:278
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TRACE(s)
Definition: solgame.cpp:4

◆ ComponentFactory_CreateFastMetadataEncoderFromDecoder()

static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder ( IWICComponentFactory iface,
IWICBitmapDecoder decoder,
IWICFastMetadataEncoder **  encoder 
)
static

Definition at line 1227 of file imgfactory.c.

1229{
1231 return IWICImagingFactory2_CreateFastMetadataEncoderFromDecoder(&This->IWICImagingFactory2_iface, decoder, encoder);
1232}

◆ ComponentFactory_CreateFastMetadataEncoderFromFrameDecode()

static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode ( IWICComponentFactory iface,
IWICBitmapFrameDecode frame_decode,
IWICFastMetadataEncoder **  encoder 
)
static

Definition at line 1234 of file imgfactory.c.

1236{
1238 return IWICImagingFactory2_CreateFastMetadataEncoderFromFrameDecode(&This->IWICImagingFactory2_iface, frame_decode, encoder);
1239}

◆ ComponentFactory_CreateFormatConverter()

static HRESULT WINAPI ComponentFactory_CreateFormatConverter ( IWICComponentFactory iface,
IWICFormatConverter **  converter 
)
static

Definition at line 1135 of file imgfactory.c.

1136{
1138 return IWICImagingFactory2_CreateFormatConverter(&This->IWICImagingFactory2_iface, converter);
1139}

◆ ComponentFactory_CreateMetadataReader()

static HRESULT WINAPI ComponentFactory_CreateMetadataReader ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
DWORD  options,
IStream stream,
IWICMetadataReader **  reader 
)
static

Definition at line 1455 of file imgfactory.c.

1457{
1458 struct iterator_context context = { 0 };
1459 HRESULT hr;
1460
1461 TRACE("%p,%s,%s,%lx,%p,%p\n", iface, debugstr_guid(format), debugstr_guid(vendor),
1463
1464 if (!format || !reader)
1465 return E_INVALIDARG;
1466
1467 context.format = format;
1468 context.vendor = vendor;
1469 context.options = options;
1470 context.stream = stream;
1471 context.result = (void **)reader;
1472
1474
1475 if (FAILED(hr) && vendor)
1476 {
1477 context.vendor = NULL;
1479 }
1480
1481 if (FAILED(hr))
1482 WARN("Failed to create a metadata reader instance, hr %#lx.\n", hr);
1483
1486
1488}
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
static HRESULT create_unknown_metadata_reader(IStream *stream, DWORD options, IWICMetadataReader **reader)
Definition: imgfactory.c:1426
static enum iterator_result create_metadata_reader_iterator(IUnknown *item, struct iterator_context *context)
Definition: imgfactory.c:1333
static HRESULT foreach_component(DWORD mask, iterator_func func, struct iterator_context *context)
Definition: imgfactory.c:1398
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hr
Definition: shlfolder.c:183
IStream * stream
Definition: imgfactory.c:1266
const GUID * format
Definition: imgfactory.c:1263
Definition: reader.h:84
@ WICMetadataReader
Definition: wincodec.idl:129
@ WICMetadataCreationFailUnknown
Definition: wincodecsdk.idl:35
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3296

◆ ComponentFactory_CreateMetadataReaderFromContainer()

static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
DWORD  options,
IStream stream,
IWICMetadataReader **  reader 
)
static

Definition at line 1490 of file imgfactory.c.

1492{
1493 struct iterator_context context = { 0 };
1494 HRESULT hr;
1495
1496 TRACE("%p,%s,%s,%lx,%p,%p\n", iface, debugstr_guid(format), debugstr_guid(vendor),
1498
1499 if (!format || !stream || !reader)
1500 return E_INVALIDARG;
1501
1502 context.format = format;
1503 context.vendor = vendor;
1504 context.options = options;
1505 context.stream = stream;
1506 context.result = (void **)reader;
1507
1509
1510 if (FAILED(hr) && vendor)
1511 {
1512 context.vendor = NULL;
1514 }
1515
1516 if (FAILED(hr))
1517 WARN("Failed to create a metadata reader instance, hr %#lx.\n", hr);
1518
1521
1523}
static enum iterator_result create_metadata_reader_from_container_iterator(IUnknown *item, struct iterator_context *context)
Definition: imgfactory.c:1273

◆ ComponentFactory_CreateMetadataWriter()

static HRESULT WINAPI ComponentFactory_CreateMetadataWriter ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
DWORD  options,
IWICMetadataWriter **  writer 
)
static

Definition at line 1525 of file imgfactory.c.

1527{
1528 FIXME("%p,%s,%s,%lx,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, writer);
1529 return E_NOTIMPL;
1530}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ComponentFactory_CreateMetadataWriterFromReader()

static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader ( IWICComponentFactory iface,
IWICMetadataReader reader,
const GUID vendor,
IWICMetadataWriter **  writer 
)
static

Definition at line 1532 of file imgfactory.c.

1534{
1535 FIXME("%p,%p,%s,%p: stub\n", iface, reader, debugstr_guid(vendor), writer);
1536 return E_NOTIMPL;
1537}

◆ ComponentFactory_CreatePalette()

static HRESULT WINAPI ComponentFactory_CreatePalette ( IWICComponentFactory iface,
IWICPalette **  palette 
)
static

Definition at line 1129 of file imgfactory.c.

1130{
1132 return IWICImagingFactory2_CreatePalette(&This->IWICImagingFactory2_iface, palette);
1133}
static HPALETTE palette
Definition: clipboard.c:1345

◆ ComponentFactory_CreateQueryReaderFromBlockReader()

static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader ( IWICComponentFactory iface,
IWICMetadataBlockReader block_reader,
IWICMetadataQueryReader **  query_reader 
)
static

Definition at line 1539 of file imgfactory.c.

1541{
1542 TRACE("%p,%p,%p\n", iface, block_reader, query_reader);
1543
1544 if (!block_reader || !query_reader)
1545 return E_INVALIDARG;
1546
1547 return MetadataQueryReader_CreateInstance(block_reader, NULL, query_reader);
1548}
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, const WCHAR *root, IWICMetadataQueryReader **out)

◆ ComponentFactory_CreateQueryWriter()

static HRESULT WINAPI ComponentFactory_CreateQueryWriter ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
IWICMetadataQueryWriter **  writer 
)
static

Definition at line 1241 of file imgfactory.c.

1243{
1245 return IWICImagingFactory2_CreateQueryWriter(&This->IWICImagingFactory2_iface, format, vendor, writer);
1246}

◆ ComponentFactory_CreateQueryWriterFromBlockWriter()

static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter ( IWICComponentFactory iface,
IWICMetadataBlockWriter block_writer,
IWICMetadataQueryWriter **  query_writer 
)
static

Definition at line 1550 of file imgfactory.c.

1552{
1553 TRACE("%p,%p,%p\n", iface, block_writer, query_writer);
1554
1555 if (!block_writer || !query_writer)
1556 return E_INVALIDARG;
1557
1558 return MetadataQueryWriter_CreateInstance(block_writer, NULL, query_writer);
1559}
HRESULT MetadataQueryWriter_CreateInstance(IWICMetadataBlockWriter *mbw, const WCHAR *root, IWICMetadataQueryWriter **out)

◆ ComponentFactory_CreateQueryWriterFromReader()

static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader ( IWICComponentFactory iface,
IWICMetadataQueryReader reader,
const GUID vendor,
IWICMetadataQueryWriter **  writer 
)
static

Definition at line 1248 of file imgfactory.c.

1250{
1252 return IWICImagingFactory2_CreateQueryWriterFromReader(&This->IWICImagingFactory2_iface, reader, vendor, writer);
1253}

◆ ComponentFactory_CreateStream()

static HRESULT WINAPI ComponentFactory_CreateStream ( IWICComponentFactory iface,
IWICStream **  stream 
)
static

Definition at line 1159 of file imgfactory.c.

1160{
1162 return IWICImagingFactory2_CreateStream(&This->IWICImagingFactory2_iface, stream);
1163}

◆ ComponentFactory_QueryInterface()

static HRESULT WINAPI ComponentFactory_QueryInterface ( IWICComponentFactory iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 1066 of file imgfactory.c.

1067{
1069 return IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, ppv);
1070}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ ComponentFactory_Release()

static ULONG WINAPI ComponentFactory_Release ( IWICComponentFactory iface)
static

Definition at line 1078 of file imgfactory.c.

1079{
1081 return IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
1082}

◆ create_bitmap_from_source_rect()

static HRESULT create_bitmap_from_source_rect ( IWICBitmapSource piBitmapSource,
const WICRect rect,
WICBitmapCreateCacheOption  option,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 491 of file imgfactory.c.

493{
499 HRESULT hr;
500 WICRect rc;
501 double dpix, dpiy;
503 IWICPixelFormatInfo2 *formatinfo;
505
507
508 if (!piBitmapSource || !ppIBitmap)
509 return E_INVALIDARG;
510
511 if (option == WICBitmapNoCache && SUCCEEDED(IWICBitmapSource_QueryInterface(piBitmapSource,
512 &IID_IWICBitmap, (void **)&result)))
513 {
514 *ppIBitmap = result;
515 return S_OK;
516 }
517
518 hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
519
520 if (SUCCEEDED(hr) && rect)
521 {
522 if (rect->X >= width || rect->Y >= height || rect->Width == 0 || rect->Height == 0)
523 return E_INVALIDARG;
524
525 width = min(width - rect->X, rect->Width);
526 height = min(height - rect->Y, rect->Height);
527 }
528
529 if (SUCCEEDED(hr))
530 hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
531
532 if (SUCCEEDED(hr))
534
535 if (SUCCEEDED(hr))
536 {
537 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&formatinfo);
538
539 if (SUCCEEDED(hr))
540 {
541 hr = IWICPixelFormatInfo2_GetNumericRepresentation(formatinfo, &format_type);
542
543 IWICPixelFormatInfo2_Release(formatinfo);
544 }
545
546 IWICComponentInfo_Release(info);
547 }
548
549 if (SUCCEEDED(hr))
551
552 if (SUCCEEDED(hr))
553 {
554 hr = IWICBitmap_Lock(result, NULL, WICBitmapLockWrite, &lock);
555 if (SUCCEEDED(hr))
556 {
557 UINT stride, buffersize;
558 BYTE *buffer;
559
560 if (rect)
561 {
562 rc.X = rect->X;
563 rc.Y = rect->Y;
564 }
565 else
566 rc.X = rc.Y = 0;
567 rc.Width = width;
568 rc.Height = height;
569
570 hr = IWICBitmapLock_GetStride(lock, &stride);
571
572 if (SUCCEEDED(hr))
573 hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
574
575 if (SUCCEEDED(hr))
576 hr = IWICBitmapSource_CopyPixels(piBitmapSource, &rc, stride,
577 buffersize, buffer);
578
579 IWICBitmapLock_Release(lock);
580 }
581
584 {
586
587 if (SUCCEEDED(hr))
588 {
589 hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
590
591 if (SUCCEEDED(hr))
592 hr = IWICBitmap_SetPalette(result, palette);
593 else
594 hr = S_OK;
595
596 IWICPalette_Release(palette);
597 }
598 }
599
600 if (SUCCEEDED(hr))
601 {
602 hr = IWICBitmapSource_GetResolution(piBitmapSource, &dpix, &dpiy);
603
604 if (SUCCEEDED(hr))
605 hr = IWICBitmap_SetResolution(result, dpix, dpiy);
606 else
607 hr = S_OK;
608 }
609
610 if (SUCCEEDED(hr))
611 *ppIBitmap = result;
612 else
613 IWICBitmap_Release(result);
614 }
615
616 return hr;
617}
format_type
Definition: d3dx9_private.h:49
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, void *view, UINT offset, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
Definition: bitmap.c:790
pixelformat
Definition: converter.c:37
HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo)
Definition: info.c:2030
HRESULT PaletteImpl_Create(IWICPalette **palette)
Definition: palette.c:897
#define assert(x)
Definition: debug.h:53
GLuint64EXT * result
Definition: glext.h:11304
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
& rect
Definition: startmenu.cpp:1413
INT Height
Definition: wincodec.idl:335
INT Width
Definition: wincodec.idl:334
rwlock_t lock
Definition: tcpcore.h:0
@ WICBitmapLockWrite
Definition: wincodec.idl:87
@ WICBitmapNoCache
Definition: wincodec.idl:35
@ WICBitmapCacheOnLoad
Definition: wincodec.idl:37
WICPixelFormatNumericRepresentation
Definition: wincodec.idl:158
@ WICPixelFormatNumericRepresentationUnspecified
Definition: wincodec.idl:159
@ WICPixelFormatNumericRepresentationIndexed
Definition: wincodec.idl:160
unsigned char BYTE
Definition: xxhash.c:193

Referenced by ImagingFactory_CreateBitmapFromSource(), and ImagingFactory_CreateBitmapFromSourceRect().

◆ create_metadata_reader_from_container_iterator()

static enum iterator_result create_metadata_reader_from_container_iterator ( IUnknown item,
struct iterator_context context 
)
static

Definition at line 1273 of file imgfactory.c.

1275{
1276 IWICPersistStream *persist_stream = NULL;
1277 IWICMetadataReaderInfo *readerinfo;
1279 LARGE_INTEGER zero = {{0}};
1280 BOOL matches;
1281 HRESULT hr;
1282 GUID guid;
1283
1284 if (FAILED(IUnknown_QueryInterface(item, &IID_IWICMetadataReaderInfo, (void **)&readerinfo)))
1285 return ITER_SKIP;
1286
1287 if (context->vendor)
1288 {
1289 hr = IWICMetadataReaderInfo_GetVendorGUID(readerinfo, &guid);
1290
1291 if (FAILED(hr) || !IsEqualIID(context->vendor, &guid))
1292 {
1293 IWICMetadataReaderInfo_Release(readerinfo);
1294 return ITER_SKIP;
1295 }
1296 }
1297
1298 hr = IWICMetadataReaderInfo_MatchesPattern(readerinfo, context->format, context->stream, &matches);
1299
1300 if (SUCCEEDED(hr) && matches)
1301 {
1302 hr = IStream_Seek(context->stream, zero, STREAM_SEEK_SET, NULL);
1303
1304 if (SUCCEEDED(hr))
1305 hr = IWICMetadataReaderInfo_CreateInstance(readerinfo, &reader);
1306
1307 if (SUCCEEDED(hr))
1308 hr = IWICMetadataReader_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist_stream);
1309
1310 if (SUCCEEDED(hr))
1311 hr = IWICPersistStream_LoadEx(persist_stream, context->stream, context->vendor,
1312 context->options & WICPersistOptionMask);
1313
1314 if (persist_stream)
1315 IWICPersistStream_Release(persist_stream);
1316
1317 if (SUCCEEDED(hr))
1318 {
1319 *context->result = reader;
1320 IWICMetadataReaderInfo_Release(readerinfo);
1321 return ITER_DONE;
1322 }
1323
1324 if (reader)
1325 IWICMetadataReader_Release(reader);
1326 }
1327
1328 IWICMetadataReaderInfo_Release(readerinfo);
1329
1330 return ITER_SKIP;
1331}
unsigned int BOOL
Definition: ntddk_ex.h:94
const GUID * guid
#define matches(FN)
Definition: match.h:70
static ATOM item
Definition: dde.c:856
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
int zero
Definition: sehframes.cpp:29
@ WICPersistOptionMask
Definition: wincodecsdk.idl:29

Referenced by ComponentFactory_CreateMetadataReaderFromContainer().

◆ create_metadata_reader_iterator()

static enum iterator_result create_metadata_reader_iterator ( IUnknown item,
struct iterator_context context 
)
static

Definition at line 1333 of file imgfactory.c.

1335{
1336 IWICPersistStream *persist_stream = NULL;
1337 IWICMetadataReaderInfo *readerinfo;
1339 LARGE_INTEGER zero = {{0}};
1340 HRESULT hr;
1341 GUID guid;
1342
1343 if (FAILED(IUnknown_QueryInterface(item, &IID_IWICMetadataReaderInfo, (void **)&readerinfo)))
1344 return ITER_SKIP;
1345
1346 if (context->vendor)
1347 {
1348 hr = IWICMetadataReaderInfo_GetVendorGUID(readerinfo, &guid);
1349
1350 if (FAILED(hr) || !IsEqualIID(context->vendor, &guid))
1351 {
1352 IWICMetadataReaderInfo_Release(readerinfo);
1353 return ITER_SKIP;
1354 }
1355 }
1356
1357 hr = IWICMetadataReaderInfo_GetMetadataFormat(readerinfo, &guid);
1358
1359 if (FAILED(hr) || !IsEqualIID(context->format, &guid))
1360 {
1361 IWICMetadataReaderInfo_Release(readerinfo);
1362 return ITER_SKIP;
1363 }
1364
1365 if (SUCCEEDED(hr))
1366 hr = IWICMetadataReaderInfo_CreateInstance(readerinfo, &reader);
1367
1368 IWICMetadataReaderInfo_Release(readerinfo);
1369
1370 if (context->stream)
1371 {
1372 if (SUCCEEDED(hr))
1373 hr = IStream_Seek(context->stream, zero, STREAM_SEEK_SET, NULL);
1374
1375 if (SUCCEEDED(hr))
1376 hr = IWICMetadataReader_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist_stream);
1377
1378 if (SUCCEEDED(hr))
1379 hr = IWICPersistStream_LoadEx(persist_stream, context->stream, context->vendor,
1380 context->options & WICPersistOptionMask);
1381
1382 if (persist_stream)
1383 IWICPersistStream_Release(persist_stream);
1384 }
1385
1386 if (SUCCEEDED(hr))
1387 {
1388 *context->result = reader;
1389 return ITER_DONE;
1390 }
1391
1392 if (reader)
1393 IWICMetadataReader_Release(reader);
1394
1395 return ITER_SKIP;
1396}

Referenced by ComponentFactory_CreateMetadataReader().

◆ create_unknown_metadata_reader()

static HRESULT create_unknown_metadata_reader ( IStream stream,
DWORD  options,
IWICMetadataReader **  reader 
)
static

Definition at line 1426 of file imgfactory.c.

1427{
1428 IWICPersistStream *persist_stream = NULL;
1429 LARGE_INTEGER zero = {{0}};
1430 HRESULT hr;
1431
1432 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
1433
1434 if (SUCCEEDED(hr))
1435 hr = UnknownMetadataReader_CreateInstance(&IID_IWICMetadataReader, (void **)reader);
1436
1437 if (SUCCEEDED(hr))
1438 hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void **)&persist_stream);
1439
1440 if (SUCCEEDED(hr))
1441 hr = IWICPersistStream_LoadEx(persist_stream, stream, NULL, options & WICPersistOptionMask);
1442
1443 if (persist_stream)
1444 IWICPersistStream_Release(persist_stream);
1445
1446 if (FAILED(hr))
1447 {
1448 IWICMetadataReader_Release(*reader);
1449 *reader = NULL;
1450 }
1451
1452 return hr;
1453}
HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void **ppv)

Referenced by ComponentFactory_CreateMetadataReader(), and ComponentFactory_CreateMetadataReaderFromContainer().

◆ find_decoder()

static HRESULT find_decoder ( IStream pIStream,
const GUID pguidVendor,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 132 of file imgfactory.c.

134{
135 IEnumUnknown *enumdecoders = NULL;
136 IUnknown *unkdecoderinfo = NULL;
137 GUID vendor;
138 HRESULT res, res_wine;
139 ULONG num_fetched;
140 BOOL matches, found;
141
142 *decoder = NULL;
143
145 if (FAILED(res)) return res;
146
147 found = FALSE;
148 while (IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched) == S_OK)
149 {
150 IWICBitmapDecoderInfo *decoderinfo = NULL;
151 IWICWineDecoder *wine_decoder = NULL;
152
153 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
154 if (FAILED(res)) goto next;
155
156 if (pguidVendor)
157 {
158 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
159 if (FAILED(res) || !IsEqualIID(&vendor, pguidVendor)) goto next;
160 }
161
162 res = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, pIStream, &matches);
163 if (FAILED(res) || !matches) goto next;
164
165 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, decoder);
166 if (FAILED(res)) goto next;
167
168 /* FIXME: should use QueryCapability to choose a decoder */
169
170 found = TRUE;
171 res = IWICBitmapDecoder_Initialize(*decoder, pIStream, metadataOptions);
172 if (FAILED(res))
173 {
174 res_wine = IWICBitmapDecoder_QueryInterface(*decoder, &IID_IWICWineDecoder, (void **)&wine_decoder);
175 if (FAILED(res_wine))
176 {
177 IWICBitmapDecoder_Release(*decoder);
178 *decoder = NULL;
179 goto next;
180 }
181
182 res_wine = IWICWineDecoder_Initialize(wine_decoder, pIStream, metadataOptions);
183 if (FAILED(res_wine))
184 {
185 IWICBitmapDecoder_Release(*decoder);
186 *decoder = NULL;
187 goto next;
188 }
189
190 res = res_wine;
191 }
192
193 next:
194 if (wine_decoder) IWICWineDecoder_Release(wine_decoder);
195 if (decoderinfo) IWICBitmapDecoderInfo_Release(decoderinfo);
196 IUnknown_Release(unkdecoderinfo);
197 if (found) break;
198 }
199
200 IEnumUnknown_Release(enumdecoders);
202 return res;
203}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
Definition: info.c:2339
GLuint res
Definition: glext.h:9613
static unsigned __int64 next
Definition: rand_nt.c:6
uint32_t ULONG
Definition: typedefs.h:59
@ WICComponentEnumerateDefault
Definition: wincodec.idl:143
@ WICDecoder
Definition: wincodec.idl:126

Referenced by ImagingFactory_CreateDecoderFromStream().

◆ foreach_component()

static HRESULT foreach_component ( DWORD  mask,
iterator_func  func,
struct iterator_context context 
)
static

Definition at line 1398 of file imgfactory.c.

1399{
1400 enum iterator_result ret;
1401 IEnumUnknown *enumerator;
1402 IUnknown *item;
1403 HRESULT hr;
1404
1406 return hr;
1407
1408 while (IEnumUnknown_Next(enumerator, 1, &item, NULL) == S_OK)
1409 {
1410 *context->result = NULL;
1411
1412 ret = func(item, context);
1413 IUnknown_Release(item);
1414
1415 if (ret == ITER_SKIP)
1416 continue;
1417
1418 break;
1419 }
1420
1421 IEnumUnknown_Release(enumerator);
1422
1423 return *context->result ? S_OK : WINCODEC_ERR_COMPONENTNOTFOUND;
1424}
GLenum func
Definition: glext.h:6028
GLenum GLint GLuint mask
Definition: glext.h:6028
iterator_result
Definition: imgfactory.c:1256
int ret

Referenced by ComponentFactory_CreateMetadataReader(), and ComponentFactory_CreateMetadataReaderFromContainer().

◆ get_16bpp_format()

static BOOL get_16bpp_format ( HBITMAP  hbm,
WICPixelFormatGUID format 
)
static

Definition at line 681 of file imgfactory.c.

682{
683 BOOL ret = TRUE;
684 BITMAPV4HEADER bmh;
685 HDC hdc;
686
688
689 memset(&bmh, 0, sizeof(bmh));
690 bmh.bV4Size = sizeof(bmh);
691 bmh.bV4Width = 1;
692 bmh.bV4Height = 1;
694 bmh.bV4BitCount = 16;
695
696 GetDIBits(hdc, hbm, 0, 0, NULL, (BITMAPINFO *)&bmh, DIB_RGB_COLORS);
697
698 if (bmh.bV4RedMask == 0x7c00 &&
699 bmh.bV4GreenMask == 0x3e0 &&
700 bmh.bV4BlueMask == 0x1f)
701 {
702 *format = GUID_WICPixelFormat16bppBGR555;
703 }
704 else if (bmh.bV4RedMask == 0xf800 &&
705 bmh.bV4GreenMask == 0x7e0 &&
706 bmh.bV4BlueMask == 0x1f)
707 {
708 *format = GUID_WICPixelFormat16bppBGR565;
709 }
710 else
711 {
712 FIXME("unrecognized bitfields %lx,%lx,%lx\n", bmh.bV4RedMask,
713 bmh.bV4GreenMask, bmh.bV4BlueMask);
714 ret = FALSE;
715 }
716
717 DeleteDC(hdc);
718 return ret;
719}
#define BI_BITFIELDS
Definition: mmreg.h:507
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define memset(x, y, z)
Definition: compat.h:39
DWORD bV4GreenMask
Definition: wingdi.h:1504
DWORD bV4V4Compression
Definition: wingdi.h:1497
LONG bV4Height
Definition: wingdi.h:1494
DWORD bV4RedMask
Definition: wingdi.h:1503
LONG bV4Width
Definition: wingdi.h:1493
WORD bV4BitCount
Definition: wingdi.h:1496
DWORD bV4BlueMask
Definition: wingdi.h:1505
DWORD bV4Size
Definition: wingdi.h:1492
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by ImagingFactory_CreateBitmapFromHBITMAP().

◆ ImagingFactory_AddRef()

static ULONG WINAPI ImagingFactory_AddRef ( IWICImagingFactory2 iface)
static

Definition at line 81 of file imgfactory.c.

82{
85
86 TRACE("(%p) refcount=%lu\n", iface, ref);
87
88 return ref;
89}
#define InterlockedIncrement
Definition: armddk.h:53
static ImagingFactory * impl_from_IWICImagingFactory2(IWICImagingFactory2 *iface)
Definition: imgfactory.c:48
Definition: send.c:48

◆ ImagingFactory_CreateBitmap()

static HRESULT WINAPI ImagingFactory_CreateBitmap ( IWICImagingFactory2 iface,
UINT  uiWidth,
UINT  uiHeight,
REFWICPixelFormatGUID  pixelFormat,
WICBitmapCreateCacheOption  option,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 482 of file imgfactory.c.

485{
486 TRACE("(%p,%u,%u,%s,%u,%p)\n", iface, uiWidth, uiHeight,
487 debugstr_guid(pixelFormat), option, ppIBitmap);
488 return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, 0, pixelFormat, option, ppIBitmap);
489}

◆ ImagingFactory_CreateBitmapClipper()

static HRESULT WINAPI ImagingFactory_CreateBitmapClipper ( IWICImagingFactory2 iface,
IWICBitmapClipper **  ppIBitmapClipper 
)
static

Definition at line 447 of file imgfactory.c.

449{
450 TRACE("(%p,%p)\n", iface, ppIBitmapClipper);
451 return BitmapClipper_Create(ppIBitmapClipper);
452}
HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper)
Definition: clipper.c:243

◆ ImagingFactory_CreateBitmapFlipRotator()

static HRESULT WINAPI ImagingFactory_CreateBitmapFlipRotator ( IWICImagingFactory2 iface,
IWICBitmapFlipRotator **  ppIBitmapFlipRotator 
)
static

Definition at line 454 of file imgfactory.c.

456{
457 TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
458 return FlipRotator_Create(ppIBitmapFlipRotator);
459}
HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator)
Definition: fliprotate.c:266

◆ ImagingFactory_CreateBitmapFromHBITMAP()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromHBITMAP ( IWICImagingFactory2 iface,
HBITMAP  hbm,
HPALETTE  hpal,
WICBitmapAlphaChannelOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 721 of file imgfactory.c.

723{
724 BITMAP bm;
725 HRESULT hr;
728 UINT size, num_palette_entries = 0;
729 PALETTEENTRY entry[256];
730
731 TRACE("(%p,%p,%p,%u,%p)\n", iface, hbm, hpal, option, bitmap);
732
733 if (!bitmap) return E_INVALIDARG;
734
735 if (GetObjectW(hbm, sizeof(bm), &bm) != sizeof(bm))
737
738 if (hpal)
739 {
740 num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry);
741 if (!num_palette_entries)
743 }
744
745 /* TODO: Figure out the correct format for 16, 32, 64 bpp */
746 switch(bm.bmBitsPixel)
747 {
748 case 1:
749 format = GUID_WICPixelFormat1bppIndexed;
750 break;
751 case 4:
752 format = GUID_WICPixelFormat4bppIndexed;
753 break;
754 case 8:
755 format = GUID_WICPixelFormat8bppIndexed;
756 break;
757 case 16:
759 return E_INVALIDARG;
760 break;
761 case 24:
762 format = GUID_WICPixelFormat24bppBGR;
763 break;
764 case 32:
765 switch (option)
766 {
768 format = GUID_WICPixelFormat32bppBGRA;
769 break;
771 format = GUID_WICPixelFormat32bppPBGRA;
772 break;
774 format = GUID_WICPixelFormat32bppBGR;
775 break;
776 default:
777 return E_INVALIDARG;
778 }
779 break;
780 case 48:
781 format = GUID_WICPixelFormat48bppRGB;
782 break;
783 default:
784 FIXME("unsupported %d bpp\n", bm.bmBitsPixel);
785 return E_INVALIDARG;
786 }
787
788 hr = BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, 0, &format,
790 if (hr != S_OK) return hr;
791
792 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
793 if (hr == S_OK)
794 {
795 BYTE *buffer;
796 HDC hdc;
797#ifdef __REACTOS__
798 char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
799#else
800 char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
801#endif
802 BITMAPINFO *bmi = (BITMAPINFO *)bmibuf;
803
804 IWICBitmapLock_GetDataPointer(lock, &size, &buffer);
805
807
808 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
809 bmi->bmiHeader.biBitCount = 0;
810 GetDIBits(hdc, hbm, 0, 0, NULL, bmi, DIB_RGB_COLORS);
811 bmi->bmiHeader.biHeight = -bm.bmHeight;
812 GetDIBits(hdc, hbm, 0, bm.bmHeight, buffer, bmi, DIB_RGB_COLORS);
813
814 DeleteDC(hdc);
815 IWICBitmapLock_Release(lock);
816
817 if (num_palette_entries)
818 {
820 WICColor colors[256];
821 UINT i;
822
824 if (hr == S_OK)
825 {
826 for (i = 0; i < num_palette_entries; i++)
827 colors[i] = 0xff000000 | entry[i].peRed << 16 |
828 entry[i].peGreen << 8 | entry[i].peBlue;
829
830 hr = IWICPalette_InitializeCustom(palette, colors, num_palette_entries);
831 if (hr == S_OK)
832 hr = IWICBitmap_SetPalette(*bitmap, palette);
833
834 IWICPalette_Release(palette);
835 }
836 }
837 }
838
839 if (hr != S_OK)
840 {
841 IWICBitmap_Release(*bitmap);
842 *bitmap = NULL;
843 }
844
845 return hr;
846}
ULONG RGBQUAD
Definition: precomp.h:59
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format)
Definition: imgfactory.c:681
uint32_t entry
Definition: isohybrid.c:63
Definition: bl.h:1331
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
UINT32 WICColor
Definition: wincodec.idl:364
@ WICBitmapIgnoreAlpha
Definition: wincodec.idl:44
@ WICBitmapUseAlpha
Definition: wincodec.idl:42
@ WICBitmapUsePremultipliedAlpha
Definition: wincodec.idl:43
#define WINCODEC_ERR_WIN32ERROR
Definition: winerror.h:3319
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

◆ ImagingFactory_CreateBitmapFromHICON()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON ( IWICImagingFactory2 iface,
HICON  hicon,
IWICBitmap **  bitmap 
)
static

Definition at line 848 of file imgfactory.c.

850{
853 BITMAP bm;
854 int width, height, x, y;
856 BYTE *buffer;
857 DWORD *bits;
858 BITMAPINFO bi;
859 HDC hdc;
860 BOOL has_alpha;
861 HRESULT hr;
862
863 TRACE("(%p,%p,%p)\n", iface, hicon, bitmap);
864
865 if (!bitmap) return E_INVALIDARG;
866
867 if (!GetIconInfo(hicon, &info))
869
870 GetObjectW(info.hbmColor ? info.hbmColor : info.hbmMask, sizeof(bm), &bm);
871
872 width = bm.bmWidth;
873 height = info.hbmColor ? abs(bm.bmHeight) : abs(bm.bmHeight) / 2;
874 stride = width * 4;
875 size = stride * height;
876
878 &GUID_WICPixelFormat32bppBGRA, WICBitmapCacheOnLoad, bitmap);
879 if (hr != S_OK) goto failed;
880
881 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
882 if (hr != S_OK)
883 {
884 IWICBitmap_Release(*bitmap);
885 goto failed;
886 }
887 IWICBitmapLock_GetDataPointer(lock, &size, &buffer);
888
890
891 memset(&bi, 0, sizeof(bi));
892 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
894 bi.bmiHeader.biHeight = info.hbmColor ? -height: -height * 2;
895 bi.bmiHeader.biPlanes = 1;
896 bi.bmiHeader.biBitCount = 32;
898
899 has_alpha = FALSE;
900
901 if (info.hbmColor)
902 {
903 GetDIBits(hdc, info.hbmColor, 0, height, buffer, &bi, DIB_RGB_COLORS);
904
905 if (bm.bmBitsPixel == 32)
906 {
907 /* If any pixel has a non-zero alpha, ignore hbmMask */
908 DWORD *ptr = (DWORD *)buffer;
909 DWORD *end = ptr + width * height;
910 while (ptr != end)
911 {
912 if (*ptr++ & 0xff000000)
913 {
914 has_alpha = TRUE;
915 break;
916 }
917 }
918 }
919 }
920 else
921 GetDIBits(hdc, info.hbmMask, 0, height, buffer, &bi, DIB_RGB_COLORS);
922
923 if (!has_alpha)
924 {
925 DWORD *rgba;
926
927 if (info.hbmMask)
928 {
929 BYTE *mask;
930
931 mask = malloc(size);
932 if (!mask)
933 {
934 IWICBitmapLock_Release(lock);
935 IWICBitmap_Release(*bitmap);
936 DeleteDC(hdc);
938 goto failed;
939 }
940
941 /* read alpha data from the mask */
942 GetDIBits(hdc, info.hbmMask, info.hbmColor ? 0 : height, height, mask, &bi, DIB_RGB_COLORS);
943
944 for (y = 0; y < height; y++)
945 {
946 rgba = (DWORD *)(buffer + y * stride);
947 bits = (DWORD *)(mask + y * stride);
948
949 for (x = 0; x < width; x++, rgba++, bits++)
950 {
951 if (*bits)
952 *rgba = 0;
953 else
954 *rgba |= 0xff000000;
955 }
956 }
957
958 free(mask);
959 }
960 else
961 {
962 /* set constant alpha of 255 */
963 for (y = 0; y < height; y++)
964 {
965 rgba = (DWORD *)(buffer + y * stride);
966 for (x = 0; x < width; x++, rgba++)
967 *rgba |= 0xff000000;
968 }
969 }
970
971 }
972
973 IWICBitmapLock_Release(lock);
974 DeleteDC(hdc);
975
976failed:
977 DeleteObject(info.hbmColor);
978 DeleteObject(info.hbmMask);
979
980 return hr;
981}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define BI_RGB
Definition: precomp.h:56
#define abs(i)
Definition: fconv.c:206
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLuint GLuint end
Definition: gl.h:1545
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15
static PVOID ptr
Definition: dispmode.c:27
ULONG biCompression
Definition: precomp.h:47
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2131

◆ ImagingFactory_CreateBitmapFromMemory()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromMemory ( IWICImagingFactory2 iface,
UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
UINT  stride,
UINT  size,
BYTE buffer,
IWICBitmap **  bitmap 
)
static

Definition at line 645 of file imgfactory.c.

648{
649 HRESULT hr;
650
651 TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height,
653
654 if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG;
655
657 if (SUCCEEDED(hr))
658 {
660
661 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
662 if (SUCCEEDED(hr))
663 {
664 UINT buffersize;
665 BYTE *data;
666
667 IWICBitmapLock_GetDataPointer(lock, &buffersize, &data);
668 memcpy(data, buffer, buffersize);
669
670 IWICBitmapLock_Release(lock);
671 }
672 else
673 {
674 IWICBitmap_Release(*bitmap);
675 *bitmap = NULL;
676 }
677 }
678 return hr;
679}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ ImagingFactory_CreateBitmapFromSource()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromSource ( IWICImagingFactory2 iface,
IWICBitmapSource piBitmapSource,
WICBitmapCreateCacheOption  option,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 619 of file imgfactory.c.

622{
623 TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
624
625 return create_bitmap_from_source_rect(piBitmapSource, NULL, option, ppIBitmap);
626}
static HRESULT create_bitmap_from_source_rect(IWICBitmapSource *piBitmapSource, const WICRect *rect, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
Definition: imgfactory.c:491

◆ ImagingFactory_CreateBitmapFromSourceRect()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromSourceRect ( IWICImagingFactory2 iface,
IWICBitmapSource piBitmapSource,
UINT  x,
UINT  y,
UINT  width,
UINT  height,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 628 of file imgfactory.c.

631{
633
634 TRACE("(%p,%p,%u,%u,%u,%u,%p)\n", iface, piBitmapSource, x, y, width,
635 height, ppIBitmap);
636
637 rect.X = x;
638 rect.Y = y;
639 rect.Width = width;
640 rect.Height = height;
641
642 return create_bitmap_from_source_rect(piBitmapSource, &rect, WICBitmapCacheOnLoad, ppIBitmap);
643}

◆ ImagingFactory_CreateBitmapScaler()

static HRESULT WINAPI ImagingFactory_CreateBitmapScaler ( IWICImagingFactory2 iface,
IWICBitmapScaler **  ppIBitmapScaler 
)
static

Definition at line 439 of file imgfactory.c.

441{
442 TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
443
444 return BitmapScaler_Create(ppIBitmapScaler);
445}
HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler)
Definition: scaler.c:513

◆ ImagingFactory_CreateColorContext()

static HRESULT WINAPI ImagingFactory_CreateColorContext ( IWICImagingFactory2 iface,
IWICColorContext **  ppIColorContext 
)
static

Definition at line 468 of file imgfactory.c.

470{
471 TRACE("(%p,%p)\n", iface, ppIColorContext);
472 return ColorContext_Create(ppIColorContext);
473}
HRESULT ColorContext_Create(IWICColorContext **colorcontext)
Definition: colorcontext.c:256

◆ ImagingFactory_CreateColorTransformer()

static HRESULT WINAPI ImagingFactory_CreateColorTransformer ( IWICImagingFactory2 iface,
IWICColorTransform **  ppIColorTransform 
)
static

Definition at line 475 of file imgfactory.c.

477{
478 TRACE("(%p,%p)\n", iface, ppIColorTransform);
479 return ColorTransform_Create(ppIColorTransform);
480}
HRESULT ColorTransform_Create(IWICColorTransform **colortransform)

◆ ImagingFactory_CreateComponentEnumerator()

static HRESULT WINAPI ImagingFactory_CreateComponentEnumerator ( IWICImagingFactory2 iface,
DWORD  componentTypes,
DWORD  options,
IEnumUnknown **  ppIEnumUnknown 
)
static

Definition at line 983 of file imgfactory.c.

985{
986 TRACE("(%p,%lu,%lu,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
987 return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
988}

◆ ImagingFactory_CreateComponentInfo()

static HRESULT WINAPI ImagingFactory_CreateComponentInfo ( IWICImagingFactory2 iface,
REFCLSID  clsidComponent,
IWICComponentInfo **  ppIInfo 
)
static

Definition at line 271 of file imgfactory.c.

273{
274 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
275 return CreateComponentInfo(clsidComponent, ppIInfo);
276}

◆ ImagingFactory_CreateDecoder()

static HRESULT WINAPI ImagingFactory_CreateDecoder ( IWICImagingFactory2 iface,
REFGUID  guidContainerFormat,
const GUID pguidVendor,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 278 of file imgfactory.c.

281{
282 IEnumUnknown *enumdecoders;
283 IUnknown *unkdecoderinfo;
284 IWICBitmapDecoderInfo *decoderinfo;
285 IWICBitmapDecoder *decoder = NULL, *preferred_decoder = NULL;
286 GUID vendor;
287 HRESULT res;
288 ULONG num_fetched;
289
290 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
291 debugstr_guid(pguidVendor), ppIDecoder);
292
293 if (!guidContainerFormat || !ppIDecoder) return E_INVALIDARG;
294
296 if (FAILED(res)) return res;
297
298 while (!preferred_decoder)
299 {
300 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
301 if (res != S_OK) break;
302
303 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void **)&decoderinfo);
304 if (SUCCEEDED(res))
305 {
306 GUID container_guid;
307
308 res = IWICBitmapDecoderInfo_GetContainerFormat(decoderinfo, &container_guid);
309 if (SUCCEEDED(res) && IsEqualIID(&container_guid, guidContainerFormat))
310 {
311 IWICBitmapDecoder *new_decoder;
312
313 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &new_decoder);
314 if (SUCCEEDED(res))
315 {
316 if (pguidVendor)
317 {
318 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
319 if (SUCCEEDED(res) && IsEqualIID(&vendor, pguidVendor))
320 {
321 preferred_decoder = new_decoder;
322 new_decoder = NULL;
323 }
324 }
325
326 if (new_decoder && !decoder)
327 {
328 decoder = new_decoder;
329 new_decoder = NULL;
330 }
331
332 if (new_decoder) IWICBitmapDecoder_Release(new_decoder);
333 }
334 }
335
336 IWICBitmapDecoderInfo_Release(decoderinfo);
337 }
338
339 IUnknown_Release(unkdecoderinfo);
340 }
341
342 IEnumUnknown_Release(enumdecoders);
343
344 if (preferred_decoder)
345 {
346 *ppIDecoder = preferred_decoder;
347 if (decoder) IWICBitmapDecoder_Release(decoder);
348 return S_OK;
349 }
350
351 if (decoder)
352 {
353 *ppIDecoder = decoder;
354 return S_OK;
355 }
356
357 *ppIDecoder = NULL;
359}

◆ ImagingFactory_CreateDecoderFromFileHandle()

static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle ( IWICImagingFactory2 iface,
ULONG_PTR  hFile,
const GUID pguidVendor,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 247 of file imgfactory.c.

250{
252 HRESULT hr;
253
254 TRACE("(%p,%Ix,%s,%u,%p)\n", iface, hFile, debugstr_guid(pguidVendor),
255 metadataOptions, ppIDecoder);
256
258 if (SUCCEEDED(hr))
259 {
261 if (SUCCEEDED(hr))
262 {
263 hr = IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream,
264 pguidVendor, metadataOptions, ppIDecoder);
265 }
266 IWICStream_Release(stream);
267 }
268 return hr;
269}
HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE file)
Definition: stream.c:1043
HRESULT StreamImpl_Create(IWICStream **stream)
Definition: stream.c:1158

◆ ImagingFactory_CreateDecoderFromFilename()

static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename ( IWICImagingFactory2 iface,
LPCWSTR  wzFilename,
const GUID pguidVendor,
DWORD  dwDesiredAccess,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 104 of file imgfactory.c.

108{
110 HRESULT hr;
111
112 TRACE("(%p,%s,%s,%lu,%u,%p)\n", iface, debugstr_w(wzFilename),
113 debugstr_guid(pguidVendor), dwDesiredAccess, metadataOptions, ppIDecoder);
114
116 if (SUCCEEDED(hr))
117 {
118 hr = IWICStream_InitializeFromFilename(stream, wzFilename, dwDesiredAccess);
119
120 if (SUCCEEDED(hr))
121 {
122 hr = IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream,
123 pguidVendor, metadataOptions, ppIDecoder);
124 }
125
126 IWICStream_Release(stream);
127 }
128
129 return hr;
130}
#define debugstr_w
Definition: kernel32.h:32

◆ ImagingFactory_CreateDecoderFromStream()

static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream ( IWICImagingFactory2 iface,
IStream pIStream,
const GUID pguidVendor,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 205 of file imgfactory.c.

208{
209 HRESULT res;
211
212 TRACE("(%p,%p,%s,%u,%p)\n", iface, pIStream, debugstr_guid(pguidVendor),
213 metadataOptions, ppIDecoder);
214
215 if (pguidVendor)
216 res = find_decoder(pIStream, pguidVendor, metadataOptions, &decoder);
217 if (!decoder)
218 res = find_decoder(pIStream, NULL, metadataOptions, &decoder);
219
220 if (decoder)
221 {
222 *ppIDecoder = decoder;
223 return S_OK;
224 }
225 else
226 {
227 if (WARN_ON(wincodecs))
228 {
230 BYTE data[4];
231 ULONG bytesread;
232
233 WARN("failed to load from a stream %#lx\n", res);
234
235 seek.QuadPart = 0;
236 if (IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL) == S_OK)
237 {
238 if (IStream_Read(pIStream, data, 4, &bytesread) == S_OK)
239 WARN("first %li bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]);
240 }
241 }
242 *ppIDecoder = NULL;
243 return res;
244 }
245}
static HRESULT find_decoder(IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **decoder)
Definition: imgfactory.c:132
#define WARN_ON(c)
Definition: module.h:257
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51

◆ ImagingFactory_CreateEncoder()

static HRESULT WINAPI ImagingFactory_CreateEncoder ( IWICImagingFactory2 iface,
REFGUID  guidContainerFormat,
const GUID pguidVendor,
IWICBitmapEncoder **  ppIEncoder 
)
static

Definition at line 361 of file imgfactory.c.

364{
365 static int fixme=0;
366 IEnumUnknown *enumencoders;
367 IUnknown *unkencoderinfo;
368 IWICBitmapEncoderInfo *encoderinfo;
371 ULONG num_fetched;
372 GUID actual_containerformat;
373
374 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
375 debugstr_guid(pguidVendor), ppIEncoder);
376
377 if (pguidVendor && !fixme++)
378 FIXME("ignoring vendor GUID\n");
379
381 if (FAILED(res)) return res;
382
383 while (!encoder)
384 {
385 res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched);
386
387 if (res == S_OK)
388 {
389 res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo);
390
391 if (SUCCEEDED(res))
392 {
393 res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat);
394
395 if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat))
396 {
397 res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder);
398 if (FAILED(res))
399 encoder = NULL;
400 }
401
402 IWICBitmapEncoderInfo_Release(encoderinfo);
403 }
404
405 IUnknown_Release(unkencoderinfo);
406 }
407 else
408 break;
409 }
410
411 IEnumUnknown_Release(enumencoders);
412
413 if (encoder)
414 {
415 *ppIEncoder = encoder;
416 return S_OK;
417 }
418 else
419 {
420 WARN("failed to create encoder\n");
421 *ppIEncoder = NULL;
423 }
424}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
@ WICEncoder
Definition: wincodec.idl:127

◆ ImagingFactory_CreateFastMetadataEncoderFromDecoder()

static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder ( IWICImagingFactory2 iface,
IWICBitmapDecoder pIDecoder,
IWICFastMetadataEncoder **  ppIFastEncoder 
)
static

Definition at line 990 of file imgfactory.c.

993{
994 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
995 return E_NOTIMPL;
996}

◆ ImagingFactory_CreateFastMetadataEncoderFromFrameDecode()

static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode ( IWICImagingFactory2 iface,
IWICBitmapFrameDecode pIFrameDecoder,
IWICFastMetadataEncoder **  ppIFastEncoder 
)
static

Definition at line 998 of file imgfactory.c.

1001{
1002 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
1003 return E_NOTIMPL;
1004}

◆ ImagingFactory_CreateFormatConverter()

static HRESULT WINAPI ImagingFactory_CreateFormatConverter ( IWICImagingFactory2 iface,
IWICFormatConverter **  ppIFormatConverter 
)
static

Definition at line 433 of file imgfactory.c.

435{
436 return FormatConverter_CreateInstance(&IID_IWICFormatConverter, (void**)ppIFormatConverter);
437}
HRESULT FormatConverter_CreateInstance(REFIID iid, void **ppv)
Definition: converter.c:1953

◆ ImagingFactory_CreateImageEncoder()

static HRESULT WINAPI ImagingFactory_CreateImageEncoder ( IWICImagingFactory2 iface,
ID2D1Device *  device,
IWICImageEncoder **  encoder 
)
static

Definition at line 1025 of file imgfactory.c.

1026{
1027 FIXME("%p,%p,%p stub.\n", iface, device, encoder);
1028 return E_NOTIMPL;
1029}
Definition: devices.h:37

◆ ImagingFactory_CreateInstance()

HRESULT ImagingFactory_CreateInstance ( REFIID  iid,
void **  ppv 
)

Definition at line 1606 of file imgfactory.c.

1607{
1609 HRESULT ret;
1610
1611 TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
1612
1613 *ppv = NULL;
1614
1615 This = malloc(sizeof(*This));
1616 if (!This) return E_OUTOFMEMORY;
1617
1618 This->IWICImagingFactory2_iface.lpVtbl = &ImagingFactory_Vtbl;
1619 This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
1620 This->ref = 1;
1621
1622 ret = IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, ppv);
1623 IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
1624
1625 return ret;
1626}
static const IWICImagingFactory2Vtbl ImagingFactory_Vtbl
Definition: imgfactory.c:1032
static const IWICComponentFactoryVtbl ComponentFactory_Vtbl
Definition: imgfactory.c:1568

Referenced by WICCreateImagingFactory_Proxy().

◆ ImagingFactory_CreatePalette()

static HRESULT WINAPI ImagingFactory_CreatePalette ( IWICImagingFactory2 iface,
IWICPalette **  ppIPalette 
)
static

Definition at line 426 of file imgfactory.c.

428{
429 TRACE("(%p,%p)\n", iface, ppIPalette);
430 return PaletteImpl_Create(ppIPalette);
431}

◆ ImagingFactory_CreateQueryWriter()

static HRESULT WINAPI ImagingFactory_CreateQueryWriter ( IWICImagingFactory2 iface,
REFGUID  guidMetadataFormat,
const GUID pguidVendor,
IWICMetadataQueryWriter **  ppIQueryWriter 
)
static

Definition at line 1006 of file imgfactory.c.

1009{
1010 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
1011 debugstr_guid(pguidVendor), ppIQueryWriter);
1012 return E_NOTIMPL;
1013}

◆ ImagingFactory_CreateQueryWriterFromReader()

static HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader ( IWICImagingFactory2 iface,
IWICMetadataQueryReader pIQueryReader,
const GUID pguidVendor,
IWICMetadataQueryWriter **  ppIQueryWriter 
)
static

Definition at line 1015 of file imgfactory.c.

1018{
1019 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
1020 ppIQueryWriter);
1021 return E_NOTIMPL;
1022}

◆ ImagingFactory_CreateStream()

static HRESULT WINAPI ImagingFactory_CreateStream ( IWICImagingFactory2 iface,
IWICStream **  ppIWICStream 
)
static

Definition at line 461 of file imgfactory.c.

463{
464 TRACE("(%p,%p)\n", iface, ppIWICStream);
465 return StreamImpl_Create(ppIWICStream);
466}

◆ ImagingFactory_QueryInterface()

static HRESULT WINAPI ImagingFactory_QueryInterface ( IWICImagingFactory2 iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 53 of file imgfactory.c.

55{
57 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
58
59 if (!ppv) return E_INVALIDARG;
60
61 if (IsEqualIID(&IID_IUnknown, iid) ||
62 IsEqualIID(&IID_IWICImagingFactory, iid) ||
63 IsEqualIID(&IID_IWICComponentFactory, iid))
64 {
65 *ppv = &This->IWICComponentFactory_iface;
66 }
67 else if (IsEqualIID(&IID_IWICImagingFactory2, iid))
68 {
69 *ppv = &This->IWICImagingFactory2_iface;
70 }
71 else
72 {
73 *ppv = NULL;
74 return E_NOINTERFACE;
75 }
76
77 IUnknown_AddRef((IUnknown*)*ppv);
78 return S_OK;
79}
const GUID IID_IUnknown
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ImagingFactory_Release()

static ULONG WINAPI ImagingFactory_Release ( IWICImagingFactory2 iface)
static

Definition at line 91 of file imgfactory.c.

92{
95
96 TRACE("(%p) refcount=%lu\n", iface, ref);
97
98 if (ref == 0)
99 free(This);
100
101 return ref;
102}
#define InterlockedDecrement
Definition: armddk.h:52

◆ impl_from_IWICComponentFactory()

◆ impl_from_IWICImagingFactory2()

static ImagingFactory * impl_from_IWICImagingFactory2 ( IWICImagingFactory2 iface)
inlinestatic

Definition at line 48 of file imgfactory.c.

49{
50 return CONTAINING_RECORD(iface, ImagingFactory, IWICImagingFactory2_iface);
51}

Referenced by ImagingFactory_AddRef(), ImagingFactory_QueryInterface(), and ImagingFactory_Release().

◆ WICCreateBitmapFromSection()

HRESULT WINAPI WICCreateBitmapFromSection ( UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
HANDLE  section,
UINT  stride,
UINT  offset,
IWICBitmap **  bitmap 
)

Definition at line 1677 of file imgfactory.c.

1680{
1681 TRACE("%u,%u,%s,%p,%u,%u,%p\n", width, height, debugstr_guid(format),
1683
1686}
GLintptr offset
Definition: glext.h:5920
HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap)
Definition: imgfactory.c:1628
Definition: parser.c:56
@ WICSectionAccessLevelRead
Definition: wincodec.idl:192

◆ WICCreateBitmapFromSectionEx()

HRESULT WINAPI WICCreateBitmapFromSectionEx ( UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
HANDLE  section,
UINT  stride,
UINT  offset,
WICSectionAccessLevel  wicaccess,
IWICBitmap **  bitmap 
)

Definition at line 1628 of file imgfactory.c.

1631{
1633 UINT bpp, access, size, view_offset, view_size;
1634 void *view;
1635 HRESULT hr;
1636
1637 TRACE("%u,%u,%s,%p,%u,%u,%#x,%p\n", width, height, debugstr_guid(format),
1638 section, stride, offset, wicaccess, bitmap);
1639
1640 if (!width || !height || !section || !bitmap) return E_INVALIDARG;
1641
1643 if (FAILED(hr)) return hr;
1644
1645 switch (wicaccess)
1646 {
1649 break;
1650
1653 break;
1654
1655 default:
1656 FIXME("unsupported access %#x\n", wicaccess);
1657 return E_INVALIDARG;
1658 }
1659
1660 if (!stride) stride = (((bpp * width) + 31) / 32) * 4;
1661 size = stride * height;
1662 if (size / height != stride) return E_INVALIDARG;
1663
1665 view_offset = offset - (offset % sysinfo.dwAllocationGranularity);
1666 view_size = size + (offset - view_offset);
1667
1668 view = MapViewOfFile(section, access, 0, view_offset, view_size);
1669 if (!view) return HRESULT_FROM_WIN32(GetLastError());
1670
1671 offset -= view_offset;
1674 return hr;
1675}
DWORD bpp
Definition: surface.c:185
#define UnmapViewOfFile
Definition: compat.h:746
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
SYSTEM_INFO sysinfo
Definition: dbghelp.c:76
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
Definition: main.c:62
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
DWORD dwAllocationGranularity
Definition: winbase.h:1204
#define FILE_MAP_WRITE
Definition: winbase.h:155
@ WICSectionAccessLevelReadWrite
Definition: wincodec.idl:193

Referenced by WICCreateBitmapFromSection().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wincodecs  )

Variable Documentation

◆ ComponentFactory_Vtbl

const IWICComponentFactoryVtbl ComponentFactory_Vtbl
static

Definition at line 1568 of file imgfactory.c.

Referenced by ImagingFactory_CreateInstance().

◆ ImagingFactory_Vtbl

const IWICImagingFactory2Vtbl ImagingFactory_Vtbl
static

Definition at line 1032 of file imgfactory.c.

Referenced by ImagingFactory_CreateInstance().