ReactOS 0.4.15-dev-7958-gcd0bb1a
tgaformat.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
#include "wine/library.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 97 of file tgaformat.c.

◆ ATTRIBUTE_NO_ALPHA

#define ATTRIBUTE_NO_ALPHA   0

Definition at line 94 of file tgaformat.c.

◆ ATTRIBUTE_PALPHA

#define ATTRIBUTE_PALPHA   4

Definition at line 98 of file tgaformat.c.

◆ ATTRIBUTE_UNDEFINED

#define ATTRIBUTE_UNDEFINED   1

Definition at line 95 of file tgaformat.c.

◆ ATTRIBUTE_UNDEFINED_PRESERVE

#define ATTRIBUTE_UNDEFINED_PRESERVE   2

Definition at line 96 of file tgaformat.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file tgaformat.c.

◆ IMAGE_ATTRIBUTE_BITCOUNT_MASK

#define IMAGE_ATTRIBUTE_BITCOUNT_MASK   0xf

Definition at line 61 of file tgaformat.c.

◆ IMAGE_RIGHTTOLEFT

#define IMAGE_RIGHTTOLEFT   0x10

Definition at line 62 of file tgaformat.c.

◆ IMAGE_TOPTOBOTTOM

#define IMAGE_TOPTOBOTTOM   0x20

Definition at line 63 of file tgaformat.c.

◆ IMAGETYPE_COLORMAPPED

#define IMAGETYPE_COLORMAPPED   1

Definition at line 56 of file tgaformat.c.

◆ IMAGETYPE_GRAYSCALE

#define IMAGETYPE_GRAYSCALE   3

Definition at line 58 of file tgaformat.c.

◆ IMAGETYPE_RLE

#define IMAGETYPE_RLE   8

Definition at line 59 of file tgaformat.c.

◆ IMAGETYPE_TRUECOLOR

#define IMAGETYPE_TRUECOLOR   2

Definition at line 57 of file tgaformat.c.

Function Documentation

◆ impl_from_IWICBitmapDecoder()

static TgaDecoder * impl_from_IWICBitmapDecoder ( IWICBitmapDecoder iface)
inlinestatic

Definition at line 122 of file tgaformat.c.

123{
124 return CONTAINING_RECORD(iface, TgaDecoder, IWICBitmapDecoder_iface);
125}
#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 154 of file tgaformat.c.

155{
158
159 TRACE("(%p) refcount=%u\n", iface, ref);
160
161 return ref;
162}
#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:122
uint32_t ULONG
Definition: typedefs.h:59

◆ TgaDecoder_CopyPalette()

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

Definition at line 368 of file tgaformat.c.

370{
371 FIXME("(%p,%p): stub\n", iface, pIPalette);
372 return E_NOTIMPL;
373}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ TgaDecoder_CreateInstance()

HRESULT TgaDecoder_CreateInstance ( REFIID  iid,
void **  ppv 
)

Definition at line 942 of file tgaformat.c.

943{
945 HRESULT ret;
946
947 TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
948
949 *ppv = NULL;
950
951 This = HeapAlloc(GetProcessHeap(), 0, sizeof(TgaDecoder));
952 if (!This) return E_OUTOFMEMORY;
953
954 This->IWICBitmapDecoder_iface.lpVtbl = &TgaDecoder_Vtbl;
955 This->IWICBitmapFrameDecode_iface.lpVtbl = &TgaDecoder_Frame_Vtbl;
956 This->ref = 1;
957 This->initialized = FALSE;
958 This->stream = NULL;
959 This->imagebits = NULL;
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 NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
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:928
static const IWICBitmapDecoderVtbl TgaDecoder_Vtbl
Definition: tgaformat.c:428
#define DWORD_PTR
Definition: treelist.c:76
int ret

◆ TgaDecoder_Frame_AddRef()

static ULONG WINAPI TgaDecoder_Frame_AddRef ( IWICBitmapFrameDecode iface)
static

Definition at line 468 of file tgaformat.c.

469{
471 return IWICBitmapDecoder_AddRef(&This->IWICBitmapDecoder_iface);
472}
static TgaDecoder * impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
Definition: tgaformat.c:127

◆ TgaDecoder_Frame_CopyPalette()

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

Definition at line 600 of file tgaformat.c.

602{
605 WICColor colors[256], *color;
606 BYTE *colormap_data;
607 WORD *wcolormap_data;
608 DWORD *dwcolormap_data;
610 ULONG bytesread;
611 int depth, attribute_bitcount, attribute_type;
612 int i;
613
614 TRACE("(%p,%p)\n", iface, pIPalette);
615
616 if (!This->colormap_length)
617 {
618 WARN("no colormap present in this file\n");
620 }
621
622 if (This->header.colormap_firstentry + This->header.colormap_length > 256)
623 {
624 FIXME("cannot read colormap with %i entries starting at %i\n",
625 This->header.colormap_firstentry + This->header.colormap_length,
626 This->header.colormap_firstentry);
627 return E_FAIL;
628 }
629
630 colormap_data = HeapAlloc(GetProcessHeap(), 0, This->colormap_length);
631 if (!colormap_data) return E_OUTOFMEMORY;
632
633 wcolormap_data = (WORD*)colormap_data;
634 dwcolormap_data = (DWORD*)colormap_data;
635
637
638 seek.QuadPart = This->colormap_offset;
639 hr = IStream_Seek(This->stream, seek, STREAM_SEEK_SET, NULL);
640
641 if (SUCCEEDED(hr))
642 {
643 hr = IStream_Read(This->stream, colormap_data, This->colormap_length, &bytesread);
644 if (SUCCEEDED(hr) && bytesread != This->colormap_length)
645 {
646 WARN("expected %i bytes in colormap, got %i\n", This->colormap_length, bytesread);
647 hr = E_FAIL;
648 }
649 }
650
652
653 if (SUCCEEDED(hr))
654 {
655 attribute_bitcount = This->header.image_descriptor & IMAGE_ATTRIBUTE_BITCOUNT_MASK;
656
657 if (attribute_bitcount && This->extension_area_offset)
658 attribute_type = This->extension_area.attributes_type;
659 else if (attribute_bitcount)
660 attribute_type = ATTRIBUTE_ALPHA;
661 else
662 attribute_type = ATTRIBUTE_NO_ALPHA;
663
664 depth = This->header.colormap_entrysize;
665 if (depth == 15)
666 {
667 depth = 16;
668 attribute_type = ATTRIBUTE_NO_ALPHA;
669 }
670
671 memset(colors, 0, sizeof(colors));
672
673 color = &colors[This->header.colormap_firstentry];
674
675 /* Colormap entries can be in any truecolor format, and we have to convert them. */
676 switch (depth)
677 {
678 case 16:
679 switch (attribute_type)
680 {
684 for (i=0; i<This->header.colormap_length; i++)
685 {
686 WORD srcval = wcolormap_data[i];
687 *color++=0xff000000 | /* constant 255 alpha */
688 ((srcval << 9) & 0xf80000) | /* r */
689 ((srcval << 4) & 0x070000) | /* r - 3 bits */
690 ((srcval << 6) & 0x00f800) | /* g */
691 ((srcval << 1) & 0x000700) | /* g - 3 bits */
692 ((srcval << 3) & 0x0000f8) | /* b */
693 ((srcval >> 2) & 0x000007); /* b - 3 bits */
694 }
695 break;
696 case ATTRIBUTE_ALPHA:
697 case ATTRIBUTE_PALPHA:
698 for (i=0; i<This->header.colormap_length; i++)
699 {
700 WORD srcval = wcolormap_data[i];
701 *color++=((srcval & 0x8000) ? 0xff000000 : 0) | /* alpha */
702 ((srcval << 9) & 0xf80000) | /* r */
703 ((srcval << 4) & 0x070000) | /* r - 3 bits */
704 ((srcval << 6) & 0x00f800) | /* g */
705 ((srcval << 1) & 0x000700) | /* g - 3 bits */
706 ((srcval << 3) & 0x0000f8) | /* b */
707 ((srcval >> 2) & 0x000007); /* b - 3 bits */
708 }
709 break;
710 default:
711 FIXME("Unhandled 16-bit attribute type %u\n", attribute_type);
712 hr = E_NOTIMPL;
713 }
714 break;
715 case 24:
716 for (i=0; i<This->header.colormap_length; i++)
717 {
718 *color++=0xff000000 | /* alpha */
719 colormap_data[i*3+2] | /* red */
720 colormap_data[i*3+1] | /* green */
721 colormap_data[i*3]; /* blue */
722 }
723 break;
724 case 32:
725 switch (attribute_type)
726 {
730 for (i=0; i<This->header.colormap_length; i++)
731 *color++=dwcolormap_data[i]|0xff000000;
732 break;
733 case ATTRIBUTE_ALPHA:
734 for (i=0; i<This->header.colormap_length; i++)
735 *color++=dwcolormap_data[i];
736 break;
737 case ATTRIBUTE_PALPHA:
738 /* FIXME: Unpremultiply alpha */
739 default:
740 FIXME("Unhandled 16-bit attribute type %u\n", attribute_type);
741 hr = E_NOTIMPL;
742 }
743 break;
744 default:
745 FIXME("Unhandled truecolor depth %u\n", This->header.depth);
746 hr = E_NOTIMPL;
747 }
748 }
749
750 HeapFree(GetProcessHeap(), 0, colormap_data);
751
752 if (SUCCEEDED(hr))
753 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
754
755 return hr;
756}
#define WARN(fmt,...)
Definition: debug.h:112
#define E_FAIL
Definition: ddrawi.h:102
#define HeapFree(x, y, z)
Definition: compat.h:735
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:97
#define ATTRIBUTE_NO_ALPHA
Definition: tgaformat.c:94
#define IMAGE_ATTRIBUTE_BITCOUNT_MASK
Definition: tgaformat.c:61
#define ATTRIBUTE_UNDEFINED_PRESERVE
Definition: tgaformat.c:96
#define ATTRIBUTE_UNDEFINED
Definition: tgaformat.c:95
#define ATTRIBUTE_PALPHA
Definition: tgaformat.c:98
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
UINT32 WICColor
Definition: wincodec.idl:312
#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 887 of file tgaformat.c.

889{
891 HRESULT hr;
892
893 TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
894
896
897 if (SUCCEEDED(hr))
898 {
899 hr = copy_pixels(This->header.depth, This->origin,
900 This->header.width, This->header.height, This->stride,
901 prc, cbStride, cbBufferSize, pbBuffer);
902 }
903
904 return hr;
905}
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:815
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 914 of file tgaformat.c.

916{
917 FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
919}
#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 907 of file tgaformat.c.

909{
910 FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
912}

◆ TgaDecoder_Frame_GetPixelFormat()

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

Definition at line 493 of file tgaformat.c.

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

◆ TgaDecoder_Frame_GetResolution()

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

Definition at line 593 of file tgaformat.c.

595{
596 FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
597 return E_NOTIMPL;
598}

◆ TgaDecoder_Frame_GetSize()

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

Definition at line 480 of file tgaformat.c.

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

◆ TgaDecoder_Frame_GetThumbnail()

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

Definition at line 921 of file tgaformat.c.

923{
924 FIXME("(%p,%p): stub\n", iface, ppIThumbnail);
926}
#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 445 of file tgaformat.c.

447{
448 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
449
450 if (!ppv) return E_INVALIDARG;
451
452 if (IsEqualIID(&IID_IUnknown, iid) ||
453 IsEqualIID(&IID_IWICBitmapSource, iid) ||
454 IsEqualIID(&IID_IWICBitmapFrameDecode, iid))
455 {
456 *ppv = iface;
457 }
458 else
459 {
460 *ppv = NULL;
461 return E_NOINTERFACE;
462 }
463
464 IUnknown_AddRef((IUnknown*)*ppv);
465 return S_OK;
466}
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 474 of file tgaformat.c.

475{
477 return IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
478}

◆ TgaDecoder_GetColorContexts()

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

Definition at line 389 of file tgaformat.c.

391{
392 FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
394}

◆ TgaDecoder_GetContainerFormat()

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

Definition at line 353 of file tgaformat.c.

355{
356 memcpy(pguidContainerFormat, &GUID_WineContainerFormatTga, sizeof(GUID));
357 return S_OK;
358}

◆ TgaDecoder_GetDecoderInfo()

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

Definition at line 360 of file tgaformat.c.

362{
363 TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
364
365 return get_decoder_info(&CLSID_WineTgaDecoder, ppIDecoderInfo);
366}
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 412 of file tgaformat.c.

414{
416 TRACE("(%p,%p)\n", iface, ppIBitmapFrame);
417
418 if (!This->initialized) return WINCODEC_ERR_FRAMEMISSING;
419
420 if (index != 0) return E_INVALIDARG;
421
422 IWICBitmapDecoder_AddRef(iface);
423 *ppIBitmapFrame = &This->IWICBitmapFrameDecode_iface;
424
425 return S_OK;
426}
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 403 of file tgaformat.c.

405{
406 if (!pCount) return E_INVALIDARG;
407
408 *pCount = 1;
409 return S_OK;
410}

◆ TgaDecoder_GetMetadataQueryReader()

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

Definition at line 375 of file tgaformat.c.

377{
378 FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
379 return E_NOTIMPL;
380}

◆ TgaDecoder_GetPreview()

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

Definition at line 382 of file tgaformat.c.

384{
385 FIXME("(%p,%p): stub\n", iface, ppIBitmapSource);
387}

◆ TgaDecoder_GetThumbnail()

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

Definition at line 396 of file tgaformat.c.

398{
399 FIXME("(%p,%p): stub\n", iface, ppIThumbnail);
401}

◆ TgaDecoder_Initialize()

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

Definition at line 201 of file tgaformat.c.

203{
206 DWORD bytesread;
208 tga_footer footer;
209 int attribute_bitcount;
210 int mapped_depth=0;
211
212 TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOptions);
213
215
216 if (This->initialized)
217 {
219 goto end;
220 }
221
222 seek.QuadPart = 0;
223 hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
224 if (FAILED(hr)) goto end;
225
226 hr = IStream_Read(pIStream, &This->header, sizeof(tga_header), &bytesread);
227 if (SUCCEEDED(hr) && bytesread != sizeof(tga_header))
228 {
229 TRACE("got only %u bytes\n", bytesread);
230 hr = E_FAIL;
231 }
232 if (FAILED(hr)) goto end;
233
234 TRACE("imagetype=%u, colormap type=%u, depth=%u, image descriptor=0x%x\n",
235 This->header.image_type, This->header.colormap_type,
236 This->header.depth, This->header.image_descriptor);
237
238 /* Sanity checking. Since TGA has no clear identifying markers, we need
239 * to be careful to not load a non-TGA image. */
240 switch (This->header.image_type)
241 {
244 if (This->header.colormap_type != 1)
245 hr = E_FAIL;
246 mapped_depth = This->header.colormap_entrysize;
247 break;
250 if (This->header.colormap_type != 0 && This->header.colormap_type != 1)
251 hr = E_FAIL;
252 mapped_depth = This->header.depth;
253 break;
256 if (This->header.colormap_type != 0)
257 hr = E_FAIL;
258 mapped_depth = 0;
259 break;
260 default:
261 hr = E_FAIL;
262 }
263
264 if (This->header.depth != 8 && This->header.depth != 16 &&
265 This->header.depth != 24 && This->header.depth != 32)
266 hr = E_FAIL;
267
268 if ((This->header.image_descriptor & 0xc0) != 0)
269 hr = E_FAIL;
270
271 attribute_bitcount = This->header.image_descriptor & IMAGE_ATTRIBUTE_BITCOUNT_MASK;
272
273 if (attribute_bitcount &&
274 !((mapped_depth == 32 && attribute_bitcount == 8) ||
275 (mapped_depth == 16 && attribute_bitcount == 1)))
276 hr = E_FAIL;
277
278 if (FAILED(hr))
279 {
280 WARN("bad tga header\n");
281 goto end;
282 }
283
284 /* Locate data in the file based on the header. */
285 This->id_offset = sizeof(tga_header);
286 This->colormap_offset = This->id_offset + This->header.id_length;
287 if (This->header.colormap_type == 1)
288 This->colormap_length = ((This->header.colormap_entrysize+7)/8) * This->header.colormap_length;
289 else
290 This->colormap_length = 0;
291 This->image_offset = This->colormap_offset + This->colormap_length;
292
293 /* Read footer if there is one */
294 seek.QuadPart = -(LONGLONG)sizeof(tga_footer);
295 hr = IStream_Seek(pIStream, seek, STREAM_SEEK_END, NULL);
296
297 if (SUCCEEDED(hr)) {
298 hr = IStream_Read(pIStream, &footer, sizeof(tga_footer), &bytesread);
299 if (SUCCEEDED(hr) && bytesread != sizeof(tga_footer))
300 {
301 TRACE("got only %u footer bytes\n", bytesread);
302 hr = E_FAIL;
303 }
304
305 if (memcmp(footer.magic, tga_footer_magic, sizeof(tga_footer_magic)) == 0)
306 {
307 This->extension_area_offset = footer.extension_area_offset;
308 This->developer_directory_offset = footer.developer_directory_offset;
309 }
310 else
311 {
312 This->extension_area_offset = 0;
313 This->developer_directory_offset = 0;
314 }
315 }
316 else
317 {
318 /* File is too small to have a footer. */
319 This->extension_area_offset = 0;
320 This->developer_directory_offset = 0;
321 hr = S_OK;
322 }
323
324 if (This->extension_area_offset)
325 {
326 seek.QuadPart = This->extension_area_offset;
327 hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
328 if (FAILED(hr)) goto end;
329
330 hr = IStream_Read(pIStream, &This->extension_area, sizeof(tga_extension_area), &bytesread);
331 if (SUCCEEDED(hr) && bytesread != sizeof(tga_extension_area))
332 {
333 TRACE("got only %u extension area bytes\n", bytesread);
334 hr = E_FAIL;
335 }
336 if (SUCCEEDED(hr) && This->extension_area.size < 495)
337 {
338 TRACE("extension area is only %u bytes long\n", This->extension_area.size);
339 hr = E_FAIL;
340 }
341 if (FAILED(hr)) goto end;
342 }
343
344 IStream_AddRef(pIStream);
345 This->stream = pIStream;
346 This->initialized = TRUE;
347
348end:
350 return hr;
351}
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:71
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 184 of file tgaformat.c.

186{
187 HRESULT hr;
188
189 TRACE("(%p,%p,%p)\n", iface, stream, capability);
190
191 if (!stream || !capability) return E_INVALIDARG;
192
193 hr = IWICBitmapDecoder_Initialize(iface, stream, WICDecodeMetadataCacheOnDemand);
194 if (hr != S_OK) return hr;
195
198 return S_OK;
199}
Definition: parse.h:23
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:28
@ WICBitmapDecoderCapabilityCanDecodeSomeImages
Definition: wincodec.idl:50
@ WICBitmapDecoderCapabilityCanDecodeAllImages
Definition: wincodec.idl:49

◆ TgaDecoder_QueryInterface()

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

Definition at line 132 of file tgaformat.c.

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

◆ TgaDecoder_ReadImage()

static HRESULT TgaDecoder_ReadImage ( TgaDecoder This)
static

Definition at line 815 of file tgaformat.c.

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

Referenced by TgaDecoder_Frame_CopyPixels().

◆ TgaDecoder_ReadRLE()

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

Definition at line 758 of file tgaformat.c.

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

165{
168
169 TRACE("(%p) refcount=%u\n", iface, ref);
170
171 if (ref == 0)
172 {
173 This->lock.DebugInfo->Spare[0] = 0;
175 if (This->stream)
176 IStream_Release(This->stream);
177 HeapFree(GetProcessHeap(), 0, This->imagebits);
179 }
180
181 return ref;
182}
#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 71 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:493
static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette)
Definition: tgaformat.c:600
static HRESULT WINAPI TgaDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight)
Definition: tgaformat.c:480
static HRESULT WINAPI TgaDecoder_Frame_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail)
Definition: tgaformat.c:921
static HRESULT WINAPI TgaDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
Definition: tgaformat.c:907
static ULONG WINAPI TgaDecoder_Frame_Release(IWICBitmapFrameDecode *iface)
Definition: tgaformat.c:474
static HRESULT WINAPI TgaDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: tgaformat.c:887
static ULONG WINAPI TgaDecoder_Frame_AddRef(IWICBitmapFrameDecode *iface)
Definition: tgaformat.c:468
static HRESULT WINAPI TgaDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, void **ppv)
Definition: tgaformat.c:445
static HRESULT WINAPI TgaDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
Definition: tgaformat.c:914
static HRESULT WINAPI TgaDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY)
Definition: tgaformat.c:593

Definition at line 928 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:360
static HRESULT WINAPI TgaDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream, DWORD *capability)
Definition: tgaformat.c:184
static HRESULT WINAPI TgaDecoder_GetFrame(IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
Definition: tgaformat.c:412
static HRESULT WINAPI TgaDecoder_GetContainerFormat(IWICBitmapDecoder *iface, GUID *pguidContainerFormat)
Definition: tgaformat.c:353
static HRESULT WINAPI TgaDecoder_GetFrameCount(IWICBitmapDecoder *iface, UINT *pCount)
Definition: tgaformat.c:403
static HRESULT WINAPI TgaDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
Definition: tgaformat.c:375
static HRESULT WINAPI TgaDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream, WICDecodeOptions cacheOptions)
Definition: tgaformat.c:201
static HRESULT WINAPI TgaDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
Definition: tgaformat.c:389
static ULONG WINAPI TgaDecoder_Release(IWICBitmapDecoder *iface)
Definition: tgaformat.c:164
static HRESULT WINAPI TgaDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, void **ppv)
Definition: tgaformat.c:132
static HRESULT WINAPI TgaDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail)
Definition: tgaformat.c:396
static HRESULT WINAPI TgaDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource)
Definition: tgaformat.c:382
static HRESULT WINAPI TgaDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *pIPalette)
Definition: tgaformat.c:368
static ULONG WINAPI TgaDecoder_AddRef(IWICBitmapDecoder *iface)
Definition: tgaformat.c:154

Definition at line 428 of file tgaformat.c.

Referenced by TgaDecoder_CreateInstance().