104 *
ppv = &
This->IWICBitmapFrameDecode_iface;
120 return IWICBitmapDecoder_AddRef(&
This->IWICBitmapDecoder_iface);
127 return IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
134 TRACE(
"(%p,%p,%p)\n", iface, puiWidth, puiHeight);
144 *puiWidth =
This->bih.bV5Width;
145 *puiHeight =
abs(
This->bih.bV5Height);
154 TRACE(
"(%p,%p)\n", iface, pPixelFormat);
163 LONG resx = 0, resy = 0;
165 switch (bih->bV5Size)
174 case sizeof(BITMAPV5HEADER):
175 resx = bih->bV5XPelsPerMeter;
176 resy = bih->bV5YPelsPerMeter;
187 *pDpiX = resx * 0.0254;
188 *pDpiY = resy * 0.0254;
195 double *pDpiX,
double *pDpiY)
198 TRACE(
"(%p,%p,%p)\n", iface, pDpiX, pDpiY);
212 TRACE(
"(%p,%p)\n", iface, pIPalette);
222 ULONG tablesize, bytesread;
229 bgrcolors =
malloc(tablesize);
230 if (!wiccolors || !bgrcolors)
240 hr = IStream_Read(
This->stream, bgrcolors, tablesize, &bytesread);
242 if (bytesread != tablesize) {
249 wiccolors[
i] = 0xff000000|
251 (bgrcolors[
i].rgbtGreen<<8)|
263 if (
This->bih.bV5BitCount <= 8)
265 ULONG tablesize, bytesread;
269 if (
This->bih.bV5ClrUsed == 0)
275 wiccolors =
malloc(tablesize);
286 hr = IStream_Read(
This->stream, wiccolors, tablesize, &bytesread);
288 if (bytesread != tablesize) {
295 wiccolors[
i] |= 0xff000000;
309 hr = IWICPalette_InitializeCustom(pIPalette, wiccolors,
count);
325 if (!
This->imagedata)
337 prc, cbStride, cbBufferSize, pbBuffer);
343 TRACE(
"(%p,%p)\n", iface, ppIMetadataQueryReader);
350 TRACE(
"(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
357 TRACE(
"(%p,%p)\n", iface, ppIThumbnail);
382 bottomup = (
This->bih.bV5Height > 0);
386 bytesperrow = (((
width *
This->bitsperpixel)+31)/32)*4;
393 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
401 This->imagedatastart =
This->imagedata + (
height-1) * bytesperrow;
402 This->stride = -bytesperrow;
406 This->imagedatastart =
This->imagedata;
407 This->stride = bytesperrow;
424 hr = IWICBitmapFrameDecode_GetSize(&
This->IWICBitmapFrameDecode_iface, &
width, &
height);
456 hr = IWICBitmapFrameDecode_GetSize(&
This->IWICBitmapFrameDecode_iface, &
width, &
height);
477 if (*bytesread == 0 || *
cursor == *bytesread)
509 bytesperrow =
width * 4;
511 if (
This->bih.bV5ClrUsed &&
This->bih.bV5ClrUsed < 256)
512 palettesize = 4 *
This->bih.bV5ClrUsed;
514 palettesize = 4 * 256;
517 if (!
This->imagedata)
525 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
528 hr = IStream_Read(
This->stream,
palette, palettesize, &bytesread);
529 if (
FAILED(
hr) || bytesread != palettesize)
goto fail;
533 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
606 This->imagedatastart =
This->imagedata + (
height-1) * bytesperrow;
607 This->stride = -bytesperrow;
633 bytesperrow =
width * 4;
635 if (
This->bih.bV5ClrUsed &&
This->bih.bV5ClrUsed < 16)
636 palettesize = 4 *
This->bih.bV5ClrUsed;
638 palettesize = 4 * 16;
641 if (!
This->imagedata)
649 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
652 hr = IStream_Read(
This->stream,
palette, palettesize, &bytesread);
653 if (
FAILED(
hr) || bytesread != palettesize)
goto fail;
657 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
736 bgrdata[
y*
width +
x++] = color1;
738 bgrdata[
y*
width +
x++] = color2;
746 This->imagedatastart =
This->imagedata + (
height-1) * bytesperrow;
747 This->stride = -bytesperrow;
800 ULONG bytestoread, bytesread;
821 if (bytesread !=
sizeof(
DWORD) ||
826 This->bih.bV5Size !=
sizeof(BITMAPV5HEADER)))
return E_FAIL;
828 bytestoread =
This->bih.bV5Size-
sizeof(
DWORD);
829 hr = IStream_Read(
stream, &
This->bih.bV5Width, bytestoread, &bytesread);
831 if (bytestoread != bytesread)
return E_FAIL;
834 This->palette_offset =
This->bih.bV5Size;
847 This->bih.bV5Height /= 2;
856 hr = IStream_Read(
stream, &
This->bih.bV5RedMask, 12, &bytesread);
858 if (bytesread != 12)
return E_FAIL;
859 This->bih.bV5AlphaMask = 0;
860 This->palette_offset += 12;
873 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
876 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
879 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
882 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
885 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
888 This->pixelformat = &GUID_WICPixelFormatUndefined;
889 WARN(
"unsupported bit depth %i for BITMAPCOREHEADER\n", bch->
bcBitCount);
895 TRACE(
"bitmap header=%li compression=%li depth=%i\n",
This->bih.bV5Size,
This->bih.bV5Compression,
This->bih.bV5BitCount);
896 switch(
This->bih.bV5Compression)
899 This->bitsperpixel =
This->bih.bV5BitCount;
901 switch(
This->bih.bV5BitCount)
904 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
907 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
910 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
913 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
916 This->pixelformat = &GUID_WICPixelFormat16bppBGR555;
919 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
922 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
925 This->pixelformat = &GUID_WICPixelFormatUndefined;
926 FIXME(
"unsupported bit depth %i for uncompressed RGB\n",
This->bih.bV5BitCount);
930 This->bitsperpixel = 32;
932 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
935 This->bitsperpixel = 32;
937 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
945 This->bitsperpixel = 0;
947 This->pixelformat = &GUID_WICPixelFormatUndefined;
948 FIXME(
"Huffman 1D compression is unsupported\n");
951 This->bitsperpixel =
This->bih.bV5BitCount;
954 if ((
format->bitcount ==
This->bih.bV5BitCount) &&
956 (
format->greenmask ==
This->bih.bV5GreenMask) &&
957 (
format->bluemask ==
This->bih.bV5BlueMask) &&
958 (
format->alphamask ==
This->bih.bV5AlphaMask))
960 This->read_data_func =
format->read_data_func;
968 This->pixelformat = &GUID_WICPixelFormatUndefined;
969 FIXME(
"unsupported bitfields type depth=%i red=%lx green=%lx blue=%lx alpha=%lx\n",
970 This->bih.bV5BitCount,
This->bih.bV5RedMask,
This->bih.bV5GreenMask,
This->bih.bV5BlueMask,
This->bih.bV5AlphaMask);
975 This->bitsperpixel = 0;
977 This->pixelformat = &GUID_WICPixelFormatUndefined;
978 FIXME(
"unsupported bitmap type header=%li compression=%li depth=%i\n",
This->bih.bV5Size,
This->bih.bV5Compression,
This->bih.bV5BitCount);
987 if (
This->bih.bV5ClrUsed)
988 palette_count =
This->bih.bV5ClrUsed;
989 else if (
This->bih.bV5BitCount <= 8)
990 palette_count = 1 <<
This->bih.bV5BitCount;
1016 *
ppv = &
This->IWICBitmapDecoder_iface;
1033 TRACE(
"(%p) refcount=%lu\n", iface,
ref);
1043 TRACE(
"(%p) refcount=%lu\n", iface,
ref);
1047 if (
This->stream) IStream_Release(
This->stream);
1049 This->lock.DebugInfo->Spare[0] = 0;
1085 This->stream = pIStream;
1086 IStream_AddRef(pIStream);
1094 GUID *pguidContainerFormat)
1096 memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp,
sizeof(
GUID));
1103 TRACE(
"(%p,%p)\n", iface, ppIDecoderInfo);
1111 TRACE(
"(%p,%p)\n", iface, pIPalette);
1119 TRACE(
"(%p,%p)\n", iface, ppIMetadataQueryReader);
1126 TRACE(
"(%p,%p)\n", iface, ppIBitmapSource);
1133 TRACE(
"(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
1140 TRACE(
"(%p,%p)\n", iface, ppIThumbnail);
1162 *ppIBitmapFrame = &
This->IWICBitmapFrameDecode_iface;
1163 IWICBitmapDecoder_AddRef(iface);
1203 This->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": BmpDecoder.lock");
1205 This->icoframe = icoframe;
1224 ret = IWICBitmapDecoder_QueryInterface(&
This->IWICBitmapDecoder_iface, iid,
ppv);
1225 IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
1247 *ppDecoder = &
This->IWICBitmapDecoder_iface;
1260 IWICBitmapFrameDecode_GetSize(&
This->IWICBitmapFrameDecode_iface, &
width, &
height);
1261 bytesperrow = (((
width *
This->bitsperpixel)+31)/32)*4;
1268 *topdown =
This->stride > 0;
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static ULONG WINAPI BmpDecoder_AddRef(IWICBitmapDecoder *iface)
static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette)
static HRESULT WINAPI BmpDecoder_GetContainerFormat(IWICBitmapDecoder *iface, GUID *pguidContainerFormat)
static HRESULT WINAPI BmpDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface)
static HRESULT WINAPI BmpDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream, DWORD *capability)
HRESULT DibDecoder_CreateInstance(REFIID iid, void **ppv)
static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, void **ppv)
HRESULT(* ReadDataFunc)(BmpDecoder *This)
static const IWICBitmapFrameDecodeVtbl BmpDecoder_FrameVtbl
static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecoder)
static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder *This)
static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *pIPalette)
static BmpDecoder * impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
void BmpDecoder_GetWICDecoder(BmpDecoder *This, IWICBitmapDecoder **ppDecoder)
static HRESULT WINAPI BmpDecoder_GetFrame(IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
static HRESULT BmpFrameDecode_ReadABGRasBGR(BmpDecoder *This)
void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown)
static HRESULT BmpDecoder_Construct(int packed, int icoframe, REFIID iid, void **ppv)
static HRESULT WINAPI BmpDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, void **ppv)
static const struct bitfields_format bitfields_formats[]
static HRESULT BmpFrameDecode_ReadUnsupported(BmpDecoder *This)
static HRESULT WINAPI BmpDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail)
static HRESULT WINAPI BmpDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream, WICDecodeOptions cacheOptions)
HRESULT BmpDecoder_CreateInstance(REFIID iid, void **ppv)
static HRESULT WINAPI BmpDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
static HRESULT WINAPI BmpDecoder_GetFrameCount(IWICBitmapDecoder *iface, UINT *pCount)
static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY)
static HRESULT BmpFrameDecode_ReadRGB8(BmpDecoder *This)
static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder *This)
HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder)
static const IWICBitmapDecoderVtbl BmpDecoder_Vtbl
static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder *This)
static HRESULT WINAPI BmpFrameDecode_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail)
static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo)
static ULONG WINAPI BmpFrameDecode_Release(IWICBitmapFrameDecode *iface)
static HRESULT BmpDecoder_ReadHeaders(BmpDecoder *This, IStream *stream)
static HRESULT WINAPI BmpFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
static HRESULT ReadByte(IStream *stream, BYTE *buffer, ULONG buffer_size, ULONG *cursor, ULONG *bytesread, BYTE *result)
static HRESULT WINAPI BmpDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource)
static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface, WICPixelFormatGUID *pPixelFormat)
static BmpDecoder * impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface)
static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, double *pDpiY)
static ULONG WINAPI BmpFrameDecode_AddRef(IWICBitmapFrameDecode *iface)
static HRESULT WINAPI BmpFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
static HRESULT WINAPI BmpFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight)
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
void copy_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *size, const struct pixel_format_desc *format) DECLSPEC_HIDDEN
static unsigned int palette_size(DWORD flags)
static GpStatus get_decoder_info(IStream *stream, const struct image_codec **result)
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLuint GLsizei GLsizei * length
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
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
#define memcpy(s1, s2, n)
#define IsEqualIID(riid1, riid2)
int seek(void *fd, ulong off, int mode)
wchar_t const *const size_t const buffer_size
IWICBitmapDecoder IWICBitmapDecoder_iface
const WICPixelFormatGUID * pixelformat
ReadDataFunc read_data_func
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define CONTAINING_RECORD(address, type, field)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
@ WICDecodeMetadataCacheOnDemand
@ WICBitmapDecoderCapabilityCanDecodeAllImages
void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride)
static const char * debug_wic_rect(const WICRect *rect)
#define WINCODEC_ERR_WRONGSTATE
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
#define WINCODEC_ERR_PALETTEUNAVAILABLE
#define WINCODEC_ERR_CODECNOTHUMBNAIL
#define WINCODEC_ERR_FRAMEMISSING
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
struct tagRGBTRIPLE RGBTRIPLE
struct tagBITMAPCOREHEADER BITMAPCOREHEADER
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO