52#define IMAGETYPE_COLORMAPPED 1
53#define IMAGETYPE_TRUECOLOR 2
54#define IMAGETYPE_GRAYSCALE 3
55#define IMAGETYPE_RLE 8
57#define IMAGE_ATTRIBUTE_BITCOUNT_MASK 0xf
58#define IMAGE_RIGHTTOLEFT 0x10
59#define IMAGE_TOPTOBOTTOM 0x20
72 char author_comments[324];
90#define ATTRIBUTE_NO_ALPHA 0
91#define ATTRIBUTE_UNDEFINED 1
92#define ATTRIBUTE_UNDEFINED_PRESERVE 2
93#define ATTRIBUTE_ALPHA 3
94#define ATTRIBUTE_PALPHA 4
138 *
ppv = &
This->IWICBitmapDecoder_iface;
155 TRACE(
"(%p) refcount=%lu\n", iface,
ref);
165 TRACE(
"(%p) refcount=%lu\n", iface,
ref);
169 This->lock.DebugInfo->Spare[0] = 0;
172 IStream_Release(
This->stream);
205 int attribute_bitcount;
208 TRACE(
"(%p,%p,%u)\n", iface, pIStream, cacheOptions);
212 if (
This->initialized)
219 hr = IStream_Seek(pIStream,
seek, STREAM_SEEK_SET,
NULL);
225 TRACE(
"got only %lu bytes\n", bytesread);
230 TRACE(
"imagetype=%u, colormap type=%u, depth=%u, image descriptor=0x%x\n",
231 This->header.image_type,
This->header.colormap_type,
232 This->header.depth,
This->header.image_descriptor);
236 switch (
This->header.image_type)
240 if (
This->header.colormap_type != 1)
242 mapped_depth =
This->header.colormap_entrysize;
246 if (
This->header.colormap_type != 0 &&
This->header.colormap_type != 1)
248 mapped_depth =
This->header.depth;
252 if (
This->header.colormap_type != 0)
260 if (
This->header.depth != 8 &&
This->header.depth != 16 &&
261 This->header.depth != 24 &&
This->header.depth != 32)
264 if ((
This->header.image_descriptor & 0xc0) != 0)
269 if (attribute_bitcount &&
270 !((mapped_depth == 32 && attribute_bitcount == 8) ||
271 (mapped_depth == 16 && attribute_bitcount == 1)))
276 WARN(
"bad tga header\n");
282 This->colormap_offset =
This->id_offset +
This->header.id_length;
283 if (
This->header.colormap_type == 1)
284 This->colormap_length = ((
This->header.colormap_entrysize+7)/8) *
This->header.colormap_length;
286 This->colormap_length = 0;
287 This->image_offset =
This->colormap_offset +
This->colormap_length;
291 hr = IStream_Seek(pIStream,
seek, STREAM_SEEK_END,
NULL);
294 hr = IStream_Read(pIStream, &footer,
sizeof(
tga_footer), &bytesread);
297 TRACE(
"got only %lu footer bytes\n", bytesread);
308 This->extension_area_offset = 0;
309 This->developer_directory_offset = 0;
315 This->extension_area_offset = 0;
316 This->developer_directory_offset = 0;
320 if (
This->extension_area_offset)
322 seek.QuadPart =
This->extension_area_offset;
323 hr = IStream_Seek(pIStream,
seek, STREAM_SEEK_SET,
NULL);
329 TRACE(
"got only %lu extension area bytes\n", bytesread);
334 TRACE(
"extension area is only %u bytes long\n",
This->extension_area.size);
340 IStream_AddRef(pIStream);
341 This->stream = pIStream;
350 GUID *pguidContainerFormat)
352 memcpy(pguidContainerFormat, &GUID_WineContainerFormatTga,
sizeof(
GUID));
359 TRACE(
"(%p,%p)\n", iface, ppIDecoderInfo);
367 FIXME(
"(%p,%p): stub\n", iface, pIPalette);
374 FIXME(
"(%p,%p): stub\n", iface, ppIMetadataQueryReader);
381 FIXME(
"(%p,%p): stub\n", iface, ppIBitmapSource);
388 FIXME(
"(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
395 FIXME(
"(%p,%p): stub\n", iface, ppIThumbnail);
412 TRACE(
"(%p,%p)\n", iface, ppIBitmapFrame);
418 IWICBitmapDecoder_AddRef(iface);
419 *ppIBitmapFrame = &
This->IWICBitmapFrameDecode_iface;
467 return IWICBitmapDecoder_AddRef(&
This->IWICBitmapDecoder_iface);
473 return IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
481 *puiWidth =
This->header.width;
482 *puiHeight =
This->header.height;
484 TRACE(
"(%p)->(%u,%u)\n", iface, *puiWidth, *puiHeight);
493 int attribute_bitcount;
496 TRACE(
"(%p,%p)\n", iface, pPixelFormat);
500 if (attribute_bitcount &&
This->extension_area_offset)
501 attribute_type =
This->extension_area.attributes_type;
502 else if (attribute_bitcount)
510 switch (
This->header.depth)
513 memcpy(pPixelFormat, &GUID_WICPixelFormat8bppIndexed,
sizeof(
GUID));
516 FIXME(
"Unhandled indexed color depth %u\n",
This->header.depth);
521 switch (
This->header.depth)
524 switch (attribute_type)
529 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGR555,
sizeof(
GUID));
533 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGRA5551,
sizeof(
GUID));
536 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
541 memcpy(pPixelFormat, &GUID_WICPixelFormat24bppBGR,
sizeof(
GUID));
544 switch (attribute_type)
549 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGR,
sizeof(
GUID));
552 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGRA,
sizeof(
GUID));
555 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppPBGRA,
sizeof(
GUID));
558 FIXME(
"Unhandled 32-bit attribute type %u\n", attribute_type);
563 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
568 switch (
This->header.depth)
571 memcpy(pPixelFormat, &GUID_WICPixelFormat8bppGray,
sizeof(
GUID));
574 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppGray,
sizeof(
GUID));
577 FIXME(
"Unhandled grayscale depth %u\n",
This->header.depth);
582 ERR(
"Unknown image type %u\n",
This->header.image_type);
590 double *pDpiX,
double *pDpiY)
592 FIXME(
"(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
603 WORD *wcolormap_data;
604 DWORD *dwcolormap_data;
607 int depth, attribute_bitcount, attribute_type;
610 TRACE(
"(%p,%p)\n", iface, pIPalette);
612 if (!
This->colormap_length)
614 WARN(
"no colormap present in this file\n");
618 if (
This->header.colormap_firstentry +
This->header.colormap_length > 256)
620 FIXME(
"cannot read colormap with %i entries starting at %i\n",
621 This->header.colormap_firstentry +
This->header.colormap_length,
622 This->header.colormap_firstentry);
626 colormap_data =
malloc(
This->colormap_length);
629 wcolormap_data = (
WORD*)colormap_data;
630 dwcolormap_data = (
DWORD*)colormap_data;
634 seek.QuadPart =
This->colormap_offset;
639 hr = IStream_Read(
This->stream, colormap_data,
This->colormap_length, &bytesread);
642 WARN(
"expected %li bytes in colormap, got %li\n",
This->colormap_length, bytesread);
653 if (attribute_bitcount &&
This->extension_area_offset)
654 attribute_type =
This->extension_area.attributes_type;
655 else if (attribute_bitcount)
667 memset(colors, 0,
sizeof(colors));
669 color = &colors[
This->header.colormap_firstentry];
675 switch (attribute_type)
680 for (
i=0;
i<
This->header.colormap_length;
i++)
682 WORD srcval = wcolormap_data[
i];
683 *
color++=0xff000000 |
684 ((srcval << 9) & 0xf80000) |
685 ((srcval << 4) & 0x070000) |
686 ((srcval << 6) & 0x00f800) |
687 ((srcval << 1) & 0x000700) |
688 ((srcval << 3) & 0x0000f8) |
689 ((srcval >> 2) & 0x000007);
694 for (
i=0;
i<
This->header.colormap_length;
i++)
696 WORD srcval = wcolormap_data[
i];
697 *
color++=((srcval & 0x8000) ? 0xff000000 : 0) |
698 ((srcval << 9) & 0xf80000) |
699 ((srcval << 4) & 0x070000) |
700 ((srcval << 6) & 0x00f800) |
701 ((srcval << 1) & 0x000700) |
702 ((srcval << 3) & 0x0000f8) |
703 ((srcval >> 2) & 0x000007);
707 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
712 for (
i=0;
i<
This->header.colormap_length;
i++)
714 *
color++=0xff000000 |
715 colormap_data[
i*3+2] |
716 colormap_data[
i*3+1] |
721 switch (attribute_type)
726 for (
i=0;
i<
This->header.colormap_length;
i++)
727 *
color++=dwcolormap_data[
i]|0xff000000;
730 for (
i=0;
i<
This->header.colormap_length;
i++)
731 *
color++=dwcolormap_data[
i];
736 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
741 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
749 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
756 int i=0,
j, bytesperpixel;
760 bytesperpixel =
This->header.depth / 8;
768 hr = IStream_Read(
This->stream, &rc, 1, &bytesread);
777 WARN(
"RLE packet too large\n");
785 hr = IStream_Read(
This->stream, pixeldata, bytesperpixel, &bytesread);
786 if (bytesread != bytesperpixel)
hr =
E_FAIL;
789 if (bytesperpixel == 1)
794 memcpy(&imagebits[
i+
j*bytesperpixel], pixeldata, bytesperpixel);
800 hr = IStream_Read(
This->stream, &imagebits[
i],
size, &bytesread);
823 if (!
This->imagebits)
827 FIXME(
"Right to left image reading not implemented\n");
863 This->stride =
This->header.width * (
This->header.depth / 8);
867 This->stride = -
This->header.width * (
This->header.depth / 8);
868 This->origin =
This->imagebits +
This->header.width * (
This->header.height - 1) * (
This->header.depth / 8);
897 prc, cbStride, cbBufferSize, pbBuffer);
906 FIXME(
"(%p,%p): stub\n", iface, ppIMetadataQueryReader);
913 FIXME(
"(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
920 FIXME(
"(%p,%p): stub\n", iface, ppIThumbnail);
961 This->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": TgaDecoder.lock");
963 ret = IWICBitmapDecoder_QueryInterface(&
This->IWICBitmapDecoder_iface, iid,
ppv);
964 IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
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 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 GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei count
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
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 GLint GLint j
#define memcpy(s1, s2, n)
#define IsEqualIID(riid1, riid2)
int seek(void *fd, ulong off, int mode)
tga_extension_area extension_area
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
ULONG developer_directory_offset
ULONG extension_area_offset
IWICBitmapDecoder IWICBitmapDecoder_iface
DWORD color_correction_offset
char software_version_letter
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
@ WICBitmapDecoderCapabilityCanDecodeSomeImages
@ WICBitmapDecoderCapabilityCanDecodeAllImages
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
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO