ReactOS 0.4.16-dev-1276-g70732b0
tgaformat.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for tgaformat.c:

Go to the source code of this file.

Classes

struct  tga_header
 
struct  tga_footer
 
struct  tga_extension_area
 
struct  TgaDecoder
 

Macros

#define COBJMACROS
 
#define IMAGETYPE_COLORMAPPED   1
 
#define IMAGETYPE_TRUECOLOR   2
 
#define IMAGETYPE_GRAYSCALE   3
 
#define IMAGETYPE_RLE   8
 
#define IMAGE_ATTRIBUTE_BITCOUNT_MASK   0xf
 
#define IMAGE_RIGHTTOLEFT   0x10
 
#define IMAGE_TOPTOBOTTOM   0x20
 
#define ATTRIBUTE_NO_ALPHA   0
 
#define ATTRIBUTE_UNDEFINED   1
 
#define ATTRIBUTE_UNDEFINED_PRESERVE   2
 
#define ATTRIBUTE_ALPHA   3
 
#define ATTRIBUTE_PALPHA   4
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wincodecs)
 
static TgaDecoderimpl_from_IWICBitmapDecoder (IWICBitmapDecoder *iface)
 
static TgaDecoderimpl_from_IWICBitmapFrameDecode (IWICBitmapFrameDecode *iface)
 
static HRESULT WINAPI TgaDecoder_QueryInterface (IWICBitmapDecoder *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI TgaDecoder_AddRef (IWICBitmapDecoder *iface)
 
static ULONG WINAPI TgaDecoder_Release (IWICBitmapDecoder *iface)
 
static HRESULT WINAPI TgaDecoder_QueryCapability (IWICBitmapDecoder *iface, IStream *stream, DWORD *capability)
 
static HRESULT WINAPI TgaDecoder_Initialize (IWICBitmapDecoder *iface, IStream *pIStream, WICDecodeOptions cacheOptions)
 
static HRESULT WINAPI TgaDecoder_GetContainerFormat (IWICBitmapDecoder *iface, GUID *pguidContainerFormat)
 
static HRESULT WINAPI TgaDecoder_GetDecoderInfo (IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo)
 
static HRESULT WINAPI TgaDecoder_CopyPalette (IWICBitmapDecoder *iface, IWICPalette *pIPalette)
 
static HRESULT WINAPI TgaDecoder_GetMetadataQueryReader (IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
 
static HRESULT WINAPI TgaDecoder_GetPreview (IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource)
 
static HRESULT WINAPI TgaDecoder_GetColorContexts (IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
 
static HRESULT WINAPI TgaDecoder_GetThumbnail (IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail)
 
static HRESULT WINAPI TgaDecoder_GetFrameCount (IWICBitmapDecoder *iface, UINT *pCount)
 
static HRESULT WINAPI TgaDecoder_GetFrame (IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
 
static HRESULT WINAPI TgaDecoder_Frame_QueryInterface (IWICBitmapFrameDecode *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI TgaDecoder_Frame_AddRef (IWICBitmapFrameDecode *iface)
 
static ULONG WINAPI TgaDecoder_Frame_Release (IWICBitmapFrameDecode *iface)
 
static HRESULT WINAPI TgaDecoder_Frame_GetSize (IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight)
 
static HRESULT WINAPI TgaDecoder_Frame_GetPixelFormat (IWICBitmapFrameDecode *iface, WICPixelFormatGUID *pPixelFormat)
 
static HRESULT WINAPI TgaDecoder_Frame_GetResolution (IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY)
 
static HRESULT WINAPI TgaDecoder_Frame_CopyPalette (IWICBitmapFrameDecode *iface, IWICPalette *pIPalette)
 
static HRESULT TgaDecoder_ReadRLE (TgaDecoder *This, BYTE *imagebits, int datasize)
 
static HRESULT TgaDecoder_ReadImage (TgaDecoder *This)
 
static HRESULT WINAPI TgaDecoder_Frame_CopyPixels (IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
 
static HRESULT WINAPI TgaDecoder_Frame_GetMetadataQueryReader (IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
 
static HRESULT WINAPI TgaDecoder_Frame_GetColorContexts (IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
 
static HRESULT WINAPI TgaDecoder_Frame_GetThumbnail (IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail)
 
HRESULT TgaDecoder_CreateInstance (REFIID iid, void **ppv)
 

Variables

static const BYTE tga_footer_magic [18] = "TRUEVISION-XFILE."
 
static const IWICBitmapDecoderVtbl TgaDecoder_Vtbl
 
static const IWICBitmapFrameDecodeVtbl TgaDecoder_Frame_Vtbl
 

Macro Definition Documentation

◆ ATTRIBUTE_ALPHA

#define ATTRIBUTE_ALPHA   3

Definition at line 93 of file tgaformat.c.

◆ ATTRIBUTE_NO_ALPHA

#define ATTRIBUTE_NO_ALPHA   0

Definition at line 90 of file tgaformat.c.

◆ ATTRIBUTE_PALPHA

#define ATTRIBUTE_PALPHA   4

Definition at line 94 of file tgaformat.c.

◆ ATTRIBUTE_UNDEFINED

#define ATTRIBUTE_UNDEFINED   1

Definition at line 91 of file tgaformat.c.

◆ ATTRIBUTE_UNDEFINED_PRESERVE

#define ATTRIBUTE_UNDEFINED_PRESERVE   2

Definition at line 92 of file tgaformat.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file tgaformat.c.

◆ IMAGE_ATTRIBUTE_BITCOUNT_MASK

#define IMAGE_ATTRIBUTE_BITCOUNT_MASK   0xf

Definition at line 57 of file tgaformat.c.

◆ IMAGE_RIGHTTOLEFT

#define IMAGE_RIGHTTOLEFT   0x10

Definition at line 58 of file tgaformat.c.

◆ IMAGE_TOPTOBOTTOM

#define IMAGE_TOPTOBOTTOM   0x20

Definition at line 59 of file tgaformat.c.

◆ IMAGETYPE_COLORMAPPED

#define IMAGETYPE_COLORMAPPED   1

Definition at line 52 of file tgaformat.c.

◆ IMAGETYPE_GRAYSCALE

#define IMAGETYPE_GRAYSCALE   3

Definition at line 54 of file tgaformat.c.

◆ IMAGETYPE_RLE

#define IMAGETYPE_RLE   8

Definition at line 55 of file tgaformat.c.

◆ IMAGETYPE_TRUECOLOR

#define IMAGETYPE_TRUECOLOR   2

Definition at line 53 of file tgaformat.c.

Function Documentation

◆ impl_from_IWICBitmapDecoder()

static TgaDecoder * impl_from_IWICBitmapDecoder ( IWICBitmapDecoder iface)
inlinestatic

Definition at line 118 of file tgaformat.c.

119{
120 return CONTAINING_RECORD(iface, TgaDecoder, IWICBitmapDecoder_iface);
121}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by TgaDecoder_AddRef(), TgaDecoder_GetFrame(), TgaDecoder_Initialize(), TgaDecoder_QueryInterface(), and TgaDecoder_Release().

◆ impl_from_IWICBitmapFrameDecode()

static TgaDecoder * impl_from_IWICBitmapFrameDecode ( IWICBitmapFrameDecode iface)
inlinestatic

◆ TgaDecoder_AddRef()

static ULONG WINAPI TgaDecoder_AddRef ( IWICBitmapDecoder iface)
static

Definition at line 150 of file tgaformat.c.

151{
154
155 TRACE("(%p) refcount=%lu\n", iface, ref);
156
157 return ref;
158}
#define InterlockedIncrement
Definition: armddk.h:53
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
static TgaDecoder * impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface)
Definition: tgaformat.c:118
uint32_t ULONG
Definition: typedefs.h:59

◆ TgaDecoder_CopyPalette()

static HRESULT WINAPI TgaDecoder_CopyPalette ( IWICBitmapDecoder iface,
IWICPalette pIPalette 
)
static

Definition at line 364 of file tgaformat.c.

366{
367 FIXME("(%p,%p): stub\n", iface, pIPalette);
368 return E_NOTIMPL;
369}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ TgaDecoder_CreateInstance()

HRESULT TgaDecoder_CreateInstance ( REFIID  iid,
void **  ppv 
)

Definition at line 938 of file tgaformat.c.

939{
941 HRESULT ret;
942
943 TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
944
945 *ppv = NULL;
946
947 This = malloc(sizeof(TgaDecoder));
948 if (!This) return E_OUTOFMEMORY;
949
950 This->IWICBitmapDecoder_iface.lpVtbl = &TgaDecoder_Vtbl;
951 This->IWICBitmapFrameDecode_iface.lpVtbl = &TgaDecoder_Frame_Vtbl;
952 This->ref = 1;
953 This->initialized = FALSE;
954 This->stream = NULL;
955 This->imagebits = NULL;
956#ifdef __REACTOS__
958#else
960#endif
961 This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": TgaDecoder.lock");
962
963 ret = IWICBitmapDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv);
964 IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
965
966 return ret;
967}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
static const IWICBitmapFrameDecodeVtbl TgaDecoder_Frame_Vtbl
Definition: tgaformat.c:924
static const IWICBitmapDecoderVtbl TgaDecoder_Vtbl
Definition: tgaformat.c:424
#define DWORD_PTR
Definition: treelist.c:76
int ret
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1116

◆ TgaDecoder_Frame_AddRef()

static ULONG WINAPI TgaDecoder_Frame_AddRef ( IWICBitmapFrameDecode iface)
static

Definition at line 464 of file tgaformat.c.

465{
467 return IWICBitmapDecoder_AddRef(&This->IWICBitmapDecoder_iface);
468}
static TgaDecoder * impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
Definition: tgaformat.c:123

◆ TgaDecoder_Frame_CopyPalette()

static HRESULT WINAPI TgaDecoder_Frame_CopyPalette ( IWICBitmapFrameDecode iface,
IWICPalette pIPalette 
)
static

Definition at line 596 of file tgaformat.c.

598{
601 WICColor colors[256], *color;
602 BYTE *colormap_data;
603 WORD *wcolormap_data;
604 DWORD *dwcolormap_data;
606 ULONG bytesread;
607 int depth, attribute_bitcount, attribute_type;
608 int i;
609
610 TRACE("(%p,%p)\n", iface, pIPalette);
611
612 if (!This->colormap_length)
613 {
614 WARN("no colormap present in this file\n");
616 }
617
618 if (This->header.colormap_firstentry + This->header.colormap_length > 256)
619 {
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);
623 return E_FAIL;
624 }
625
626 colormap_data = malloc(This->colormap_length);
627 if (!colormap_data) return E_OUTOFMEMORY;
628
629 wcolormap_data = (WORD*)colormap_data;
630 dwcolormap_data = (DWORD*)colormap_data;
631
633
634 seek.QuadPart = This->colormap_offset;
635 hr = IStream_Seek(This->stream, seek, STREAM_SEEK_SET, NULL);
636
637 if (SUCCEEDED(hr))
638 {
639 hr = IStream_Read(This->stream, colormap_data, This->colormap_length, &bytesread);
640 if (SUCCEEDED(hr) && bytesread != This->colormap_length)
641 {
642 WARN("expected %li bytes in colormap, got %li\n", This->colormap_length, bytesread);
643 hr = E_FAIL;
644 }
645 }
646
648
649 if (SUCCEEDED(hr))
650 {
651 attribute_bitcount = This->header.image_descriptor & IMAGE_ATTRIBUTE_BITCOUNT_MASK;
652
653 if (attribute_bitcount && This->extension_area_offset)
654 attribute_type = This->extension_area.attributes_type;
655 else if (attribute_bitcount)
656 attribute_type = ATTRIBUTE_ALPHA;
657 else
658 attribute_type = ATTRIBUTE_NO_ALPHA;
659
660 depth = This->header.colormap_entrysize;
661 if (depth == 15)
662 {
663 depth = 16;
664 attribute_type = ATTRIBUTE_NO_ALPHA;
665 }
666
667 memset(colors, 0, sizeof(colors));
668
669 color = &colors[This->header.colormap_firstentry];
670
671 /* Colormap entries can be in any truecolor format, and we have to convert them. */
672 switch (depth)
673 {
674 case 16:
675 switch (attribute_type)
676 {
680 for (i=0; i<This->header.colormap_length; i++)
681 {
682 WORD srcval = wcolormap_data[i];
683 *color++=0xff000000 | /* constant 255 alpha */
684 ((srcval << 9) & 0xf80000) | /* r */
685 ((srcval << 4) & 0x070000) | /* r - 3 bits */
686 ((srcval << 6) & 0x00f800) | /* g */
687 ((srcval << 1) & 0x000700) | /* g - 3 bits */
688 ((srcval << 3) & 0x0000f8) | /* b */
689 ((srcval >> 2) & 0x000007); /* b - 3 bits */
690 }
691 break;
692 case ATTRIBUTE_ALPHA:
693 case ATTRIBUTE_PALPHA:
694 for (i=0; i<This->header.colormap_length; i++)
695 {
696 WORD srcval = wcolormap_data[i];
697 *color++=((srcval & 0x8000) ? 0xff000000 : 0) | /* alpha */
698 ((srcval << 9) & 0xf80000) | /* r */
699 ((srcval << 4) & 0x070000) | /* r - 3 bits */
700 ((srcval << 6) & 0x00f800) | /* g */
701 ((srcval << 1) & 0x000700) | /* g - 3 bits */
702 ((srcval << 3) & 0x0000f8) | /* b */
703 ((srcval >> 2) & 0x000007); /* b - 3 bits */
704 }
705 break;
706 default:
707 FIXME("Unhandled 16-bit attribute type %u\n", attribute_type);
708 hr = E_NOTIMPL;
709 }
710 break;
711 case 24:
712 for (i=0; i<This->header.colormap_length; i++)
713 {
714 *color++=0xff000000 | /* alpha */
715 colormap_data[i*3+2] | /* red */
716 colormap_data[i*3+1] | /* green */
717 colormap_data[i*3]; /* blue */
718 }
719 break;
720 case 32:
721 switch (attribute_type)
722 {
726 for (i=0; i<This->header.colormap_length; i++)
727 *color++=dwcolormap_data[i]|0xff000000;
728 break;
729 case ATTRIBUTE_ALPHA:
730 for (i=0; i<This->header.colormap_length; i++)
731 *color++=dwcolormap_data[i];
732 break;
733 case ATTRIBUTE_PALPHA:
734 /* FIXME: Unpremultiply alpha */
735 default:
736 FIXME("Unhandled 16-bit attribute type %u\n", attribute_type);
737 hr = E_NOTIMPL;
738 }
739 break;
740 default:
741 FIXME("Unhandled truecolor depth %u\n", This->header.depth);
742 hr = E_NOTIMPL;
743 }
744 }
745
746 free(colormap_data);
747
748 if (SUCCEEDED(hr))
749 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
750
751 return hr;
752}
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
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
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
#define ATTRIBUTE_ALPHA
Definition: tgaformat.c:93
#define ATTRIBUTE_NO_ALPHA
Definition: tgaformat.c:90
#define IMAGE_ATTRIBUTE_BITCOUNT_MASK
Definition: tgaformat.c:57
#define ATTRIBUTE_UNDEFINED_PRESERVE
Definition: tgaformat.c:92
#define ATTRIBUTE_UNDEFINED
Definition: tgaformat.c:91
#define ATTRIBUTE_PALPHA
Definition: tgaformat.c:94
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
UINT32 WICColor
Definition: wincodec.idl:364
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3292
unsigned char BYTE
Definition: xxhash.c:193

◆ TgaDecoder_Frame_CopyPixels()

static HRESULT WINAPI TgaDecoder_Frame_CopyPixels ( IWICBitmapFrameDecode iface,
const WICRect prc,
UINT  cbStride,
UINT  cbBufferSize,
BYTE pbBuffer 
)
static

Definition at line 883 of file tgaformat.c.

885{
887 HRESULT hr;
888
889 TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
890
892
893 if (SUCCEEDED(hr))
894 {
895 hr = copy_pixels(This->header.depth, This->origin,
896 This->header.width, This->header.height, This->stride,
897 prc, cbStride, cbBufferSize, pbBuffer);
898 }
899
900 return hr;
901}
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
Definition: surface.c:1700
_Out_ LPRECT prc
Definition: ntgdi.h:1658
static HRESULT TgaDecoder_ReadImage(TgaDecoder *This)
Definition: tgaformat.c:811
static const char * debug_wic_rect(const WICRect *rect)

◆ TgaDecoder_Frame_GetColorContexts()

static HRESULT WINAPI TgaDecoder_Frame_GetColorContexts ( IWICBitmapFrameDecode iface,
UINT  cCount,
IWICColorContext **  ppIColorContexts,
UINT pcActualCount 
)
static

Definition at line 910 of file tgaformat.c.

912{
913 FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
915}
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
Definition: winerror.h:3308

◆ TgaDecoder_Frame_GetMetadataQueryReader()

static HRESULT WINAPI TgaDecoder_Frame_GetMetadataQueryReader ( IWICBitmapFrameDecode iface,
IWICMetadataQueryReader **  ppIMetadataQueryReader 
)
static

Definition at line 903 of file tgaformat.c.

905{
906 FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
908}

◆ TgaDecoder_Frame_GetPixelFormat()

static HRESULT WINAPI TgaDecoder_Frame_GetPixelFormat ( IWICBitmapFrameDecode iface,
WICPixelFormatGUID pPixelFormat 
)
static

Definition at line 489 of file tgaformat.c.

491{
493 int attribute_bitcount;
494 byte attribute_type;
495
496 TRACE("(%p,%p)\n", iface, pPixelFormat);
497
498 attribute_bitcount = This->header.image_descriptor & IMAGE_ATTRIBUTE_BITCOUNT_MASK;
499
500 if (attribute_bitcount && This->extension_area_offset)
501 attribute_type = This->extension_area.attributes_type;
502 else if (attribute_bitcount)
503 attribute_type = ATTRIBUTE_ALPHA;
504 else
505 attribute_type = ATTRIBUTE_NO_ALPHA;
506
507 switch (This->header.image_type & ~IMAGETYPE_RLE)
508 {
510 switch (This->header.depth)
511 {
512 case 8:
513 memcpy(pPixelFormat, &GUID_WICPixelFormat8bppIndexed, sizeof(GUID));
514 break;
515 default:
516 FIXME("Unhandled indexed color depth %u\n", This->header.depth);
517 return E_NOTIMPL;
518 }
519 break;
521 switch (This->header.depth)
522 {
523 case 16:
524 switch (attribute_type)
525 {
529 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGR555, sizeof(GUID));
530 break;
531 case ATTRIBUTE_ALPHA:
532 case ATTRIBUTE_PALPHA:
533 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGRA5551, sizeof(GUID));
534 break;
535 default:
536 FIXME("Unhandled 16-bit attribute type %u\n", attribute_type);
537 return E_NOTIMPL;
538 }
539 break;
540 case 24:
541 memcpy(pPixelFormat, &GUID_WICPixelFormat24bppBGR, sizeof(GUID));
542 break;
543 case 32:
544 switch (attribute_type)
545 {
549 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGR, sizeof(GUID));
550 break;
551 case ATTRIBUTE_ALPHA:
552 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGRA, sizeof(GUID));
553 break;
554 case ATTRIBUTE_PALPHA:
555 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppPBGRA, sizeof(GUID));
556 break;
557 default:
558 FIXME("Unhandled 32-bit attribute type %u\n", attribute_type);
559 return E_NOTIMPL;
560 }
561 break;
562 default:
563 FIXME("Unhandled truecolor depth %u\n", This->header.depth);
564 return E_NOTIMPL;
565 }
566 break;
568 switch (This->header.depth)
569 {
570 case 8:
571 memcpy(pPixelFormat, &GUID_WICPixelFormat8bppGray, sizeof(GUID));
572 break;
573 case 16:
574 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppGray, sizeof(GUID));
575 break;
576 default:
577 FIXME("Unhandled grayscale depth %u\n", This->header.depth);
578 return E_NOTIMPL;
579 }
580 break;
581 default:
582 ERR("Unknown image type %u\n", This->header.image_type);
583 return E_FAIL;
584 }
585
586 return S_OK;
587}
#define ERR(fmt,...)
Definition: precomp.h:57
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IMAGETYPE_COLORMAPPED
Definition: tgaformat.c:52
#define IMAGETYPE_GRAYSCALE
Definition: tgaformat.c:54
#define IMAGETYPE_RLE
Definition: tgaformat.c:55
#define IMAGETYPE_TRUECOLOR
Definition: tgaformat.c:53

◆ TgaDecoder_Frame_GetResolution()

static HRESULT WINAPI TgaDecoder_Frame_GetResolution ( IWICBitmapFrameDecode iface,
double pDpiX,
double pDpiY 
)
static

Definition at line 589 of file tgaformat.c.

591{
592 FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
593 return E_NOTIMPL;
594}

◆ TgaDecoder_Frame_GetSize()

static HRESULT WINAPI TgaDecoder_Frame_GetSize ( IWICBitmapFrameDecode iface,
UINT puiWidth,
UINT puiHeight 
)
static

Definition at line 476 of file tgaformat.c.

478{
480
481 *puiWidth = This->header.width;
482 *puiHeight = This->header.height;
483
484 TRACE("(%p)->(%u,%u)\n", iface, *puiWidth, *puiHeight);
485
486 return S_OK;
487}

◆ TgaDecoder_Frame_GetThumbnail()

static HRESULT WINAPI TgaDecoder_Frame_GetThumbnail ( IWICBitmapFrameDecode iface,
IWICBitmapSource **  ppIThumbnail 
)
static

Definition at line 917 of file tgaformat.c.

919{
920 FIXME("(%p,%p): stub\n", iface, ppIThumbnail);
922}
#define WINCODEC_ERR_CODECNOTHUMBNAIL
Definition: winerror.h:3291

◆ TgaDecoder_Frame_QueryInterface()

static HRESULT WINAPI TgaDecoder_Frame_QueryInterface ( IWICBitmapFrameDecode iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 441 of file tgaformat.c.

443{
444 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
445
446 if (!ppv) return E_INVALIDARG;
447
448 if (IsEqualIID(&IID_IUnknown, iid) ||
449 IsEqualIID(&IID_IWICBitmapSource, iid) ||
450 IsEqualIID(&IID_IWICBitmapFrameDecode, iid))
451 {
452 *ppv = iface;
453 }
454 else
455 {
456 *ppv = NULL;
457 return E_NOINTERFACE;
458 }
459
460 IUnknown_AddRef((IUnknown*)*ppv);
461 return S_OK;
462}
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ TgaDecoder_Frame_Release()

static ULONG WINAPI TgaDecoder_Frame_Release ( IWICBitmapFrameDecode iface)
static

Definition at line 470 of file tgaformat.c.

471{
473 return IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
474}

◆ TgaDecoder_GetColorContexts()

static HRESULT WINAPI TgaDecoder_GetColorContexts ( IWICBitmapDecoder iface,
UINT  cCount,
IWICColorContext **  ppIColorContexts,
UINT pcActualCount 
)
static

Definition at line 385 of file tgaformat.c.

387{
388 FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
390}

◆ TgaDecoder_GetContainerFormat()

static HRESULT WINAPI TgaDecoder_GetContainerFormat ( IWICBitmapDecoder iface,
GUID pguidContainerFormat 
)
static

Definition at line 349 of file tgaformat.c.

351{
352 memcpy(pguidContainerFormat, &GUID_WineContainerFormatTga, sizeof(GUID));
353 return S_OK;
354}

◆ TgaDecoder_GetDecoderInfo()

static HRESULT WINAPI TgaDecoder_GetDecoderInfo ( IWICBitmapDecoder iface,
IWICBitmapDecoderInfo **  ppIDecoderInfo 
)
static

Definition at line 356 of file tgaformat.c.

358{
359 TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
360
361 return get_decoder_info(&CLSID_WineTgaDecoder, ppIDecoderInfo);
362}
static GpStatus get_decoder_info(IStream *stream, const struct image_codec **result)
Definition: image.c:4285

◆ TgaDecoder_GetFrame()

static HRESULT WINAPI TgaDecoder_GetFrame ( IWICBitmapDecoder iface,
UINT  index,
IWICBitmapFrameDecode **  ppIBitmapFrame 
)
static

Definition at line 408 of file tgaformat.c.

410{
412 TRACE("(%p,%p)\n", iface, ppIBitmapFrame);
413
414 if (!This->initialized) return WINCODEC_ERR_FRAMEMISSING;
415
416 if (index != 0) return E_INVALIDARG;
417
418 IWICBitmapDecoder_AddRef(iface);
419 *ppIBitmapFrame = &This->IWICBitmapFrameDecode_iface;
420
421 return S_OK;
422}
GLuint index
Definition: glext.h:6031
#define WINCODEC_ERR_FRAMEMISSING
Definition: winerror.h:3301

◆ TgaDecoder_GetFrameCount()

static HRESULT WINAPI TgaDecoder_GetFrameCount ( IWICBitmapDecoder iface,
UINT pCount 
)
static

Definition at line 399 of file tgaformat.c.

401{
402 if (!pCount) return E_INVALIDARG;
403
404 *pCount = 1;
405 return S_OK;
406}

◆ TgaDecoder_GetMetadataQueryReader()

static HRESULT WINAPI TgaDecoder_GetMetadataQueryReader ( IWICBitmapDecoder iface,
IWICMetadataQueryReader **  ppIMetadataQueryReader 
)
static

Definition at line 371 of file tgaformat.c.

373{
374 FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
375 return E_NOTIMPL;
376}

◆ TgaDecoder_GetPreview()

static HRESULT WINAPI TgaDecoder_GetPreview ( IWICBitmapDecoder iface,
IWICBitmapSource **  ppIBitmapSource 
)
static

Definition at line 378 of file tgaformat.c.

380{
381 FIXME("(%p,%p): stub\n", iface, ppIBitmapSource);
383}

◆ TgaDecoder_GetThumbnail()

static HRESULT WINAPI TgaDecoder_GetThumbnail ( IWICBitmapDecoder iface,
IWICBitmapSource **  ppIThumbnail 
)
static

Definition at line 392 of file tgaformat.c.

394{
395 FIXME("(%p,%p): stub\n", iface, ppIThumbnail);
397}

◆ TgaDecoder_Initialize()

static HRESULT WINAPI TgaDecoder_Initialize ( IWICBitmapDecoder iface,
IStream pIStream,
WICDecodeOptions  cacheOptions 
)
static

Definition at line 197 of file tgaformat.c.

199{
202 DWORD bytesread;
204 tga_footer footer;
205 int attribute_bitcount;
206 int mapped_depth=0;
207
208 TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOptions);
209
211
212 if (This->initialized)
213 {
215 goto end;
216 }
217
218 seek.QuadPart = 0;
219 hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
220 if (FAILED(hr)) goto end;
221
222 hr = IStream_Read(pIStream, &This->header, sizeof(tga_header), &bytesread);
223 if (SUCCEEDED(hr) && bytesread != sizeof(tga_header))
224 {
225 TRACE("got only %lu bytes\n", bytesread);
226 hr = E_FAIL;
227 }
228 if (FAILED(hr)) goto end;
229
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);
233
234 /* Sanity checking. Since TGA has no clear identifying markers, we need
235 * to be careful to not load a non-TGA image. */
236 switch (This->header.image_type)
237 {
240 if (This->header.colormap_type != 1)
241 hr = E_FAIL;
242 mapped_depth = This->header.colormap_entrysize;
243 break;
246 if (This->header.colormap_type != 0 && This->header.colormap_type != 1)
247 hr = E_FAIL;
248 mapped_depth = This->header.depth;
249 break;
252 if (This->header.colormap_type != 0)
253 hr = E_FAIL;
254 mapped_depth = 0;
255 break;
256 default:
257 hr = E_FAIL;
258 }
259
260 if (This->header.depth != 8 && This->header.depth != 16 &&
261 This->header.depth != 24 && This->header.depth != 32)
262 hr = E_FAIL;
263
264 if ((This->header.image_descriptor & 0xc0) != 0)
265 hr = E_FAIL;
266
267 attribute_bitcount = This->header.image_descriptor & IMAGE_ATTRIBUTE_BITCOUNT_MASK;
268
269 if (attribute_bitcount &&
270 !((mapped_depth == 32 && attribute_bitcount == 8) ||
271 (mapped_depth == 16 && attribute_bitcount == 1)))
272 hr = E_FAIL;
273
274 if (FAILED(hr))
275 {
276 WARN("bad tga header\n");
277 goto end;
278 }
279
280 /* Locate data in the file based on the header. */
281 This->id_offset = sizeof(tga_header);
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;
285 else
286 This->colormap_length = 0;
287 This->image_offset = This->colormap_offset + This->colormap_length;
288
289 /* Read footer if there is one */
290 seek.QuadPart = -(LONGLONG)sizeof(tga_footer);
291 hr = IStream_Seek(pIStream, seek, STREAM_SEEK_END, NULL);
292
293 if (SUCCEEDED(hr)) {
294 hr = IStream_Read(pIStream, &footer, sizeof(tga_footer), &bytesread);
295 if (SUCCEEDED(hr) && bytesread != sizeof(tga_footer))
296 {
297 TRACE("got only %lu footer bytes\n", bytesread);
298 hr = E_FAIL;
299 }
300
301 if (memcmp(footer.magic, tga_footer_magic, sizeof(tga_footer_magic)) == 0)
302 {
303 This->extension_area_offset = footer.extension_area_offset;
304 This->developer_directory_offset = footer.developer_directory_offset;
305 }
306 else
307 {
308 This->extension_area_offset = 0;
309 This->developer_directory_offset = 0;
310 }
311 }
312 else
313 {
314 /* File is too small to have a footer. */
315 This->extension_area_offset = 0;
316 This->developer_directory_offset = 0;
317 hr = S_OK;
318 }
319
320 if (This->extension_area_offset)
321 {
322 seek.QuadPart = This->extension_area_offset;
323 hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
324 if (FAILED(hr)) goto end;
325
326 hr = IStream_Read(pIStream, &This->extension_area, sizeof(tga_extension_area), &bytesread);
327 if (SUCCEEDED(hr) && bytesread != sizeof(tga_extension_area))
328 {
329 TRACE("got only %lu extension area bytes\n", bytesread);
330 hr = E_FAIL;
331 }
332 if (SUCCEEDED(hr) && This->extension_area.size < 495)
333 {
334 TRACE("extension area is only %u bytes long\n", This->extension_area.size);
335 hr = E_FAIL;
336 }
337 if (FAILED(hr)) goto end;
338 }
339
340 IStream_AddRef(pIStream);
341 This->stream = pIStream;
342 This->initialized = TRUE;
343
344end:
346 return hr;
347}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define TRUE
Definition: types.h:120
GLuint GLuint end
Definition: gl.h:1545
#define FAILED(hr)
Definition: intsafe.h:51
static const BYTE tga_footer_magic[18]
Definition: tgaformat.c:67
int64_t LONGLONG
Definition: typedefs.h:68
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3281

◆ TgaDecoder_QueryCapability()

static HRESULT WINAPI TgaDecoder_QueryCapability ( IWICBitmapDecoder iface,
IStream stream,
DWORD capability 
)
static

Definition at line 180 of file tgaformat.c.

182{
183 HRESULT hr;
184
185 TRACE("(%p,%p,%p)\n", iface, stream, capability);
186
187 if (!stream || !capability) return E_INVALIDARG;
188
189 hr = IWICBitmapDecoder_Initialize(iface, stream, WICDecodeMetadataCacheOnDemand);
190 if (hr != S_OK) return hr;
191
194 return S_OK;
195}
Definition: parse.h:23
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:29
@ WICBitmapDecoderCapabilityCanDecodeSomeImages
Definition: wincodec.idl:51
@ WICBitmapDecoderCapabilityCanDecodeAllImages
Definition: wincodec.idl:50

◆ TgaDecoder_QueryInterface()

static HRESULT WINAPI TgaDecoder_QueryInterface ( IWICBitmapDecoder iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 128 of file tgaformat.c.

130{
132 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
133
134 if (!ppv) return E_INVALIDARG;
135
136 if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IWICBitmapDecoder, iid))
137 {
138 *ppv = &This->IWICBitmapDecoder_iface;
139 }
140 else
141 {
142 *ppv = NULL;
143 return E_NOINTERFACE;
144 }
145
146 IUnknown_AddRef((IUnknown*)*ppv);
147 return S_OK;
148}

◆ TgaDecoder_ReadImage()

static HRESULT TgaDecoder_ReadImage ( TgaDecoder This)
static

Definition at line 811 of file tgaformat.c.

812{
814 int datasize;
816 ULONG bytesread;
817
818 if (This->imagebits)
819 return S_OK;
820
822
823 if (!This->imagebits)
824 {
825 if (This->header.image_descriptor & IMAGE_RIGHTTOLEFT)
826 {
827 FIXME("Right to left image reading not implemented\n");
828 hr = E_NOTIMPL;
829 }
830
831 if (SUCCEEDED(hr))
832 {
833 datasize = This->header.width * This->header.height * (This->header.depth / 8);
834 This->imagebits = malloc(datasize);
835 if (!This->imagebits) hr = E_OUTOFMEMORY;
836 }
837
838 if (SUCCEEDED(hr))
839 {
840 seek.QuadPart = This->image_offset;
841 hr = IStream_Seek(This->stream, seek, STREAM_SEEK_SET, NULL);
842 }
843
844 if (SUCCEEDED(hr))
845 {
846 if (This->header.image_type & IMAGETYPE_RLE)
847 {
848 hr = TgaDecoder_ReadRLE(This, This->imagebits, datasize);
849 }
850 else
851 {
852 hr = IStream_Read(This->stream, This->imagebits, datasize, &bytesread);
853 if (SUCCEEDED(hr) && bytesread != datasize)
854 hr = E_FAIL;
855 }
856 }
857
858 if (SUCCEEDED(hr))
859 {
860 if (This->header.image_descriptor & IMAGE_TOPTOBOTTOM)
861 {
862 This->origin = This->imagebits;
863 This->stride = This->header.width * (This->header.depth / 8);
864 }
865 else
866 {
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);
869 }
870 }
871 else
872 {
873 free(This->imagebits);
874 This->imagebits = NULL;
875 }
876 }
877
879
880 return hr;
881}
static SIZE_T datasize
Definition: asm.c:30
static HRESULT TgaDecoder_ReadRLE(TgaDecoder *This, BYTE *imagebits, int datasize)
Definition: tgaformat.c:754
#define IMAGE_RIGHTTOLEFT
Definition: tgaformat.c:58
#define IMAGE_TOPTOBOTTOM
Definition: tgaformat.c:59

Referenced by TgaDecoder_Frame_CopyPixels().

◆ TgaDecoder_ReadRLE()

static HRESULT TgaDecoder_ReadRLE ( TgaDecoder This,
BYTE imagebits,
int  datasize 
)
static

Definition at line 754 of file tgaformat.c.

755{
756 int i=0, j, bytesperpixel;
757 ULONG bytesread;
759
760 bytesperpixel = This->header.depth / 8;
761
762 while (i<datasize)
763 {
764 BYTE rc;
765 int count, size;
766 BYTE pixeldata[4];
767
768 hr = IStream_Read(This->stream, &rc, 1, &bytesread);
769 if (bytesread != 1) hr = E_FAIL;
770 if (FAILED(hr)) break;
771
772 count = (rc&0x7f)+1;
773 size = count * bytesperpixel;
774
775 if (size + i > datasize)
776 {
777 WARN("RLE packet too large\n");
778 hr = E_FAIL;
779 break;
780 }
781
782 if (rc&0x80)
783 {
784 /* Run-length packet */
785 hr = IStream_Read(This->stream, pixeldata, bytesperpixel, &bytesread);
786 if (bytesread != bytesperpixel) hr = E_FAIL;
787 if (FAILED(hr)) break;
788
789 if (bytesperpixel == 1)
790 memset(&imagebits[i], pixeldata[0], count);
791 else
792 {
793 for (j=0; j<count; j++)
794 memcpy(&imagebits[i+j*bytesperpixel], pixeldata, bytesperpixel);
795 }
796 }
797 else
798 {
799 /* Raw packet */
800 hr = IStream_Read(This->stream, &imagebits[i], size, &bytesread);
801 if (bytesread != size) hr = E_FAIL;
802 if (FAILED(hr)) break;
803 }
804
805 i += size;
806 }
807
808 return hr;
809}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
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
Definition: glfuncs.h:250

Referenced by TgaDecoder_ReadImage().

◆ TgaDecoder_Release()

static ULONG WINAPI TgaDecoder_Release ( IWICBitmapDecoder iface)
static

Definition at line 160 of file tgaformat.c.

161{
164
165 TRACE("(%p) refcount=%lu\n", iface, ref);
166
167 if (ref == 0)
168 {
169 This->lock.DebugInfo->Spare[0] = 0;
171 if (This->stream)
172 IStream_Release(This->stream);
173 free(This->imagebits);
174 free(This);
175 }
176
177 return ref;
178}
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wincodecs  )

Variable Documentation

◆ tga_footer_magic

const BYTE tga_footer_magic[18] = "TRUEVISION-XFILE."
static

Definition at line 67 of file tgaformat.c.

Referenced by TgaDecoder_Initialize().

◆ TgaDecoder_Frame_Vtbl

const IWICBitmapFrameDecodeVtbl TgaDecoder_Frame_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI TgaDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *iface, WICPixelFormatGUID *pPixelFormat)
Definition: tgaformat.c:489
static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette)
Definition: tgaformat.c:596
static HRESULT WINAPI TgaDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight)
Definition: tgaformat.c:476
static HRESULT WINAPI TgaDecoder_Frame_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail)
Definition: tgaformat.c:917
static HRESULT WINAPI TgaDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
Definition: tgaformat.c:903
static ULONG WINAPI TgaDecoder_Frame_Release(IWICBitmapFrameDecode *iface)
Definition: tgaformat.c:470
static HRESULT WINAPI TgaDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: tgaformat.c:883
static ULONG WINAPI TgaDecoder_Frame_AddRef(IWICBitmapFrameDecode *iface)
Definition: tgaformat.c:464
static HRESULT WINAPI TgaDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, void **ppv)
Definition: tgaformat.c:441
static HRESULT WINAPI TgaDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
Definition: tgaformat.c:910
static HRESULT WINAPI TgaDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY)
Definition: tgaformat.c:589

Definition at line 924 of file tgaformat.c.

Referenced by TgaDecoder_CreateInstance().

◆ TgaDecoder_Vtbl

const IWICBitmapDecoderVtbl TgaDecoder_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI TgaDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo)
Definition: tgaformat.c:356
static HRESULT WINAPI TgaDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream, DWORD *capability)
Definition: tgaformat.c:180
static HRESULT WINAPI TgaDecoder_GetFrame(IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
Definition: tgaformat.c:408
static HRESULT WINAPI TgaDecoder_GetContainerFormat(IWICBitmapDecoder *iface, GUID *pguidContainerFormat)
Definition: tgaformat.c:349
static HRESULT WINAPI TgaDecoder_GetFrameCount(IWICBitmapDecoder *iface, UINT *pCount)
Definition: tgaformat.c:399
static HRESULT WINAPI TgaDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
Definition: tgaformat.c:371
static HRESULT WINAPI TgaDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream, WICDecodeOptions cacheOptions)
Definition: tgaformat.c:197
static HRESULT WINAPI TgaDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
Definition: tgaformat.c:385
static ULONG WINAPI TgaDecoder_Release(IWICBitmapDecoder *iface)
Definition: tgaformat.c:160
static HRESULT WINAPI TgaDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, void **ppv)
Definition: tgaformat.c:128
static HRESULT WINAPI TgaDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail)
Definition: tgaformat.c:392
static HRESULT WINAPI TgaDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource)
Definition: tgaformat.c:378
static HRESULT WINAPI TgaDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *pIPalette)
Definition: tgaformat.c:364
static ULONG WINAPI TgaDecoder_AddRef(IWICBitmapDecoder *iface)
Definition: tgaformat.c:150

Definition at line 424 of file tgaformat.c.

Referenced by TgaDecoder_CreateInstance().