106 *
ppv = &
This->IWICBitmapFrameDecode_iface;
122 return IWICBitmapDecoder_AddRef(&
This->IWICBitmapDecoder_iface);
129 return IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
136 TRACE(
"(%p,%p,%p)\n", iface, puiWidth, puiHeight);
146 *puiWidth =
This->bih.bV5Width;
147 *puiHeight =
abs(
This->bih.bV5Height);
156 TRACE(
"(%p,%p)\n", iface, pPixelFormat);
165 LONG resx = 0, resy = 0;
167 switch (bih->bV5Size)
176 case sizeof(BITMAPV5HEADER):
177 resx = bih->bV5XPelsPerMeter;
178 resy = bih->bV5YPelsPerMeter;
189 *pDpiX = resx * 0.0254;
190 *pDpiY = resy * 0.0254;
197 double *pDpiX,
double *pDpiY)
200 TRACE(
"(%p,%p,%p)\n", iface, pDpiX, pDpiY);
214 TRACE(
"(%p,%p)\n", iface, pIPalette);
224 ULONG tablesize, bytesread;
232 if (!wiccolors || !bgrcolors)
242 hr = IStream_Read(
This->stream, bgrcolors, tablesize, &bytesread);
244 if (bytesread != tablesize) {
251 wiccolors[
i] = 0xff000000|
253 (bgrcolors[
i].rgbtGreen<<8)|
265 if (
This->bih.bV5BitCount <= 8)
267 ULONG tablesize, bytesread;
271 if (
This->bih.bV5ClrUsed == 0)
288 hr = IStream_Read(
This->stream, wiccolors, tablesize, &bytesread);
290 if (bytesread != tablesize) {
297 wiccolors[
i] |= 0xff000000;
311 hr = IWICPalette_InitializeCustom(pIPalette, wiccolors,
count);
327 if (!
This->imagedata)
339 prc, cbStride, cbBufferSize, pbBuffer);
345 TRACE(
"(%p,%p)\n", iface, ppIMetadataQueryReader);
352 TRACE(
"(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
359 TRACE(
"(%p,%p)\n", iface, ppIThumbnail);
384 bottomup = (
This->bih.bV5Height > 0);
388 bytesperrow = (((
width *
This->bitsperpixel)+31)/32)*4;
395 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
403 This->imagedatastart =
This->imagedata + (
height-1) * bytesperrow;
404 This->stride = -bytesperrow;
408 This->imagedatastart =
This->imagedata;
409 This->stride = bytesperrow;
425 hr = IWICBitmapFrameDecode_GetSize(&
This->IWICBitmapFrameDecode_iface, &
width, &
height);
446 if (*bytesread == 0 || *
cursor == *bytesread)
478 bytesperrow =
width * 4;
480 if (
This->bih.bV5ClrUsed &&
This->bih.bV5ClrUsed < 256)
481 palettesize = 4 *
This->bih.bV5ClrUsed;
483 palettesize = 4 * 256;
486 if (!
This->imagedata)
494 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
497 hr = IStream_Read(
This->stream,
palette, palettesize, &bytesread);
498 if (
FAILED(
hr) || bytesread != palettesize)
goto fail;
502 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
575 This->imagedatastart =
This->imagedata + (
height-1) * bytesperrow;
576 This->stride = -bytesperrow;
602 bytesperrow =
width * 4;
604 if (
This->bih.bV5ClrUsed &&
This->bih.bV5ClrUsed < 16)
605 palettesize = 4 *
This->bih.bV5ClrUsed;
607 palettesize = 4 * 16;
610 if (!
This->imagedata)
618 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
621 hr = IStream_Read(
This->stream,
palette, palettesize, &bytesread);
622 if (
FAILED(
hr) || bytesread != palettesize)
goto fail;
626 hr = IStream_Seek(
This->stream, offbits, STREAM_SEEK_SET,
NULL);
705 bgrdata[
y*
width +
x++] = color1;
707 bgrdata[
y*
width +
x++] = color2;
715 This->imagedatastart =
This->imagedata + (
height-1) * bytesperrow;
716 This->stride = -bytesperrow;
768 ULONG bytestoread, bytesread;
789 if (bytesread !=
sizeof(
DWORD) ||
794 This->bih.bV5Size !=
sizeof(BITMAPV5HEADER)))
return E_FAIL;
796 bytestoread =
This->bih.bV5Size-
sizeof(
DWORD);
797 hr = IStream_Read(
stream, &
This->bih.bV5Width, bytestoread, &bytesread);
799 if (bytestoread != bytesread)
return E_FAIL;
802 This->palette_offset =
This->bih.bV5Size;
815 This->bih.bV5Height /= 2;
824 hr = IStream_Read(
stream, &
This->bih.bV5RedMask, 12, &bytesread);
826 if (bytesread != 12)
return E_FAIL;
827 This->bih.bV5AlphaMask = 0;
828 This->palette_offset += 12;
841 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
844 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
847 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
850 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
853 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
856 This->pixelformat = &GUID_WICPixelFormatUndefined;
857 WARN(
"unsupported bit depth %i for BITMAPCOREHEADER\n", bch->
bcBitCount);
863 TRACE(
"bitmap header=%i compression=%i depth=%i\n",
This->bih.bV5Size,
This->bih.bV5Compression,
This->bih.bV5BitCount);
864 switch(
This->bih.bV5Compression)
867 This->bitsperpixel =
This->bih.bV5BitCount;
869 switch(
This->bih.bV5BitCount)
872 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
875 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
878 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
881 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
884 This->pixelformat = &GUID_WICPixelFormat16bppBGR555;
887 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
890 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
893 This->pixelformat = &GUID_WICPixelFormatUndefined;
894 FIXME(
"unsupported bit depth %i for uncompressed RGB\n",
This->bih.bV5BitCount);
898 This->bitsperpixel = 32;
900 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
903 This->bitsperpixel = 32;
905 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
913 This->bitsperpixel = 0;
915 This->pixelformat = &GUID_WICPixelFormatUndefined;
916 FIXME(
"Huffman 1D compression is unsupported\n");
919 This->bitsperpixel =
This->bih.bV5BitCount;
922 if ((
format->bitcount ==
This->bih.bV5BitCount) &&
924 (
format->greenmask ==
This->bih.bV5GreenMask) &&
925 (
format->bluemask ==
This->bih.bV5BlueMask) &&
926 (
format->alphamask ==
This->bih.bV5AlphaMask))
928 This->read_data_func =
format->read_data_func;
936 This->pixelformat = &GUID_WICPixelFormatUndefined;
937 FIXME(
"unsupported bitfields type depth=%i red=%x green=%x blue=%x alpha=%x\n",
938 This->bih.bV5BitCount,
This->bih.bV5RedMask,
This->bih.bV5GreenMask,
This->bih.bV5BlueMask,
This->bih.bV5AlphaMask);
943 This->bitsperpixel = 0;
945 This->pixelformat = &GUID_WICPixelFormatUndefined;
946 FIXME(
"unsupported bitmap type header=%i compression=%i depth=%i\n",
This->bih.bV5Size,
This->bih.bV5Compression,
This->bih.bV5BitCount);
955 if (
This->bih.bV5ClrUsed)
956 palette_count =
This->bih.bV5ClrUsed;
957 else if (
This->bih.bV5BitCount <= 8)
958 palette_count = 1 <<
This->bih.bV5BitCount;
984 *
ppv = &
This->IWICBitmapDecoder_iface;
1001 TRACE(
"(%p) refcount=%u\n", iface,
ref);
1011 TRACE(
"(%p) refcount=%u\n", iface,
ref);
1015 if (
This->stream) IStream_Release(
This->stream);
1017 This->lock.DebugInfo->Spare[0] = 0;
1053 This->stream = pIStream;
1054 IStream_AddRef(pIStream);
1062 GUID *pguidContainerFormat)
1064 memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp,
sizeof(
GUID));
1071 TRACE(
"(%p,%p)\n", iface, ppIDecoderInfo);
1079 TRACE(
"(%p,%p)\n", iface, pIPalette);
1087 TRACE(
"(%p,%p)\n", iface, ppIMetadataQueryReader);
1094 TRACE(
"(%p,%p)\n", iface, ppIBitmapSource);
1101 TRACE(
"(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
1108 TRACE(
"(%p,%p)\n", iface, ppIThumbnail);
1130 *ppIBitmapFrame = &
This->IWICBitmapFrameDecode_iface;
1131 IWICBitmapDecoder_AddRef(iface);
1167 This->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": BmpDecoder.lock");
1169 This->icoframe = icoframe;
1188 ret = IWICBitmapDecoder_QueryInterface(&
This->IWICBitmapDecoder_iface, iid,
ppv);
1189 IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
1211 *ppDecoder = &
This->IWICBitmapDecoder_iface;
1223 IWICBitmapFrameDecode_GetSize(&
This->IWICBitmapFrameDecode_iface, &
width, &
height);
1224 bytesperrow = (((
width *
This->bitsperpixel)+31)/32)*4;
1231 *topdown =
This->stride > 0;
static HRESULT BmpFrameDecode_ReadRGB8(BmpDecoder *This)
static HRESULT WINAPI BmpFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
GLint GLint GLsizei width
static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface, WICPixelFormatGUID *pPixelFormat)
static HRESULT ReadByte(IStream *stream, BYTE *buffer, ULONG buffer_size, ULONG *cursor, ULONG *bytesread, BYTE *result)
HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder)
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface)
static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo)
void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown)
HRESULT DibDecoder_CreateInstance(REFIID iid, void **ppv)
ReadDataFunc read_data_func
GLuint GLuint GLsizei count
static HRESULT WINAPI BmpDecoder_GetFrameCount(IWICBitmapDecoder *iface, UINT *pCount)
static ULONG WINAPI BmpFrameDecode_AddRef(IWICBitmapFrameDecode *iface)
GLint GLint GLint GLint GLint x
HRESULT BmpDecoder_CreateInstance(REFIID iid, void **ppv)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecoder)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static ULONG WINAPI BmpFrameDecode_Release(IWICBitmapFrameDecode *iface)
static HRESULT WINAPI BmpDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder *This)
void BmpDecoder_GetWICDecoder(BmpDecoder *This, IWICBitmapDecoder **ppDecoder)
static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder *This)
static HRESULT WINAPI BmpDecoder_GetFrame(IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
GLenum GLuint GLenum GLsizei length
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
static const struct bitfields_format bitfields_formats[]
#define WINCODEC_ERR_PALETTEUNAVAILABLE
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
static HRESULT WINAPI BmpDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail)
static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, double *pDpiY)
struct tagRGBTRIPLE RGBTRIPLE
IWICBitmapDecoder IWICBitmapDecoder_iface
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
HRESULT(* ReadDataFunc)(BmpDecoder *This)
static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static BmpDecoder * impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface)
struct tagBITMAPCOREHEADER BITMAPCOREHEADER
const WICPixelFormatGUID * pixelformat
#define WINCODEC_ERR_CODECNOTHUMBNAIL
static HRESULT BmpDecoder_ReadHeaders(BmpDecoder *This, IStream *stream)
static HRESULT WINAPI BmpFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
int seek(void *fd, ulong off, int mode)
static const IWICBitmapDecoderVtbl BmpDecoder_Vtbl
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
#define WINCODEC_ERR_FRAMEMISSING
#define InterlockedDecrement
static unsigned int palette_size(DWORD flags)
static HRESULT WINAPI BmpDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
static const char * debug_wic_rect(const WICRect *rect)
static HRESULT BmpDecoder_Construct(int packed, int icoframe, REFIID iid, void **ppv)
#define memcpy(s1, s2, n)
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
static HRESULT WINAPI BmpDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream, WICDecodeOptions cacheOptions)
static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder *This)
GLint GLint GLsizei GLsizei height
static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *pIPalette)
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 HRESULT BmpFrameDecode_ReadUnsupported(BmpDecoder *This)
static HRESULT WINAPI BmpDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource)
#define WINCODEC_ERR_WRONGSTATE
static GpStatus get_decoder_info(IStream *stream, const struct image_codec **result)
static HRESULT WINAPI BmpDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, void **ppv)
#define InterlockedIncrement
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
static BmpDecoder * impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
static HRESULT WINAPI BmpDecoder_GetContainerFormat(IWICBitmapDecoder *iface, GUID *pguidContainerFormat)
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight)
static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, void **ppv)
GLint GLint GLint GLint GLint GLint y
static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette)
static const IWICBitmapFrameDecodeVtbl BmpDecoder_FrameVtbl
void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride)
static ULONG WINAPI BmpDecoder_AddRef(IWICBitmapDecoder *iface)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI BmpFrameDecode_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail)
static HRESULT WINAPI BmpDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream, DWORD *capability)
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs)
static HRESULT WINAPI BmpFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
#define HeapFree(x, y, z)
#define IsEqualIID(riid1, riid2)