ReactOS  0.4.15-dev-1392-g3014417
converter.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#include "windef.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wine/test.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for converter.c:

Go to the source code of this file.

Classes

struct  bitmap_data
 
struct  BitmapTestSrc
 
struct  property_opt_test_data
 
struct  setting
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define EXPECT_REF(obj, ref)   _expect_ref((IUnknown*)obj, ref, __LINE__)
 

Typedefs

typedef struct bitmap_data bitmap_data
 
typedef struct BitmapTestSrc BitmapTestSrc
 
typedef struct property_opt_test_data property_opt_test_data
 

Functions

HRESULT STDMETHODCALLTYPE IWICBitmapFrameEncode_WriteSource_Proxy (IWICBitmapFrameEncode *This, IWICBitmapSource *pIBitmapSource, WICRect *prc)
 
static BOOL near_equal (float a, float b)
 
static BitmapTestSrcimpl_from_IWICBitmapSource (IWICBitmapSource *iface)
 
static HRESULT WINAPI BitmapTestSrc_QueryInterface (IWICBitmapSource *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI BitmapTestSrc_AddRef (IWICBitmapSource *iface)
 
static ULONG WINAPI BitmapTestSrc_Release (IWICBitmapSource *iface)
 
static HRESULT WINAPI BitmapTestSrc_GetSize (IWICBitmapSource *iface, UINT *puiWidth, UINT *puiHeight)
 
static HRESULT WINAPI BitmapTestSrc_GetPixelFormat (IWICBitmapSource *iface, WICPixelFormatGUID *pPixelFormat)
 
static HRESULT WINAPI BitmapTestSrc_GetResolution (IWICBitmapSource *iface, double *pDpiX, double *pDpiY)
 
static HRESULT WINAPI BitmapTestSrc_CopyPalette (IWICBitmapSource *iface, IWICPalette *palette)
 
static HRESULT WINAPI BitmapTestSrc_CopyPixels (IWICBitmapSource *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
 
static void CreateTestBitmap (const bitmap_data *data, BitmapTestSrc **This)
 
static void DeleteTestBitmap (BitmapTestSrc *This)
 
static BOOL compare_bits (const struct bitmap_data *expect, UINT buffersize, const BYTE *converted_bits)
 
static BOOL is_indexed_format (const GUID *format)
 
static void compare_bitmap_data (const struct bitmap_data *src, const struct bitmap_data *expect, IWICBitmapSource *source, const char *name)
 
static void test_conversion (const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
 
static void test_invalid_conversion (void)
 
static void test_default_converter (void)
 
static int find_property_index (const WCHAR *name, PROPBAG2 *all_props, int all_prop_cnt)
 
static void test_specific_encoder_properties (IPropertyBag2 *options, const property_opt_test_data *data, PROPBAG2 *all_props, int all_prop_cnt)
 
static void test_encoder_properties (const CLSID *clsid_encoder, IPropertyBag2 *options)
 
static void load_stream (IUnknown *reader, IStream *stream)
 
static void check_tiff_format (IStream *stream, const WICPixelFormatGUID *format)
 
static void check_bmp_format (IStream *stream, const WICPixelFormatGUID *format)
 
static unsigned be_uint (unsigned val)
 
static void check_png_format (IStream *stream, const WICPixelFormatGUID *format)
 
static void check_gif_format (IStream *stream, const WICPixelFormatGUID *format)
 
static void check_bitmap_format (IStream *stream, const CLSID *encoder, const WICPixelFormatGUID *format)
 
static void _expect_ref (IUnknown *obj, ULONG ref, int line)
 
static void test_set_frame_palette (IWICBitmapFrameEncode *frameencode)
 
static void test_multi_encoder (const struct bitmap_data **srcs, const CLSID *clsid_encoder, const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette)
 
static void test_encoder (const struct bitmap_data *src, const CLSID *clsid_encoder, const struct bitmap_data *dst, const CLSID *clsid_decoder, const char *name)
 
static void test_encoder_rects (void)
 
static void test_converter_8bppIndexed (void)
 
 START_TEST (converter)
 

Variables

static IWICImagingFactoryfactory
 
static const IWICBitmapSourceVtbl BitmapTestSrc_Vtbl
 
static const BYTE bits_1bpp []
 
static const struct bitmap_data testdata_BlackWhite
 
static const struct bitmap_data testdata_1bppIndexed
 
static const BYTE bits_2bpp []
 
static const struct bitmap_data testdata_2bppIndexed
 
static const BYTE bits_4bpp []
 
static const struct bitmap_data testdata_4bppIndexed
 
static const BYTE bits_8bpp_BW []
 
static const struct bitmap_data testdata_8bppIndexed_BW
 
static const BYTE bits_8bpp_4colors []
 
static const struct bitmap_data testdata_8bppIndexed_4colors
 
static const BYTE bits_8bpp []
 
static const struct bitmap_data testdata_8bppIndexed
 
static const BYTE bits_24bppBGR []
 
static const struct bitmap_data testdata_24bppBGR
 
static const BYTE bits_24bppRGB []
 
static const struct bitmap_data testdata_24bppRGB
 
static const BYTE bits_32bppBGR []
 
static const struct bitmap_data testdata_32bppBGR
 
static const struct bitmap_data testdata_32bppBGRA80
 
static const struct bitmap_data testdata_32bppRGBA80
 
static const BYTE bits_32bppBGRA []
 
static const struct bitmap_data testdata_32bppBGRA
 
static const struct bitmap_data testdata_32bppRGBA
 
static const struct bitmap_data testdata_32bppRGB
 
static const BYTE bits_32bppPBGRA []
 
static const struct bitmap_data testdata_32bppPBGRA
 
static const struct bitmap_data testdata_32bppPRGBA
 
static const BYTE bits_64bppRGBA []
 
static const struct bitmap_data testdata_64bppRGBA
 
static const float bits_32bppGrayFloat_xp []
 
static const struct bitmap_data testdata_32bppGrayFloat_xp
 
static const float bits_32bppGrayFloat []
 
static const struct bitmap_data testdata_32bppGrayFloat
 
static const BYTE bits_8bppGray_xp []
 
static const struct bitmap_data testdata_8bppGray_xp
 
static const BYTE bits_8bppGray []
 
static const struct bitmap_data testdata_8bppGray
 
static const BYTE bits_24bppBGR_gray []
 
static const struct bitmap_data testdata_24bppBGR_gray
 
static const WCHAR wszTiffCompressionMethod [] = {'T','i','f','f','C','o','m','p','r','e','s','s','i','o','n','M','e','t','h','o','d',0}
 
static const WCHAR wszCompressionQuality [] = {'C','o','m','p','r','e','s','s','i','o','n','Q','u','a','l','i','t','y',0}
 
static const WCHAR wszInterlaceOption [] = {'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0}
 
static const WCHAR wszFilterOption [] = {'F','i','l','t','e','r','O','p','t','i','o','n',0}
 
static const WCHAR wszImageQuality [] = {'I','m','a','g','e','Q','u','a','l','i','t','y',0}
 
static const WCHAR wszBitmapTransform [] = {'B','i','t','m','a','p','T','r','a','n','s','f','o','r','m',0}
 
static const WCHAR wszLuminance [] = {'L','u','m','i','n','a','n','c','e',0}
 
static const WCHAR wszChrominance [] = {'C','h','r','o','m','i','n','a','n','c','e',0}
 
static const WCHAR wszJpegYCrCbSubsampling [] = {'J','p','e','g','Y','C','r','C','b','S','u','b','s','a','m','p','l','i','n','g',0}
 
static const WCHAR wszSuppressApp0 [] = {'S','u','p','p','r','e','s','s','A','p','p','0',0}
 
static const WCHAR wszEnableV5Header32bppBGRA [] = {'E','n','a','b','l','e','V','5','H','e','a','d','e','r','3','2','b','p','p','B','G','R','A',0}
 
static const struct property_opt_test_data testdata_tiff_props []
 
static const struct property_opt_test_data testdata_png_props []
 
static const struct property_opt_test_data testdata_jpeg_props []
 
static const struct property_opt_test_data testdata_bmp_props []
 
static const struct bitmap_datamultiple_frames [3]
 
static const struct bitmap_datasingle_frame [2]
 
static const struct setting png_interlace_settings []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file converter.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 25 of file converter.c.

◆ EXPECT_REF

#define EXPECT_REF (   obj,
  ref 
)    _expect_ref((IUnknown*)obj, ref, __LINE__)

Definition at line 1190 of file converter.c.

Typedef Documentation

◆ bitmap_data

◆ BitmapTestSrc

◆ property_opt_test_data

Function Documentation

◆ _expect_ref()

static void _expect_ref ( IUnknown obj,
ULONG  ref,
int  line 
)
static

Definition at line 1191 of file converter.c.

1192 {
1193  ULONG rc;
1194  IUnknown_AddRef(obj);
1195  rc = IUnknown_Release(obj);
1196  ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
1197 }
GLenum GLint ref
Definition: glext.h:6028
Definition: parser.c:48
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ be_uint()

static unsigned be_uint ( unsigned  val)
static

Definition at line 1023 of file converter.c.

1024 {
1025  union
1026  {
1027  unsigned val;
1028  char c[4];
1029  } u;
1030 
1031  u.val = val;
1032  return (u.c[0] << 24) | (u.c[1] << 16) | (u.c[2] << 8) | u.c[3];
1033 }
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 * u
Definition: glfuncs.h:240
GLuint GLfloat * val
Definition: glext.h:7180
const GLubyte * c
Definition: glext.h:8905

Referenced by check_png_format().

◆ BitmapTestSrc_AddRef()

static ULONG WINAPI BitmapTestSrc_AddRef ( IWICBitmapSource iface)
static

Definition at line 80 of file converter.c.

81 {
84  return ref;
85 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ BitmapTestSrc_CopyPalette()

static HRESULT WINAPI BitmapTestSrc_CopyPalette ( IWICBitmapSource iface,
IWICPalette palette 
)
static

Definition at line 120 of file converter.c.

122 {
124 
125  if (IsEqualGUID(This->data->format, &GUID_WICPixelFormat1bppIndexed) ||
126  IsEqualGUID(This->data->format, &GUID_WICPixelFormat2bppIndexed) ||
127  IsEqualGUID(This->data->format, &GUID_WICPixelFormat4bppIndexed) ||
128  IsEqualGUID(This->data->format, &GUID_WICPixelFormat8bppIndexed))
129  {
130  WICColor colors[8];
131 
132  colors[0] = 0xff0000ff;
133  colors[1] = 0xff00ff00;
134  colors[2] = 0xffff0000;
135  colors[3] = 0xff000000;
136  colors[4] = 0xffffff00;
137  colors[5] = 0xffff00ff;
138  colors[6] = 0xff00ffff;
139  colors[7] = 0xffffffff;
140  return IWICPalette_InitializeCustom(palette, colors, 8);
141  }
142 
143  /* unique error marker */
144  return 0xdeadbeef;
145 }
static HPALETTE palette
Definition: clipboard.c:1345
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
UINT32 WICColor
Definition: wincodec.idl:250

◆ BitmapTestSrc_CopyPixels()

static HRESULT WINAPI BitmapTestSrc_CopyPixels ( IWICBitmapSource iface,
const WICRect prc,
UINT  cbStride,
UINT  cbBufferSize,
BYTE pbBuffer 
)
static

Definition at line 147 of file converter.c.

149 {
151  UINT bytesperrow;
152  UINT srcstride;
153  UINT row_offset;
154  WICRect rc;
155 
156  if (!prc)
157  {
158  rc.X = 0;
159  rc.Y = 0;
160  rc.Width = This->data->width;
161  rc.Height = This->data->height;
162  prc = &rc;
163  }
164  else
165  {
166  if (prc->X < 0 || prc->Y < 0 || prc->X+prc->Width > This->data->width || prc->Y+prc->Height > This->data->height)
167  return E_INVALIDARG;
168  }
169 
170  bytesperrow = ((This->data->bpp * prc->Width)+7)/8;
171  srcstride = ((This->data->bpp * This->data->width)+7)/8;
172 
173  if (cbStride < bytesperrow)
174  return E_INVALIDARG;
175 
176  if ((cbStride * prc->Height) > cbBufferSize)
177  return E_INVALIDARG;
178 
179  row_offset = prc->X * This->data->bpp;
180 
181  if (row_offset % 8 == 0)
182  {
183  UINT row;
184  const BYTE *src;
185  BYTE *dst;
186 
187  src = This->data->bits + (row_offset / 8) + prc->Y * srcstride;
188  dst = pbBuffer;
189  for (row=0; row < prc->Height; row++)
190  {
191  memcpy(dst, src, bytesperrow);
192  src += srcstride;
193  dst += cbStride;
194  }
195  return S_OK;
196  }
197  else
198  {
199  ok(0, "bitmap %p was asked to copy pixels not aligned on a byte boundary\n", iface);
200  return E_FAIL;
201  }
202 }
#define E_FAIL
Definition: ddrawi.h:102
#define E_INVALIDARG
Definition: ddrawi.h:101
INT Height
Definition: wincodec.idl:239
#define for
Definition: utility.h:88
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
unsigned char BYTE
Definition: xxhash.c:193
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
GLenum GLenum dst
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
INT Width
Definition: wincodec.idl:238
_Out_ LPRECT prc
Definition: ntgdi.h:1658
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

◆ BitmapTestSrc_GetPixelFormat()

static HRESULT WINAPI BitmapTestSrc_GetPixelFormat ( IWICBitmapSource iface,
WICPixelFormatGUID pPixelFormat 
)
static

Definition at line 103 of file converter.c.

105 {
107  memcpy(pPixelFormat, This->data->format, sizeof(GUID));
108  return S_OK;
109 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
#define S_OK
Definition: intsafe.h:51

◆ BitmapTestSrc_GetResolution()

static HRESULT WINAPI BitmapTestSrc_GetResolution ( IWICBitmapSource iface,
double pDpiX,
double pDpiY 
)
static

Definition at line 111 of file converter.c.

113 {
115  *pDpiX = This->data->xres;
116  *pDpiY = This->data->yres;
117  return S_OK;
118 }
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
#define S_OK
Definition: intsafe.h:51

◆ BitmapTestSrc_GetSize()

static HRESULT WINAPI BitmapTestSrc_GetSize ( IWICBitmapSource iface,
UINT puiWidth,
UINT puiHeight 
)
static

Definition at line 94 of file converter.c.

96 {
98  *puiWidth = This->data->width;
99  *puiHeight = This->data->height;
100  return S_OK;
101 }
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
#define S_OK
Definition: intsafe.h:51

◆ BitmapTestSrc_QueryInterface()

static HRESULT WINAPI BitmapTestSrc_QueryInterface ( IWICBitmapSource iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 65 of file converter.c.

67 {
68  if (!ppv) return E_INVALIDARG;
69 
70  if (IsEqualIID(&IID_IUnknown, iid) ||
71  IsEqualIID(&IID_IWICBitmapSource, iid))
72  *ppv = iface;
73  else
74  return E_NOINTERFACE;
75 
76  IUnknown_AddRef((IUnknown*)*ppv);
77  return S_OK;
78 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define E_INVALIDARG
Definition: ddrawi.h:101
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ BitmapTestSrc_Release()

static ULONG WINAPI BitmapTestSrc_Release ( IWICBitmapSource iface)
static

Definition at line 87 of file converter.c.

88 {
91  return ref;
92 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define InterlockedDecrement
Definition: armddk.h:52
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
unsigned int ULONG
Definition: retypes.h:1

◆ check_bitmap_format()

static void check_bitmap_format ( IStream stream,
const CLSID encoder,
const WICPixelFormatGUID format 
)
static

Definition at line 1159 of file converter.c.

1160 {
1161  HRESULT hr;
1163 
1164  pos.QuadPart = 0;
1165  hr = IStream_Seek(stream, pos, SEEK_SET, (ULARGE_INTEGER *)&pos);
1166  ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
1167 
1168  if (IsEqualGUID(encoder, &CLSID_WICPngEncoder))
1170  else if (IsEqualGUID(encoder, &CLSID_WICBmpEncoder))
1172  else if (IsEqualGUID(encoder, &CLSID_WICTiffEncoder))
1174  else if (IsEqualGUID(encoder, &CLSID_WICGifEncoder))
1176  else
1177  ok(0, "unknown encoder %s\n", wine_dbgstr_guid(encoder));
1178 
1179  hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
1180  ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
1181 }
static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:955
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void check_gif_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:1125
#define SEEK_SET
Definition: jmemansi.c:26
static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:834
LONG HRESULT
Definition: typedefs.h:79
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:1035

Referenced by test_multi_encoder().

◆ check_bmp_format()

static void check_bmp_format ( IStream stream,
const WICPixelFormatGUID format 
)
static

Definition at line 955 of file converter.c.

956 {
957  HRESULT hr;
958  BITMAPFILEHEADER bfh;
959  BITMAPV5HEADER bih;
960 
961  hr = IStream_Read(stream, &bfh, sizeof(bfh), NULL);
962  ok(hr == S_OK, "IStream_Read error %#x\n", hr);
963 
964  ok(bfh.bfType == 0x4d42, "wrong BMP signature %02x\n", bfh.bfType);
965  ok(bfh.bfReserved1 == 0, "wrong bfReserved1 %02x\n", bfh.bfReserved1);
966  ok(bfh.bfReserved2 == 0, "wrong bfReserved2 %02x\n", bfh.bfReserved2);
967 
968  hr = IStream_Read(stream, &bih, sizeof(bih), NULL);
969  ok(hr == S_OK, "IStream_Read error %#x\n", hr);
970 
971  if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
972  {
973  ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
974 
975  ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
976  ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
977 
978  ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
979  ok(bih.bV5BitCount == 1, "wrong BitCount %d\n", bih.bV5BitCount);
980  ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
981  ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
982  }
983  else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
984  {
985  ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
986 
987  ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
988  ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
989 
990  ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
991  ok(bih.bV5BitCount == 4, "wrong BitCount %d\n", bih.bV5BitCount);
992  ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
993  ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
994  }
995  else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
996  {
997  ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
998 
999  ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
1000  ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
1001 
1002  ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
1003  ok(bih.bV5BitCount == 8, "wrong BitCount %d\n", bih.bV5BitCount);
1004  ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
1005  ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
1006  }
1007  else if (IsEqualGUID(format, &GUID_WICPixelFormat32bppBGR))
1008  {
1009  ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %08x\n", bfh.bfOffBits);
1010 
1011  ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
1012  ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
1013 
1014  ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
1015  ok(bih.bV5BitCount == 32, "wrong BitCount %d\n", bih.bV5BitCount);
1016  ok(bih.bV5ClrUsed == 0, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
1017  ok(bih.bV5ClrImportant == 0, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
1018  }
1019  else
1020  ok(0, "unknown BMP pixel format %s\n", wine_dbgstr_guid(format));
1021 }
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
LONG HRESULT
Definition: typedefs.h:79
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by check_bitmap_format().

◆ check_gif_format()

static void check_gif_format ( IStream stream,
const WICPixelFormatGUID format 
)
static

Definition at line 1125 of file converter.c.

1126 {
1127 #include "pshpack1.h"
1129  {
1130  char signature[6];
1131  USHORT width;
1132  USHORT height;
1133  BYTE packed;
1134  /* global_color_table_flag : 1;
1135  * color_resolution : 3;
1136  * sort_flag : 1;
1137  * global_color_table_size : 3;
1138  */
1141  } lsd;
1142 #include "poppack.h"
1143  UINT color_resolution;
1144  HRESULT hr;
1145 
1146  memset(&lsd, 0, sizeof(lsd));
1147  hr = IStream_Read(stream, &lsd, sizeof(lsd), NULL);
1148  ok(hr == S_OK, "IStream_Read error %#x\n", hr);
1149 
1150  ok(!memcmp(lsd.signature, "GIF89a", 6), "wrong GIF signature %.6s\n", lsd.signature);
1151 
1152  ok(lsd.width == 32, "wrong width %u\n", lsd.width);
1153  ok(lsd.height == 2, "wrong height %u\n", lsd.height);
1154  color_resolution = 1 << (((lsd.packed >> 4) & 0x07) + 1);
1155  ok(color_resolution == 256, "wrong color resolution %u\n", color_resolution);
1156  ok(lsd.pixel_aspect_ratio == 0, "wrong pixel_aspect_ratio %u\n", lsd.pixel_aspect_ratio);
1157 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
LONG HRESULT
Definition: typedefs.h:79
Definition: parse.h:22
unsigned char BYTE
Definition: xxhash.c:193
#define S_OK
Definition: intsafe.h:51
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define memset(x, y, z)
Definition: compat.h:39

Referenced by check_bitmap_format().

◆ check_png_format()

static void check_png_format ( IStream stream,
const WICPixelFormatGUID format 
)
static

Definition at line 1035 of file converter.c.

1036 {
1037  static const char png_sig[8] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a};
1038  static const char png_IHDR[8] = {0,0,0,0x0d,'I','H','D','R'};
1039  HRESULT hr;
1040  struct
1041  {
1042  char png_sig[8];
1043  char ihdr_sig[8];
1044  unsigned width, height;
1045  char bit_depth, color_type, compression, filter, interlace;
1046  } png;
1047 
1048  memset(&png, 0, sizeof(png));
1049  hr = IStream_Read(stream, &png, sizeof(png), NULL);
1050  ok(hr == S_OK, "IStream_Read error %#x\n", hr);
1051 
1052  ok(!memcmp(png.png_sig, png_sig, sizeof(png_sig)), "expected PNG signature\n");
1053  ok(!memcmp(png.ihdr_sig, png_IHDR, sizeof(png_IHDR)), "expected PNG IHDR\n");
1054 
1055  if (IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite))
1056  {
1057  ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1058  ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1059 
1060  ok(png.bit_depth == 1, "wrong bit_depth %d\n", png.bit_depth);
1061  ok(png.color_type == 0, "wrong color_type %d\n", png.color_type);
1062  ok(png.compression == 0, "wrong compression %d\n", png.compression);
1063  ok(png.filter == 0, "wrong filter %d\n", png.filter);
1064  ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1065  }
1066  else if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
1067  {
1068  ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1069  ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1070 
1071  ok(png.bit_depth == 1, "wrong bit_depth %d\n", png.bit_depth);
1072  ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1073  ok(png.compression == 0, "wrong compression %d\n", png.compression);
1074  ok(png.filter == 0, "wrong filter %d\n", png.filter);
1075  ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1076  }
1077  else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
1078  {
1079  ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1080  ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1081 
1082  ok(png.bit_depth == 2, "wrong bit_depth %d\n", png.bit_depth);
1083  ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1084  ok(png.compression == 0, "wrong compression %d\n", png.compression);
1085  ok(png.filter == 0, "wrong filter %d\n", png.filter);
1086  ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1087  }
1088  else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
1089  {
1090  ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1091  ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1092 
1093  ok(png.bit_depth == 4, "wrong bit_depth %d\n", png.bit_depth);
1094  ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1095  ok(png.compression == 0, "wrong compression %d\n", png.compression);
1096  ok(png.filter == 0, "wrong filter %d\n", png.filter);
1097  ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1098  }
1099  else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
1100  {
1101  ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1102  ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1103 
1104  ok(png.bit_depth == 8, "wrong bit_depth %d\n", png.bit_depth);
1105  ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1106  ok(png.compression == 0, "wrong compression %d\n", png.compression);
1107  ok(png.filter == 0, "wrong filter %d\n", png.filter);
1108  ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1109  }
1110  else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
1111  {
1112  ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1113  ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1114 
1115  ok(png.bit_depth == 8, "wrong bit_depth %d\n", png.bit_depth);
1116  ok(png.color_type == 2, "wrong color_type %d\n", png.color_type);
1117  ok(png.compression == 0, "wrong compression %d\n", png.compression);
1118  ok(png.filter == 0, "wrong filter %d\n", png.filter);
1119  ok(png.interlace == 0 || png.interlace == 1, "wrong interlace %d\n", png.interlace);
1120  }
1121  else
1122  ok(0, "unknown PNG pixel format %s\n", wine_dbgstr_guid(format));
1123 }
GLint GLint GLsizei width
Definition: gl.h:1546
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
static unsigned be_uint(unsigned val)
Definition: converter.c:1023
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define png_IHDR
Definition: pngpriv.h:850
LONG HRESULT
Definition: typedefs.h:79
Definition: parse.h:22
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
Definition: btrfs_drv.h:1357
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define memset(x, y, z)
Definition: compat.h:39
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by check_bitmap_format().

◆ check_tiff_format()

static void check_tiff_format ( IStream stream,
const WICPixelFormatGUID format 
)
static

Definition at line 834 of file converter.c.

835 {
836  HRESULT hr;
838  PROPVARIANT id, value;
839  struct
840  {
841  USHORT byte_order;
842  USHORT version;
843  ULONG dir_offset;
844  } tiff;
846  UINT count, i;
847  int width, height, bps, photo, samples, colormap;
848  struct
849  {
850  int id, *value;
851  } tag[] =
852  {
853  { 0x100, &width }, { 0x101, &height }, { 0x102, &bps },
854  { 0x106, &photo }, { 0x115, &samples }, { 0x140, &colormap }
855  };
856 
857  memset(&tiff, 0, sizeof(tiff));
858  hr = IStream_Read(stream, &tiff, sizeof(tiff), NULL);
859  ok(hr == S_OK, "IStream_Read error %#x\n", hr);
860  ok(tiff.byte_order == MAKEWORD('I','I') || tiff.byte_order == MAKEWORD('M','M'),
861  "wrong TIFF byte order mark %02x\n", tiff.byte_order);
862  ok(tiff.version == 42, "wrong TIFF version %u\n", tiff.version);
863 
864  pos.QuadPart = tiff.dir_offset;
865  hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
866  ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
867 
868  hr = CoCreateInstance(&CLSID_WICIfdMetadataReader, NULL, CLSCTX_INPROC_SERVER,
869  &IID_IWICMetadataReader, (void **)&reader);
870  ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
871 
873 
874  hr = IWICMetadataReader_GetCount(reader, &count);
875  ok(hr == S_OK, "GetCount error %#x\n", hr);
876  ok(count != 0, "wrong count %u\n", count);
877 
878  for (i = 0; i < ARRAY_SIZE(tag); i++)
879  {
880  PropVariantInit(&id);
881  PropVariantInit(&value);
882 
883  id.vt = VT_UI2;
884  U(id).uiVal = tag[i].id;
885  hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
886  ok(hr == S_OK || (tag[i].id == 0x140 && hr == WINCODEC_ERR_PROPERTYNOTFOUND),
887  "GetValue(%04x) error %#x\n", tag[i].id, hr);
888  if (hr == S_OK)
889  {
890  ok(value.vt == VT_UI2 || value.vt == VT_UI4 || value.vt == (VT_UI2 | VT_VECTOR), "wrong vt: %d\n", value.vt);
891  tag[i].value[0] = U(value).uiVal;
892  }
893  else
894  tag[i].value[0] = -1;
895 
897  }
898 
899  IWICMetadataReader_Release(reader);
900 
901  if (IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite))
902  {
903  ok(width == 32, "wrong width %u\n", width);
904  ok(height == 2, "wrong height %u\n", height);
905 
906  ok(bps == 1, "wrong bps %d\n", bps);
907  ok(photo == 1, "wrong photometric %d\n", photo);
908  ok(samples == 1, "wrong samples %d\n", samples);
909  ok(colormap == -1, "wrong colormap %d\n", colormap);
910  }
911  else if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
912  {
913  ok(width == 32, "wrong width %u\n", width);
914  ok(height == 2, "wrong height %u\n", height);
915 
916  ok(bps == 1, "wrong bps %d\n", bps);
917  ok(photo == 3, "wrong photometric %d\n", photo);
918  ok(samples == 1, "wrong samples %d\n", samples);
919  ok(colormap == 6, "wrong colormap %d\n", colormap);
920  }
921  else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
922  {
923  ok(width == 32, "wrong width %u\n", width);
924  ok(height == 2, "wrong height %u\n", height);
925 
926  ok(bps == 4, "wrong bps %d\n", bps);
927  ok(photo == 3, "wrong photometric %d\n", photo);
928  ok(samples == 1, "wrong samples %d\n", samples);
929  ok(colormap == 48, "wrong colormap %d\n", colormap);
930  }
931  else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
932  {
933  ok(width == 32, "wrong width %u\n", width);
934  ok(height == 2, "wrong height %u\n", height);
935 
936  ok(bps == 8, "wrong bps %d\n", bps);
937  ok(photo == 3, "wrong photometric %d\n", photo);
938  ok(samples == 1, "wrong samples %d\n", samples);
939  ok(colormap == 768, "wrong colormap %d\n", colormap);
940  }
941  else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
942  {
943  ok(width == 32, "wrong width %u\n", width);
944  ok(height == 2, "wrong height %u\n", height);
945 
946  ok(bps == 3, "wrong bps %d\n", bps);
947  ok(photo == 2, "wrong photometric %d\n", photo);
948  ok(samples == 3, "wrong samples %d\n", samples);
949  ok(colormap == -1, "wrong colormap %d\n", colormap);
950  }
951  else
952  ok(0, "unknown TIFF pixel format %s\n", wine_dbgstr_guid(format));
953 }
GLsizei samples
Definition: glext.h:7006
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define MAKEWORD(a, b)
Definition: typedefs.h:248
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define U(x)
Definition: wordpad.c:45
const char * wine_dbgstr_guid(const GUID *guid)
Definition: ecma_167.h:138
static void load_stream(IUnknown *reader, IStream *stream)
Definition: converter.c:815
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: tiffiop.h:115
static const WCHAR version[]
Definition: asmname.c:66
static const WCHAR tiff[]
#define SEEK_SET
Definition: jmemansi.c:26
LONG HRESULT
Definition: typedefs.h:79
Definition: parse.h:22
GLsizei const GLfloat * value
Definition: glext.h:6069
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
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
unsigned short USHORT
Definition: pedump.c:61
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
Definition: reader.h:83
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
#define WINCODEC_ERR_PROPERTYNOTFOUND
Definition: winerror.h:3279
#define memset(x, y, z)
Definition: compat.h:39

Referenced by check_bitmap_format().

◆ compare_bitmap_data()

static void compare_bitmap_data ( const struct bitmap_data src,
const struct bitmap_data expect,
IWICBitmapSource source,
const char name 
)
static

Definition at line 326 of file converter.c.

328 {
329  BYTE *converted_bits;
330  UINT width, height;
331  double xres, yres;
332  WICRect prc;
333  UINT stride, buffersize;
334  GUID dst_pixelformat;
335  HRESULT hr;
336 
337  hr = IWICBitmapSource_GetSize(source, &width, &height);
338  ok(SUCCEEDED(hr), "GetSize(%s) failed, hr=%x\n", name, hr);
339  ok(width == expect->width, "expecting %u, got %u (%s)\n", expect->width, width, name);
340  ok(height == expect->height, "expecting %u, got %u (%s)\n", expect->height, height, name);
341 
342  hr = IWICBitmapSource_GetResolution(source, &xres, &yres);
343  ok(SUCCEEDED(hr), "GetResolution(%s) failed, hr=%x\n", name, hr);
344  ok(fabs(xres - expect->xres) < 0.02, "expecting %0.2f, got %0.2f (%s)\n", expect->xres, xres, name);
345  ok(fabs(yres - expect->yres) < 0.02, "expecting %0.2f, got %0.2f (%s)\n", expect->yres, yres, name);
346 
347  hr = IWICBitmapSource_GetPixelFormat(source, &dst_pixelformat);
348  ok(SUCCEEDED(hr), "GetPixelFormat(%s) failed, hr=%x\n", name, hr);
349  ok(IsEqualGUID(&dst_pixelformat, expect->format), "got unexpected pixel format %s (%s)\n", wine_dbgstr_guid(&dst_pixelformat), name);
350 
351  prc.X = 0;
352  prc.Y = 0;
353  prc.Width = expect->width;
354  prc.Height = expect->height;
355 
356  stride = (expect->bpp * expect->width + 7) / 8;
357  buffersize = stride * expect->height;
358 
359  converted_bits = HeapAlloc(GetProcessHeap(), 0, buffersize);
360  memset(converted_bits, 0xaa, buffersize);
361  hr = IWICBitmapSource_CopyPixels(source, &prc, stride, buffersize, converted_bits);
362  ok(SUCCEEDED(hr), "CopyPixels(%s) failed, hr=%x\n", name, hr);
363 
364  /* The result of conversion of color to indexed formats depends on
365  * optimized palette generation implementation. We either need to
366  * assign our own palette, or just skip the comparison.
367  */
368  if (!(!is_indexed_format(src->format) && is_indexed_format(expect->format)))
369  ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
370 
371  /* Test with NULL rectangle - should copy the whole bitmap */
372  memset(converted_bits, 0xaa, buffersize);
373  hr = IWICBitmapSource_CopyPixels(source, NULL, stride, buffersize, converted_bits);
374  ok(SUCCEEDED(hr), "CopyPixels(%s,rc=NULL) failed, hr=%x\n", name, hr);
375  /* see comment above */
376  if (!(!is_indexed_format(src->format) && is_indexed_format(expect->format)))
377  ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
378 
379  HeapFree(GetProcessHeap(), 0, converted_bits);
380 }
GLint GLint GLsizei width
Definition: gl.h:1546
static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, const BYTE *converted_bits)
Definition: converter.c:234
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
if SUCCEEDED(hr)
GLsizei stride
Definition: glext.h:5848
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
static BOOL is_indexed_format(const GUID *format)
Definition: converter.c:315
GLenum src
Definition: glext.h:6340
unsigned char BYTE
Definition: xxhash.c:193
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define ok(value,...)
Definition: atltest.h:57
#define expect(expected, got)
Definition: combo.c:36
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
Definition: name.c:38
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_conversion(), test_default_converter(), and test_multi_encoder().

◆ compare_bits()

static BOOL compare_bits ( const struct bitmap_data expect,
UINT  buffersize,
const BYTE converted_bits 
)
static

Definition at line 234 of file converter.c.

235 {
236  BOOL equal;
237 
238  if (IsEqualGUID(expect->format, &GUID_WICPixelFormat32bppBGR))
239  {
240  /* ignore the padding byte when comparing data */
241  UINT i;
242  const DWORD *a=(const DWORD*)expect->bits, *b=(const DWORD*)converted_bits;
243  equal=TRUE;
244  for (i=0; i<(buffersize/4); i++)
245  if ((a[i]&0xffffff) != (b[i]&0xffffff))
246  {
247  equal = FALSE;
248  break;
249  }
250  }
251  else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat32bppGrayFloat))
252  {
253  UINT i;
254  const float *a=(const float*)expect->bits, *b=(const float*)converted_bits;
255  equal=TRUE;
256  for (i=0; i<(buffersize/4); i++)
257  if (!near_equal(a[i], b[i]))
258  {
259  equal = FALSE;
260  break;
261  }
262  }
263  else if (IsEqualGUID(expect->format, &GUID_WICPixelFormatBlackWhite) ||
264  IsEqualGUID(expect->format, &GUID_WICPixelFormat1bppIndexed))
265  {
266  UINT i;
267  const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits;
268  equal=TRUE;
269  for (i=0; i<buffersize; i++)
270  if (a[i] != b[i] && b[i] != 0xff /* BMP encoder B&W */)
271  {
272  equal = FALSE;
273  break;
274  }
275  }
276  else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat2bppIndexed) ||
277  IsEqualGUID(expect->format, &GUID_WICPixelFormat4bppIndexed) ||
278  IsEqualGUID(expect->format, &GUID_WICPixelFormat8bppIndexed))
279  {
280  UINT i;
281  const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits;
282  equal=TRUE;
283 
284  for (i=0; i<buffersize; i++)
285  if (a[i] != b[i])
286  {
287  equal = FALSE;
288  break;
289  }
290  }
291  else
292  equal = (memcmp(expect->bits, converted_bits, buffersize) == 0);
293 
294  if (!equal && expect->alt_data)
295  equal = compare_bits(expect->alt_data, buffersize, converted_bits);
296 
297  if (!equal && winetest_debug > 1)
298  {
299  UINT i, bps;
300  bps = expect->bpp / 8;
301  if (!bps) bps = buffersize;
302  printf("converted_bits (%u bytes):\n ", buffersize);
303  for (i = 0; i < buffersize; i++)
304  {
305  printf("%u,", converted_bits[i]);
306  if (!((i + 1) % 32)) printf("\n ");
307  else if (!((i+1) % bps)) printf(" ");
308  }
309  printf("\n");
310  }
311 
312  return equal;
313 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, const BYTE *converted_bits)
Definition: converter.c:234
#define TRUE
Definition: types.h:120
#define equal(x, y)
Definition: reader.cc:56
int winetest_debug
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL near_equal(float a, float b)
Definition: converter.c:55
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
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 expect(expected, got)
Definition: combo.c:36
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define printf
Definition: config.h:203

Referenced by compare_bitmap_data().

◆ CreateTestBitmap()

static void CreateTestBitmap ( const bitmap_data data,
BitmapTestSrc **  This 
)
static

Definition at line 215 of file converter.c.

216 {
217  *This = HeapAlloc(GetProcessHeap(), 0, sizeof(**This));
218 
219  if (*This)
220  {
221  (*This)->IWICBitmapSource_iface.lpVtbl = &BitmapTestSrc_Vtbl;
222  (*This)->ref = 1;
223  (*This)->data = data;
224  }
225 }
static const IWICBitmapSourceVtbl BitmapTestSrc_Vtbl
Definition: converter.c:204
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by test_conversion(), test_converter_8bppIndexed(), test_default_converter(), test_invalid_conversion(), and test_multi_encoder().

◆ DeleteTestBitmap()

static void DeleteTestBitmap ( BitmapTestSrc This)
static

Definition at line 227 of file converter.c.

228 {
229  ok(This->IWICBitmapSource_iface.lpVtbl == &BitmapTestSrc_Vtbl, "test bitmap %p deleted with incorrect vtable\n", This);
230  ok(This->ref == 1, "test bitmap %p deleted with %i references instead of 1\n", This, This->ref);
232 }
static const IWICBitmapSourceVtbl BitmapTestSrc_Vtbl
Definition: converter.c:204
#define GetProcessHeap()
Definition: compat.h:595
#define ok(value,...)
Definition: atltest.h:57
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_conversion(), test_converter_8bppIndexed(), test_default_converter(), test_invalid_conversion(), and test_multi_encoder().

◆ find_property_index()

static int find_property_index ( const WCHAR name,
PROPBAG2 *  all_props,
int  all_prop_cnt 
)
static

Definition at line 679 of file converter.c.

680 {
681  int i;
682  for (i=0; i < all_prop_cnt; i++)
683  {
684  if (lstrcmpW(name, all_props[i].pstrName) == 0)
685  return i;
686  }
687  return -1;
688 }
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
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
Definition: name.c:38

Referenced by test_specific_encoder_properties().

◆ impl_from_IWICBitmapSource()

static BitmapTestSrc* impl_from_IWICBitmapSource ( IWICBitmapSource iface)
inlinestatic

Definition at line 60 of file converter.c.

61 {
62  return CONTAINING_RECORD(iface, BitmapTestSrc, IWICBitmapSource_iface);
63 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by BitmapTestSrc_AddRef(), BitmapTestSrc_CopyPalette(), BitmapTestSrc_CopyPixels(), BitmapTestSrc_GetPixelFormat(), BitmapTestSrc_GetResolution(), BitmapTestSrc_GetSize(), and BitmapTestSrc_Release().

◆ is_indexed_format()

static BOOL is_indexed_format ( const GUID format)
static

Definition at line 315 of file converter.c.

316 {
317  if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed) ||
318  IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed) ||
319  IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed) ||
320  IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
321  return TRUE;
322 
323  return FALSE;
324 }
#define TRUE
Definition: types.h:120
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define FALSE
Definition: types.h:117
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by compare_bitmap_data().

◆ IWICBitmapFrameEncode_WriteSource_Proxy()

HRESULT STDMETHODCALLTYPE IWICBitmapFrameEncode_WriteSource_Proxy ( IWICBitmapFrameEncode This,
IWICBitmapSource pIBitmapSource,
WICRect prc 
)

Referenced by test_multi_encoder().

◆ load_stream()

static void load_stream ( IUnknown reader,
IStream stream 
)
static

Definition at line 815 of file converter.c.

816 {
817  HRESULT hr;
818  IWICPersistStream *persist;
819 #ifdef WORDS_BIGENDIAN
820  DWORD persist_options = WICPersistOptionBigEndian;
821 #else
822  DWORD persist_options = WICPersistOptionLittleEndian;
823 #endif
824 
825  hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist);
826  ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
827 
828  hr = IWICPersistStream_LoadEx(persist, stream, NULL, persist_options);
829  ok(hr == S_OK, "LoadEx failed, hr=%x\n", hr);
830 
831  IWICPersistStream_Release(persist);
832 }
HRESULT hr
Definition: shlfolder.c:183
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
Definition: reader.h:83

Referenced by check_tiff_format().

◆ near_equal()

static BOOL near_equal ( float  a,
float  b 
)
static

Definition at line 55 of file converter.c.

56 {
57  return fabsf(a - b) < 0.001;
58 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
_Check_return_ __CRT_INLINE float __CRTDECL fabsf(_In_ float x)
Definition: math.h:164
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by compare_bits().

◆ START_TEST()

START_TEST ( converter  )

Definition at line 1844 of file converter.c.

1845 {
1846  HRESULT hr;
1847 
1849 
1850  hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
1851  &IID_IWICImagingFactory, (void **)&factory);
1852  ok(hr == S_OK, "failed to create factory: %#x\n", hr);
1853 
1854  test_conversion(&testdata_24bppRGB, &testdata_1bppIndexed, "24bppRGB -> 1bppIndexed", TRUE);
1855  test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 2bppIndexed", TRUE);
1856  test_conversion(&testdata_24bppRGB, &testdata_4bppIndexed, "24bppRGB -> 4bppIndexed", TRUE);
1857  test_conversion(&testdata_24bppRGB, &testdata_8bppIndexed, "24bppRGB -> 8bppIndexed", FALSE);
1858 
1859  test_conversion(&testdata_BlackWhite, &testdata_8bppIndexed_BW, "BlackWhite -> 8bppIndexed", TRUE);
1860  test_conversion(&testdata_1bppIndexed, &testdata_8bppIndexed_BW, "1bppIndexed -> 8bppIndexed", TRUE);
1861  test_conversion(&testdata_2bppIndexed, &testdata_8bppIndexed_4colors, "2bppIndexed -> 8bppIndexed", TRUE);
1862  test_conversion(&testdata_4bppIndexed, &testdata_8bppIndexed, "4bppIndexed -> 8bppIndexed", TRUE);
1863 
1868 
1873 
1874  test_conversion(&testdata_24bppBGR, &testdata_24bppBGR, "24bppBGR -> 24bppBGR", FALSE);
1875  test_conversion(&testdata_24bppBGR, &testdata_24bppRGB, "24bppBGR -> 24bppRGB", FALSE);
1876 
1877  test_conversion(&testdata_24bppRGB, &testdata_24bppRGB, "24bppRGB -> 24bppRGB", FALSE);
1878  test_conversion(&testdata_24bppRGB, &testdata_24bppBGR, "24bppRGB -> 24bppBGR", FALSE);
1879 
1880  test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
1881  test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
1882  test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE);
1883 
1884  test_conversion(&testdata_64bppRGBA, &testdata_32bppRGBA, "64bppRGBA -> 32bppRGBA", FALSE);
1885  test_conversion(&testdata_64bppRGBA, &testdata_32bppRGB, "64bppRGBA -> 32bppRGB", FALSE);
1886 
1887  test_conversion(&testdata_24bppRGB, &testdata_32bppGrayFloat, "24bppRGB -> 32bppGrayFloat", FALSE);
1888  test_conversion(&testdata_32bppBGR, &testdata_32bppGrayFloat, "32bppBGR -> 32bppGrayFloat", FALSE);
1889 
1890  test_conversion(&testdata_24bppBGR, &testdata_8bppGray, "24bppBGR -> 8bppGray", FALSE);
1891  test_conversion(&testdata_32bppBGR, &testdata_8bppGray, "32bppBGR -> 8bppGray", FALSE);
1892  test_conversion(&testdata_32bppGrayFloat, &testdata_24bppBGR_gray, "32bppGrayFloat -> 24bppBGR gray", FALSE);
1893  test_conversion(&testdata_32bppGrayFloat, &testdata_8bppGray, "32bppGrayFloat -> 8bppGray", FALSE);
1894 
1898 
1899  test_encoder(&testdata_8bppIndexed, &CLSID_WICGifEncoder,
1900  &testdata_8bppIndexed, &CLSID_WICGifDecoder, "GIF encoder 8bppIndexed");
1901 
1902  test_encoder(&testdata_BlackWhite, &CLSID_WICPngEncoder,
1903  &testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
1904  test_encoder(&testdata_1bppIndexed, &CLSID_WICPngEncoder,
1905  &testdata_1bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 1bppIndexed");
1906  test_encoder(&testdata_2bppIndexed, &CLSID_WICPngEncoder,
1907  &testdata_2bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 2bppIndexed");
1908  test_encoder(&testdata_4bppIndexed, &CLSID_WICPngEncoder,
1909  &testdata_4bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 4bppIndexed");
1910  test_encoder(&testdata_8bppIndexed, &CLSID_WICPngEncoder,
1911  &testdata_8bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 8bppIndexed");
1912  test_encoder(&testdata_24bppBGR, &CLSID_WICPngEncoder,
1913  &testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 24bppBGR");
1914 if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in Wine */
1915 {
1916  test_encoder(&testdata_32bppBGR, &CLSID_WICPngEncoder,
1917  &testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 32bppBGR");
1918 }
1919 
1920  test_encoder(&testdata_BlackWhite, &CLSID_WICBmpEncoder,
1921  &testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder BlackWhite");
1922  test_encoder(&testdata_1bppIndexed, &CLSID_WICBmpEncoder,
1923  &testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 1bppIndexed");
1924  test_encoder(&testdata_2bppIndexed, &CLSID_WICBmpEncoder,
1925  &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 2bppIndexed");
1926  test_encoder(&testdata_4bppIndexed, &CLSID_WICBmpEncoder,
1927  &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 4bppIndexed");
1928  test_encoder(&testdata_8bppIndexed, &CLSID_WICBmpEncoder,
1929  &testdata_8bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 8bppIndexed");
1930  test_encoder(&testdata_32bppBGR, &CLSID_WICBmpEncoder,
1931  &testdata_32bppBGR, &CLSID_WICBmpDecoder, "BMP encoder 32bppBGR");
1932 
1933  test_encoder(&testdata_BlackWhite, &CLSID_WICTiffEncoder,
1934  &testdata_BlackWhite, &CLSID_WICTiffDecoder, "TIFF encoder BlackWhite");
1935  test_encoder(&testdata_1bppIndexed, &CLSID_WICTiffEncoder,
1936  &testdata_1bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 1bppIndexed");
1937  test_encoder(&testdata_2bppIndexed, &CLSID_WICTiffEncoder,
1938  &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 2bppIndexed");
1939  test_encoder(&testdata_4bppIndexed, &CLSID_WICTiffEncoder,
1940  &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 4bppIndexed");
1941  test_encoder(&testdata_8bppIndexed, &CLSID_WICTiffEncoder,
1942  &testdata_8bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 8bppIndexed");
1943  test_encoder(&testdata_24bppBGR, &CLSID_WICTiffEncoder,
1944  &testdata_24bppBGR, &CLSID_WICTiffDecoder, "TIFF encoder 24bppBGR");
1945 
1946  test_encoder(&testdata_24bppBGR, &CLSID_WICJpegEncoder,
1947  &testdata_24bppBGR, NULL, "JPEG encoder 24bppBGR");
1948 
1949  test_multi_encoder(multiple_frames, &CLSID_WICTiffEncoder,
1950  multiple_frames, &CLSID_WICTiffDecoder, NULL, NULL, "TIFF encoder multi-frame", NULL);
1951 
1953 
1954  test_multi_encoder(single_frame, &CLSID_WICPngEncoder,
1955  single_frame, &CLSID_WICPngDecoder, NULL, png_interlace_settings, "PNG encoder interlaced", NULL);
1956 
1957  IWICImagingFactory_Release(factory);
1958 
1959  CoUninitialize();
1960 }
static const struct bitmap_data testdata_4bppIndexed
Definition: converter.c:403
static const struct bitmap_data testdata_24bppBGR
Definition: converter.c:433
static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
Definition: converter.c:559
static const struct bitmap_data testdata_8bppIndexed_4colors
Definition: converter.c:415
static void test_default_converter(void)
Definition: converter.c:597
HRESULT hr
Definition: shlfolder.c:183
static const struct bitmap_data testdata_32bppRGBA80
Definition: converter.c:461
#define TRUE
Definition: types.h:120
static const struct bitmap_data testdata_32bppBGRA
Definition: converter.c:473
static const struct bitmap_data testdata_24bppRGB
Definition: converter.c:445
static const struct bitmap_data * multiple_frames[3]
Definition: converter.c:1673
static void test_encoder_rects(void)
Definition: converter.c:1641
static const struct bitmap_data testdata_8bppIndexed
Definition: converter.c:421
static void test_converter_8bppIndexed(void)
Definition: converter.c:1687
static const struct bitmap_data testdata_32bppBGR
Definition: converter.c:457
static const struct bitmap_data testdata_8bppIndexed_BW
Definition: converter.c:409
#define FALSE
Definition: types.h:117
static const struct bitmap_data testdata_32bppPBGRA
Definition: converter.c:489
static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID *clsid_encoder, const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette)
Definition: converter.c:1234
Definition: main.c:438
static const struct bitmap_data testdata_8bppGray
Definition: converter.c:544
static const struct bitmap_data testdata_BlackWhite
Definition: converter.c:386
static const struct bitmap_data testdata_32bppGrayFloat
Definition: converter.c:528
const char * winetest_platform
static void test_invalid_conversion(void)
Definition: converter.c:582
static const struct bitmap_data * single_frame[2]
Definition: converter.c:1678
LONG HRESULT
Definition: typedefs.h:79
static const struct bitmap_data testdata_1bppIndexed
Definition: converter.c:388
static const struct bitmap_data testdata_2bppIndexed
Definition: converter.c:395
static const struct bitmap_data testdata_32bppRGBA
Definition: converter.c:475
static const struct bitmap_data testdata_64bppRGBA
Definition: converter.c:503
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
#define NULL
Definition: types.h:112
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static void test_encoder(const struct bitmap_data *src, const CLSID *clsid_encoder, const struct bitmap_data *dst, const CLSID *clsid_decoder, const char *name)
Definition: converter.c:1609
static const struct setting png_interlace_settings[]
Definition: converter.c:1682
static const struct bitmap_data testdata_32bppPRGBA
Definition: converter.c:491
static const struct bitmap_data testdata_32bppRGB
Definition: converter.c:477
static const struct bitmap_data testdata_32bppBGRA80
Definition: converter.c:459
static const struct bitmap_data testdata_24bppBGR_gray
Definition: converter.c:556

◆ test_conversion()

static void test_conversion ( const struct bitmap_data src,
const struct bitmap_data dst,
const char name,
BOOL  todo 
)
static

Definition at line 559 of file converter.c.

560 {
561  BitmapTestSrc *src_obj;
562  IWICBitmapSource *dst_bitmap;
563  HRESULT hr;
564 
565  CreateTestBitmap(src, &src_obj);
566 
567  hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
569  ok(hr == S_OK ||
570  broken(hr == E_INVALIDARG || hr == WINCODEC_ERR_COMPONENTNOTFOUND) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
571 
572  if (hr == S_OK)
573  {
574  compare_bitmap_data(src, dst, dst_bitmap, name);
575 
576  IWICBitmapSource_Release(dst_bitmap);
577  }
578 
579  DeleteTestBitmap(src_obj);
580 }
HRESULT hr
Definition: shlfolder.c:183
BOOL todo
Definition: filedlg.c:313
static void compare_bitmap_data(const struct bitmap_data *src, const struct bitmap_data *expect, IWICBitmapSource *source, const char *name)
Definition: converter.c:326
static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
Definition: converter.c:215
#define E_INVALIDARG
Definition: ddrawi.h:101
#define todo_wine_if(is_todo)
Definition: test.h:163
static void DeleteTestBitmap(BitmapTestSrc *This)
Definition: converter.c:227
LONG HRESULT
Definition: typedefs.h:79
GLenum src
Definition: glext.h:6340
#define broken(x)
Definition: _sntprintf.h:21
IWICBitmapSource IWICBitmapSource_iface
Definition: converter.c:47
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
GLenum GLenum dst
Definition: glext.h:6340
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3288
Definition: name.c:38
HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst)
Definition: info.c:2474

Referenced by START_TEST().

◆ test_converter_8bppIndexed()

static void test_converter_8bppIndexed ( void  )
static

Definition at line 1687 of file converter.c.

1688 {
1689  HRESULT hr;
1690  BitmapTestSrc *src_obj;
1691  IWICFormatConverter *converter;
1693  UINT count, i;
1694  BYTE buf[32 * 2 * 3]; /* enough to hold 32x2 24bppBGR data */
1695 
1696  CreateTestBitmap(&testdata_24bppBGR, &src_obj);
1697 
1698  hr = IWICImagingFactory_CreatePalette(factory, &palette);
1699  ok(hr == S_OK, "CreatePalette error %#x\n", hr);
1700  count = 0xdeadbeef;
1701  hr = IWICPalette_GetColorCount(palette, &count);
1702  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1703  ok(count == 0, "expected 0, got %u\n", count);
1704 
1705  /* NULL palette + Custom type */
1706  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1707  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1708  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1709  &GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone,
1711  ok(hr == S_OK, "Initialize error %#x\n", hr);
1712  hr = IWICFormatConverter_CopyPalette(converter, palette);
1713  ok(hr == 0xdeadbeef, "unexpected error %#x\n", hr);
1714  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32 * 3, sizeof(buf), buf);
1715  ok(hr == S_OK, "CopyPixels error %#x\n", hr);
1716  IWICFormatConverter_Release(converter);
1717 
1718  /* NULL palette + Custom type */
1719  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1720  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1721  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1722  &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1724  ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
1725  hr = IWICFormatConverter_CopyPalette(converter, palette);
1726  ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
1727  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1728  ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
1729  IWICFormatConverter_Release(converter);
1730 
1731  /* empty palette + Custom type */
1732  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1733  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1734  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1735  &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1737  ok(hr == S_OK, "Initialize error %#x\n", hr);
1738  hr = IWICFormatConverter_CopyPalette(converter, palette);
1739  ok(hr == S_OK, "CopyPalette error %#x\n", hr);
1740  count = 0xdeadbeef;
1741  hr = IWICPalette_GetColorCount(palette, &count);
1742  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1743  ok(count == 0, "expected 0, got %u\n", count);
1744  memset(buf, 0xaa, sizeof(buf));
1745  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1746  ok(hr == S_OK, "CopyPixels error %#x\n", hr);
1747  count = 0;
1748  for (i = 0; i < 32 * 2; i++)
1749  if (buf[i] != 0) count++;
1750  ok(count == 0, "expected 0\n");
1751  IWICFormatConverter_Release(converter);
1752 
1753  /* NULL palette + Predefined type */
1754  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1755  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1756  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1757  &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1759  ok(hr == S_OK, "Initialize error %#x\n", hr);
1760  hr = IWICFormatConverter_CopyPalette(converter, palette);
1761  ok(hr == S_OK, "CopyPalette error %#x\n", hr);
1762  count = 0xdeadbeef;
1763  hr = IWICPalette_GetColorCount(palette, &count);
1764  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1765  ok(count == 16, "expected 16, got %u\n", count);
1766  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1767  ok(hr == S_OK, "CopyPixels error %#x\n", hr);
1768  count = 0;
1769  for (i = 0; i < 32 * 2; i++)
1770  if (buf[i] != 0) count++;
1771  ok(count != 0, "expected != 0\n");
1772  IWICFormatConverter_Release(converter);
1773 
1774  /* not empty palette + Predefined type */
1775  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1776  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1777  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1778  &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1780  ok(hr == S_OK, "Initialize error %#x\n", hr);
1781  hr = IWICFormatConverter_CopyPalette(converter, palette);
1782  ok(hr == S_OK, "CopyPalette error %#x\n", hr);
1783  count = 0xdeadbeef;
1784  hr = IWICPalette_GetColorCount(palette, &count);
1785  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1786  ok(count == 16, "expected 16, got %u\n", count);
1787  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1788  ok(hr == S_OK, "CopyPixels error %#x\n", hr);
1789  count = 0;
1790  for (i = 0; i < 32 * 2; i++)
1791  if (buf[i] != 0) count++;
1792  ok(count != 0, "expected != 0\n");
1793  IWICFormatConverter_Release(converter);
1794 
1795  /* not empty palette + MedianCut type */
1796  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1797  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1798  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1799  &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1801  ok(hr == S_OK, "Initialize error %#x\n", hr);
1802  hr = IWICFormatConverter_CopyPalette(converter, palette);
1803  ok(hr == S_OK, "CopyPalette error %#x\n", hr);
1804  count = 0xdeadbeef;
1805  hr = IWICPalette_GetColorCount(palette, &count);
1806  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1807  ok(count == 16, "expected 16, got %u\n", count);
1808  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1809  ok(hr == S_OK, "CopyPixels error %#x\n", hr);
1810  count = 0;
1811  for (i = 0; i < 32 * 2; i++)
1812  if (buf[i] != 0) count++;
1813  ok(count != 0, "expected != 0\n");
1814  IWICFormatConverter_Release(converter);
1815 
1816  /* NULL palette + MedianCut type */
1817  hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1818  ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
1819  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1820  &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1822  ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#x\n", hr);
1823  if (hr == S_OK)
1824  {
1825  hr = IWICFormatConverter_CopyPalette(converter, palette);
1826  ok(hr == S_OK, "CopyPalette error %#x\n", hr);
1827  count = 0xdeadbeef;
1828  hr = IWICPalette_GetColorCount(palette, &count);
1829  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1830  ok(count == 8, "expected 8, got %u\n", count);
1831  hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1832  ok(hr == S_OK, "CopyPixels error %#x\n", hr);
1833  count = 0;
1834  for (i = 0; i < 32 * 2; i++)
1835  if (buf[i] != 0) count++;
1836  ok(count != 0, "expected != 0\n");
1837  }
1838  IWICFormatConverter_Release(converter);
1839 
1840  IWICPalette_Release(palette);
1841  DeleteTestBitmap(src_obj);
1842 }
static const struct bitmap_data testdata_24bppBGR
Definition: converter.c:433
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
Definition: converter.c:215
Definition: main.c:438
#define E_INVALIDARG
Definition: ddrawi.h:101
static void DeleteTestBitmap(BitmapTestSrc *This)
Definition: converter.c:227
LONG HRESULT
Definition: typedefs.h:79
unsigned char BYTE
Definition: xxhash.c:193
static HPALETTE palette
Definition: clipboard.c:1345
#define broken(x)
Definition: _sntprintf.h:21
IWICBitmapSource IWICBitmapSource_iface
Definition: converter.c:47
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3273
#define S_OK
Definition: intsafe.h:51
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 ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_default_converter()

static void test_default_converter ( void  )
static

Definition at line 597 of file converter.c.

598 {
599  BitmapTestSrc *src_obj;
600  IWICFormatConverter *converter;
601  BOOL can_convert = TRUE;
602  HRESULT hr;
603 
605 
606  hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
607  &IID_IWICFormatConverter, (void**)&converter);
608  ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
609  if (SUCCEEDED(hr))
610  {
611  hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
612  &GUID_WICPixelFormat32bppBGR, &can_convert);
613  ok(SUCCEEDED(hr), "CanConvert returned %x\n", hr);
614  ok(can_convert, "expected TRUE, got %i\n", can_convert);
615 
616  hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
617  &GUID_WICPixelFormat32bppBGR, WICBitmapDitherTypeNone, NULL, 0.0,
619  ok(SUCCEEDED(hr), "Initialize returned %x\n", hr);
620 
621  if (SUCCEEDED(hr))
622  compare_bitmap_data(&testdata_32bppBGRA, &testdata_32bppBGR, (IWICBitmapSource*)converter, "default converter");
623 
624  IWICFormatConverter_Release(converter);
625  }
626 
627  DeleteTestBitmap(src_obj);
628 }
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
static const struct bitmap_data testdata_32bppBGRA
Definition: converter.c:473
static const struct bitmap_data testdata_32bppBGR
Definition: converter.c:457
static void compare_bitmap_data(const struct bitmap_data *src, const struct bitmap_data *expect, IWICBitmapSource *source, const char *name)
Definition: converter.c:326
static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
Definition: converter.c:215
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
static void DeleteTestBitmap(BitmapTestSrc *This)
Definition: converter.c:227
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
IWICBitmapSource IWICBitmapSource_iface
Definition: converter.c:47
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112

Referenced by START_TEST().

◆ test_encoder()

static void test_encoder ( const struct bitmap_data src,
const CLSID clsid_encoder,
const struct bitmap_data dst,
const CLSID clsid_decoder,
const char name 
)
static

Definition at line 1609 of file converter.c.

1611 {
1612  const struct bitmap_data *srcs[2];
1613  const struct bitmap_data *dsts[2];
1614  WICColor colors[256];
1616  HRESULT hr;
1617 
1618  hr = IWICImagingFactory_CreatePalette(factory, &palette);
1619  ok(hr == S_OK, "CreatePalette error %#x\n", hr);
1620 
1621  memset(colors, 0, sizeof(colors));
1622  colors[0] = 0x11111111;
1623  colors[1] = 0x22222222;
1624  colors[2] = 0x33333333;
1625  colors[3] = 0x44444444;
1626  colors[4] = 0x55555555;
1627  /* TIFF decoder fails to decode a 8bpp frame if palette has less than 256 colors */
1628  hr = IWICPalette_InitializeCustom(palette, colors, 256);
1629  ok(hr == S_OK, "InitializeCustom error %#x\n", hr);
1630 
1631  srcs[0] = src;
1632  srcs[1] = NULL;
1633  dsts[0] = dst;
1634  dsts[1] = NULL;
1635 
1636  test_multi_encoder(srcs, clsid_encoder, dsts, clsid_decoder, NULL, NULL, name, palette);
1637 
1638  IWICPalette_Release(palette);
1639 }
HRESULT hr
Definition: shlfolder.c:183
static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID *clsid_encoder, const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette)
Definition: converter.c:1234
Definition: main.c:438
LONG HRESULT
Definition: typedefs.h:79
GLenum src
Definition: glext.h:6340
static HPALETTE palette
Definition: clipboard.c:1345
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
GLenum GLenum dst
Definition: glext.h:6340
#define NULL
Definition: types.h:112
Definition: name.c:38
#define memset(x, y, z)
Definition: compat.h:39
UINT32 WICColor
Definition: wincodec.idl:250

Referenced by START_TEST().

◆ test_encoder_properties()

static void test_encoder_properties ( const CLSID clsid_encoder,
IPropertyBag2 options 
)
static

Definition at line 759 of file converter.c.

760 {
761  HRESULT hr;
762  ULONG cProperties = 0;
763  ULONG cProperties2 = 0;
764  PROPBAG2 all_props[64] = {{0}}; /* Should be enough for every encoder out there */
765  int i;
766 
767  /* CountProperties */
768  {
769  hr = IPropertyBag2_CountProperties(options, &cProperties);
770  ok(SUCCEEDED(hr), "Reading property count, hr=%x\n", hr);
771  }
772 
773  /* GetPropertyInfo */
774  {
775  hr = IPropertyBag2_GetPropertyInfo(options, cProperties, 1, all_props, &cProperties2);
776  ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - iProperty out of bounce handled wrong, hr=%x\n", hr);
777 
778  hr = IPropertyBag2_GetPropertyInfo(options, 0, cProperties+1, all_props, &cProperties2);
779  ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - cProperty out of bounce handled wrong, hr=%x\n", hr);
780 
781  if (cProperties == 0) /* GetPropertyInfo can be called for zero items on Windows 8 but not on Windows 7 (wine behaves like Win8) */
782  {
783  cProperties2 = cProperties;
784  hr = S_OK;
785  }
786  else
787  {
788  hr = IPropertyBag2_GetPropertyInfo(options, 0, min(64, cProperties), all_props, &cProperties2);
789  ok(SUCCEEDED(hr), "Reading infos from property bag failed, hr=%x\n", hr);
790  }
791 
792  if (FAILED(hr))
793  return;
794 
795  ok(cProperties == cProperties2, "Mismatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n",
796  (int)cProperties, (int)cProperties2);
797  }
798 
799  if (IsEqualCLSID(clsid_encoder, &CLSID_WICTiffEncoder))
801  else if (IsEqualCLSID(clsid_encoder, &CLSID_WICPngEncoder))
803  else if (IsEqualCLSID(clsid_encoder, &CLSID_WICJpegEncoder))
805  else if (IsEqualCLSID(clsid_encoder, &CLSID_WICBmpEncoder))
807 
808  for (i=0; i < cProperties2; i++)
809  {
810  ok(all_props[i].pstrName != NULL, "Unset property name in output of IPropertyBag2::GetPropertyInfo\n");
811  CoTaskMemFree(all_props[i].pstrName);
812  }
813 }
static void test_specific_encoder_properties(IPropertyBag2 *options, const property_opt_test_data *data, PROPBAG2 *all_props, int all_prop_cnt)
Definition: converter.c:690
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
#define WINCODEC_ERR_VALUEOUTOFRANGE
Definition: winerror.h:3274
static const struct property_opt_test_data testdata_png_props[]
Definition: converter.c:658
if SUCCEEDED(hr)
static const struct property_opt_test_data testdata_tiff_props[]
Definition: converter.c:652
static const struct property_opt_test_data testdata_bmp_props[]
Definition: converter.c:674
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
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 ok(value,...)
Definition: atltest.h:57
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
static const struct property_opt_test_data testdata_jpeg_props[]
Definition: converter.c:664
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

Referenced by test_multi_encoder().

◆ test_encoder_rects()

static void test_encoder_rects ( void  )
static

Definition at line 1641 of file converter.c.

1642 {
1643  const struct bitmap_data *srcs[2];
1644  const struct bitmap_data *dsts[2];
1645  WICRect rc;
1646 
1647  srcs[0] = &testdata_24bppBGR;
1648  srcs[1] = NULL;
1649  dsts[0] = &testdata_24bppBGR;
1650  dsts[1] = NULL;
1651 
1652  rc.X = 0;
1653  rc.Y = 0;
1654  rc.Width = 32;
1655  rc.Height = 2;
1656 
1657  test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects full", NULL);
1658 
1659  rc.Width = 0;
1660  test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=0", NULL);
1661 
1662  rc.Width = -1;
1663  test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=-1", NULL);
1664 
1665  rc.Width = 32;
1666  rc.Height = 0;
1667  test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=0", NULL);
1668 
1669  rc.Height = -1;
1670  test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=-1", NULL);
1671 }
static const struct bitmap_data testdata_24bppBGR
Definition: converter.c:433
static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID *clsid_encoder, const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette)
Definition: converter.c:1234
INT Height
Definition: wincodec.idl:239
#define NULL
Definition: types.h:112
INT Width
Definition: wincodec.idl:238

Referenced by START_TEST().

◆ test_invalid_conversion()

static void test_invalid_conversion ( void  )
static

Definition at line 582 of file converter.c.

583 {
584  BitmapTestSrc *src_obj;
585  IWICBitmapSource *dst_bitmap;
586  HRESULT hr;
587 
589 
590  /* convert to a non-pixel-format GUID */
591  hr = WICConvertBitmapSource(&GUID_VendorMicrosoft, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
592  ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "WICConvertBitmapSource returned %x\n", hr);
593 
594  DeleteTestBitmap(src_obj);
595 }
HRESULT hr
Definition: shlfolder.c:183
static const struct bitmap_data testdata_32bppBGRA
Definition: converter.c:473
static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
Definition: converter.c:215
static void DeleteTestBitmap(BitmapTestSrc *This)
Definition: converter.c:227
LONG HRESULT
Definition: typedefs.h:79
IWICBitmapSource IWICBitmapSource_iface
Definition: converter.c:47
#define ok(value,...)
Definition: atltest.h:57
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3288
HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst)
Definition: info.c:2474

Referenced by START_TEST().

◆ test_multi_encoder()

static void test_multi_encoder ( const struct bitmap_data **  srcs,
const CLSID clsid_encoder,
const struct bitmap_data **  dsts,
const CLSID clsid_decoder,
WICRect rc,
const struct setting settings,
const char name,
IWICPalette palette 
)
static

Definition at line 1234 of file converter.c.

1237 {
1238  const GUID *container_format = NULL;
1239  HRESULT hr;
1240  IWICBitmapEncoder *encoder;
1241  BitmapTestSrc *src_obj;
1242  HGLOBAL hglobal;
1243  IStream *stream;
1244  IWICBitmapFrameEncode *frameencode;
1246  IWICBitmapDecoder *decoder;
1247  IWICBitmapFrameDecode *framedecode;
1249  GUID guid;
1250  int i;
1251 
1252  hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
1253  &IID_IWICBitmapEncoder, (void **)&encoder);
1254  ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
1255 
1257  ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
1258 
1259  hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
1260  ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
1261 
1262  if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
1263  container_format = &GUID_ContainerFormatPng;
1264  else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder))
1265  container_format = &GUID_ContainerFormatBmp;
1266  else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder))
1267  container_format = &GUID_ContainerFormatTiff;
1268  else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder))
1269  container_format = &GUID_ContainerFormatJpeg;
1270  else
1271  ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder));
1272 
1273  if (container_format)
1274  {
1275  memset(&guid, 0, sizeof(guid));
1276  hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
1277  ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr);
1278  ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
1279  }
1280 
1281  hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
1282  ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
1283 
1284  /* Encoder options are optional. */
1285  hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, NULL);
1286  ok(SUCCEEDED(hr), "Failed to create encode frame, hr %#x.\n", hr);
1287 
1288  IStream_Release(stream);
1289  IWICBitmapEncoder_Release(encoder);
1290  IWICBitmapFrameEncode_Release(frameencode);
1291 
1292  hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
1293  &IID_IWICBitmapEncoder, (void**)&encoder);
1294  ok(SUCCEEDED(hr), "CoCreateInstance(%s) failed, hr=%x\n", wine_dbgstr_guid(clsid_encoder), hr);
1295  if (SUCCEEDED(hr))
1296  {
1297  hglobal = GlobalAlloc(GMEM_MOVEABLE, 0);
1298  ok(hglobal != NULL, "GlobalAlloc failed\n");
1299  if (hglobal)
1300  {
1301  hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
1302  ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
1303  }
1304 
1305  if (hglobal && SUCCEEDED(hr))
1306  {
1308 
1309  if (palette)
1310  {
1311  hr = IWICBitmapEncoder_SetPalette(encoder, palette);
1312  ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#x (%s)\n", hr, name);
1313  }
1314 
1315  hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
1316  ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
1317 
1318  if (palette)
1319  {
1320  hr = IWICBitmapEncoder_SetPalette(encoder, palette);
1321  if (IsEqualGUID(clsid_encoder, &CLSID_WICGifEncoder))
1322  ok(hr == S_OK, "SetPalette failed, hr=%#x\n", hr);
1323  else
1324  ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "wrong error %#x\n", hr);
1325  hr = S_OK;
1326  }
1327 
1328  hr = IWICBitmapEncoder_GetEncoderInfo(encoder, &info);
1329  ok(hr == S_OK || hr == WINCODEC_ERR_COMPONENTNOTFOUND, "wrong error %#x\n", hr);
1330  if (SUCCEEDED(hr))
1331  {
1332  CLSID clsid;
1333 
1334  hr = IWICBitmapEncoderInfo_GetCLSID(info, &clsid);
1335  ok(hr == S_OK, "wrong error %#x\n", hr);
1336  ok(!IsEqualGUID(clsid_encoder, &clsid), "wrong CLSID %s (%s)\n",
1337  wine_dbgstr_guid(clsid_encoder), wine_dbgstr_guid(&clsid));
1338 
1339  IWICBitmapEncoderInfo_Release(info);
1340  }
1341 
1342  i=0;
1343  while (SUCCEEDED(hr) && srcs[i])
1344  {
1345  CreateTestBitmap(srcs[i], &src_obj);
1346 
1347  hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, &options);
1348  ok(SUCCEEDED(hr), "CreateFrame failed, hr=%x\n", hr);
1349  if (SUCCEEDED(hr))
1350  {
1351  ok(options != NULL, "Encoder initialization has not created an property bag\n");
1352  if(options)
1353  test_encoder_properties(clsid_encoder, options);
1354 
1355  if (settings)
1356  {
1357  int j;
1358  for (j=0; settings[j].name; j++)
1359  {
1360  PROPBAG2 propbag;
1361  VARIANT var;
1362 
1363  memset(&propbag, 0, sizeof(propbag));
1364  memset(&var, 0, sizeof(var));
1365  propbag.pstrName = (LPOLESTR)settings[j].name;
1366  propbag.dwType = settings[j].type;
1367  V_VT(&var) = settings[j].vt;
1368  V_UNKNOWN(&var) = settings[j].value;
1369 
1370  hr = IPropertyBag2_Write(options, 1, &propbag, &var);
1371  ok(SUCCEEDED(hr), "Writing property %s failed, hr=%x\n", wine_dbgstr_w(settings[j].name), hr);
1372  }
1373  }
1374 
1375  if (palette)
1376  {
1377  hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1378  ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#x\n", hr);
1379  }
1380 
1381  hr = IWICBitmapFrameEncode_Initialize(frameencode, options);
1382  ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
1383 
1384  memcpy(&pixelformat, srcs[i]->format, sizeof(GUID));
1385  hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &pixelformat);
1386  ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%x\n", hr);
1387  ok(IsEqualGUID(&pixelformat, dsts[i]->format) ||
1388  (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)) ||
1389  (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
1390  "SetPixelFormat changed the format to %s (%s)\n", wine_dbgstr_guid(&pixelformat), name);
1391 
1392  hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height);
1393  ok(SUCCEEDED(hr), "SetSize failed, hr=%x\n", hr);
1394 
1395  if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
1396  test_set_frame_palette(frameencode);
1397 
1398  if (palette)
1399  {
1400  WICColor colors[256];
1401 
1402  hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1403  ok(SUCCEEDED(hr), "SetPalette failed, hr=%x (%s)\n", hr, name);
1404 
1405  /* trash the assigned palette */
1406  memset(colors, 0, sizeof(colors));
1407  hr = IWICPalette_InitializeCustom(palette, colors, 256);
1408  ok(hr == S_OK, "InitializeCustom error %#x\n", hr);
1409  }
1410 
1411  hr = IWICBitmapFrameEncode_WriteSource(frameencode, &src_obj->IWICBitmapSource_iface, rc);
1412  if (rc && (rc->Width <= 0 || rc->Height <= 0))
1413  {
1414  /* WriteSource fails but WriteSource_Proxy succeeds. */
1415  ok(hr == E_INVALIDARG, "WriteSource should fail, hr=%x (%s)\n", hr, name);
1417  ok(SUCCEEDED(hr), "WriteSource_Proxy failed, %dx%d, hr=%x (%s)\n", rc->Width, rc->Height, hr, name);
1418  }
1419  else
1420  {
1421  if (rc)
1422  ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%x (%s)\n", rc->Width, rc->Height, hr, name);
1423  else
1424  ok(hr == S_OK ||
1425  (FAILED(hr) && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2) /* XP */ ||
1426  (FAILED(hr) && IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) /* XP */ ||
1427  broken(hr == E_INVALIDARG && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && IsEqualGUID(srcs[i]->format, &GUID_WICPixelFormatBlackWhite)) /* XP */,
1428  "WriteSource(NULL) failed, hr=%x (%s)\n", hr, name);
1429  }
1430 
1431  if (SUCCEEDED(hr))
1432  {
1433  hr = IWICBitmapFrameEncode_Commit(frameencode);
1434  ok(SUCCEEDED(hr), "Commit failed, hr=%x (%s)\n", hr, name);
1435  }
1436 
1437  IWICBitmapFrameEncode_Release(frameencode);
1438  IPropertyBag2_Release(options);
1439  }
1440 
1441  DeleteTestBitmap(src_obj);
1442 
1443  i++;
1444  }
1445 
1446  if (clsid_decoder == NULL)
1447  {
1448  IStream_Release(stream);
1449  IWICBitmapEncoder_Release(encoder);
1450  return;
1451  }
1452 
1453  if (SUCCEEDED(hr))
1454  {
1455  hr = IWICBitmapEncoder_Commit(encoder);
1456  ok(SUCCEEDED(hr), "Commit failed, hr=%x\n", hr);
1457 
1458  if (IsEqualGUID(&pixelformat, dsts[0]->format))
1459  check_bitmap_format(stream, clsid_encoder, dsts[0]->format);
1460  }
1461 
1462  if (SUCCEEDED(hr))
1463  {
1464  hr = CoCreateInstance(clsid_decoder, NULL, CLSCTX_INPROC_SERVER,
1465  &IID_IWICBitmapDecoder, (void**)&decoder);
1466  ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
1467  }
1468 
1469  if (SUCCEEDED(hr))
1470  {
1471  IWICPalette *frame_palette;
1472 
1473  hr = IWICImagingFactory_CreatePalette(factory, &frame_palette);
1474  ok(hr == S_OK, "CreatePalette error %#x\n", hr);
1475 
1476  hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
1477  if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
1478  ok(hr == WINCODEC_ERR_WRONGSTATE, "wrong error %#x\n", hr);
1479  else
1480  ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
1481 
1482  hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
1483  ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
1484 
1485  hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
1486  if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
1487  ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING) /* XP */, "CopyPalette failed, hr=%#x\n", hr);
1488  else
1489  ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
1490 
1491  hr = S_OK;
1492  i=0;
1493  while (SUCCEEDED(hr) && dsts[i])
1494  {
1495  hr = IWICBitmapDecoder_GetFrame(decoder, i, &framedecode);
1496  ok(SUCCEEDED(hr), "GetFrame failed, hr=%x (%s)\n", hr, name);
1497 
1498  if (SUCCEEDED(hr))
1499  {
1500  hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &pixelformat);
1501  ok(hr == S_OK, "GetPixelFormat) failed, hr=%x (%s)\n", hr, name);
1502  if (IsEqualGUID(&pixelformat, dsts[i]->format))
1503  compare_bitmap_data(srcs[i], dsts[i], (IWICBitmapSource*)framedecode, name);
1504 
1505  hr = IWICBitmapFrameDecode_CopyPalette(framedecode, frame_palette);
1506  if (winetest_debug > 1)
1507  trace("%s, bpp %d, %s, hr %#x\n", name, dsts[i]->bpp, wine_dbgstr_guid(dsts[i]->format), hr);
1508  if (dsts[i]->bpp > 8 || IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormatBlackWhite))
1509  ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
1510  else
1511  {
1512  UINT count, ret;
1513  WICColor colors[256];
1514 
1515  ok(hr == S_OK, "CopyPalette error %#x (%s)\n", hr, name);
1516 
1517  count = 0;
1518  hr = IWICPalette_GetColorCount(frame_palette, &count);
1519  ok(hr == S_OK, "GetColorCount error %#x\n", hr);
1520 
1521  memset(colors, 0, sizeof(colors));
1522  ret = 0;
1523  hr = IWICPalette_GetColors(frame_palette, count, colors, &ret);
1524  ok(hr == S_OK, "GetColors error %#x\n", hr);
1525  ok(ret == count, "expected %u, got %u\n", count, ret);
1526  if (IsEqualGUID(clsid_decoder, &CLSID_WICPngDecoder))
1527  {
1528  /* Newer libpng versions don't accept larger palettes than the declared
1529  * bit depth, so we need to generate the palette of the correct length.
1530  */
1531  ok(count == 256 || (dsts[i]->bpp == 1 && count == 2) ||
1532  (dsts[i]->bpp == 2 && count == 4) || (dsts[i]->bpp == 4 && count == 16),
1533  "expected 256, got %u (%s)\n", count, name);
1534 
1535  ok(colors[0] == 0x11111111, "got %08x (%s)\n", colors[0], name);
1536  ok(colors[1] == 0x22222222, "got %08x (%s)\n", colors[1], name);
1537  if (count > 2)
1538  {
1539  ok(colors[2] == 0x33333333, "got %08x (%s)\n", colors[2], name);
1540  ok(colors[3] == 0x44444444, "got %08x (%s)\n", colors[3], name);
1541  if (count > 4)
1542  {
1543  ok(colors[4] == 0x55555555, "got %08x (%s)\n", colors[4], name);
1544  ok(colors[5] == 0, "got %08x (%s)\n", colors[5], name);
1545  }
1546  }
1547  }
1548  else if (IsEqualGUID(clsid_decoder, &CLSID_WICBmpDecoder) ||
1549  IsEqualGUID(clsid_decoder, &CLSID_WICTiffDecoder) ||
1550  IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
1551  {
1552  if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormatBlackWhite) ||
1553  IsEqualGUID(&pixelformat, &GUID_WICPixelFormat8bppIndexed))
1554  {
1555  ok(count == 256, "expected 256, got %u (%s)\n", count, name);
1556 
1557  ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
1558  ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
1559  ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
1560  ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
1561  ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
1562  ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
1563  }
1564  else if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed))
1565  {
1566  ok(count == 16, "expected 16, got %u (%s)\n", count, name);
1567 
1568  ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
1569  ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
1570  ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
1571  ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
1572  ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
1573  ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
1574  }
1575  else
1576  {
1577  ok(count == 2, "expected 2, got %u (%s)\n", count, name);
1578 
1579  ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
1580  ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
1581  }
1582  }
1583  else
1584  {
1585  ok(count == 2, "expected 2, got %u (%s)\n", count, name);
1586 
1587  ok(colors[0] == 0xff111111, "got %08x\n", colors[0]);
1588  ok(colors[1] == 0xff222222, "got %08x\n", colors[1]);
1589  }
1590  }
1591 
1592  IWICBitmapFrameDecode_Release(framedecode);
1593  }
1594 
1595  i++;
1596  }
1597 
1598  IWICPalette_Release(frame_palette);
1599  IWICBitmapDecoder_Release(decoder);
1600  }
1601 
1602  IStream_Release(stream);
1603  }
1604 
1605  IWICBitmapEncoder_Release(encoder);
1606  }
1607 }
const char * var
Definition: shader.c:5666
struct mke2fs_defaults settings[]
GLint GLint GLsizei width
Definition: gl.h:1546
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT hr
Definition: shlfolder.c:183
static void test_encoder_properties(const CLSID *clsid_encoder, IPropertyBag2 *options)
Definition: converter.c:759
static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WICPixelFormatGUID *format)
Definition: converter.c:1159
#define TRUE
Definition: types.h:120
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei count
Definition: gl.h:1545
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define WINCODEC_ERR_NOTINITIALIZED
Definition: winerror.h:3277
static LPOLESTR
Definition: stg_prop.c:27
int winetest_debug
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void compare_bitmap_data(const struct bitmap_data *src, const struct bitmap_data *expect, IWICBitmapSource *source, const char *name)
Definition: converter.c:326
const GUID * guid
static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
Definition: converter.c:215
Definition: main.c:438
if SUCCEEDED(hr)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3284
pixelformat
Definition: converter.c:40
INT Height
Definition: wincodec.idl:239
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
#define trace
Definition: atltest.h:70
static void DeleteTestBitmap(BitmapTestSrc *This)
Definition: converter.c:227
LONG HRESULT
Definition: typedefs.h:79
int ret
#define WINCODEC_ERR_FRAMEMISSING
Definition: winerror.h:3293
REFCLSID clsid
Definition: msctf.c:82
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define V_VT(A)
Definition: oleauto.h:211
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
Definition: winerror.h:3300
#define V_UNKNOWN(A)
Definition: oleauto.h:281
HRESULT STDMETHODCALLTYPE IWICBitmapFrameEncode_WriteSource_Proxy(IWICBitmapFrameEncode *This, IWICBitmapSource *pIBitmapSource, WICRect *prc)
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
IWICBitmapSource IWICBitmapSource_iface
Definition: converter.c:47
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3273
#define S_OK
Definition: intsafe.h:51
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 ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
INT Width
Definition: wincodec.idl:238
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3288
static void test_set_frame_palette(IWICBitmapFrameEncode *frameencode)
Definition: converter.c:1199
Definition: name.c:38
DWORD bpp
Definition: surface.c:182
#define memset(x, y, z)
Definition: compat.h:39
UINT32 WICColor
Definition: wincodec.idl:250
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by START_TEST(), test_encoder(), and test_encoder_rects().

◆ test_set_frame_palette()

static void test_set_frame_palette ( IWICBitmapFrameEncode frameencode)
static

Definition at line 1199 of file converter.c.

1200 {
1203  HRESULT hr;
1204 
1205  hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
1206  &IID_IWICComponentFactory, (void **)&factory);
1207  ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
1208 
1209  hr = IWICBitmapFrameEncode_SetPalette(frameencode, NULL);
1210  ok(hr == E_INVALIDARG, "SetPalette failed, hr=%x\n", hr);
1211 
1212  hr = IWICComponentFactory_CreatePalette(factory, &palette);
1213  ok(hr == S_OK, "CreatePalette failed, hr=%x\n", hr);
1214 
1215  hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1216 todo_wine
1217  ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr=%x\n", hr);
1218 
1219  hr = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeFixedHalftone256, FALSE);
1220  ok(hr == S_OK, "InitializePredefined failed, hr=%x\n", hr);
1221 
1222  EXPECT_REF(palette, 1);
1223  hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1224  ok(hr == S_OK, "SetPalette failed, hr=%x\n", hr);
1225  EXPECT_REF(palette, 1);
1226 
1227  hr = IWICBitmapFrameEncode_SetPalette(frameencode, NULL);
1228  ok(hr == E_INVALIDARG, "SetPalette failed, hr=%x\n", hr);
1229 
1230  IWICPalette_Release(palette);
1231  IWICComponentFactory_Release(factory);
1232 }
HRESULT hr
Definition: shlfolder.c:183
static IWICImagingFactory * factory
Definition: converter.c:33
#define WINCODEC_ERR_NOTINITIALIZED
Definition: winerror.h:3277
#define FALSE
Definition: types.h:117
Definition: main.c:438
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
#define EXPECT_REF(obj, ref)
Definition: converter.c:1190
#define todo_wine
Definition: test.h:162
static HPALETTE palette
Definition: clipboard.c:1345
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112

Referenced by test_multi_encoder().

◆ test_specific_encoder_properties()

static void test_specific_encoder_properties ( IPropertyBag2 options,
const property_opt_test_data data,
PROPBAG2 *  all_props,
int  all_prop_cnt 
)
static

Definition at line 690 of file converter.c.

691 {
692  HRESULT hr;
693  int i = 0;
694  VARIANT pvarValue;
695  HRESULT phrError = S_OK;
696 
697  while (data[i].name)
698  {
699  int idx = find_property_index(data[i].name, all_props, all_prop_cnt);
700  PROPBAG2 pb = {0};
701  pb.pstrName = (LPOLESTR)data[i].name;
702 
703  hr = IPropertyBag2_Read(options, 1, &pb, NULL, &pvarValue, &phrError);
704 
705  if (data[i].skippable && idx == -1)
706  {
707  win_skip("Property %s is not supported on this machine.\n", wine_dbgstr_w(data[i].name));
708  i++;
709  continue;
710  }
711 
712  ok(idx >= 0, "Property %s not in output of GetPropertyInfo\n",
714  if (idx >= 0)
715  {
716  ok(all_props[idx].vt == data[i].var_type, "Property %s has unexpected vt type, vt=%i\n",
717  wine_dbgstr_w(data[i].name), all_props[idx].vt);
718  ok(all_props[idx].dwType == PROPBAG2_TYPE_DATA, "Property %s has unexpected dw type, vt=%i\n",
719  wine_dbgstr_w(data[i].name), all_props[idx].dwType);
720  ok(all_props[idx].cfType == 0, "Property %s has unexpected cf type, vt=%i\n",
721  wine_dbgstr_w(data[i].name), all_props[idx].cfType);
722  }
723 
724  ok(SUCCEEDED(hr), "Reading property %s from bag failed, hr=%x\n",
725  wine_dbgstr_w(data[i].name), hr);
726 
727  if (SUCCEEDED(hr))
728  {
729  /* On XP the initial type is always VT_EMPTY */
730  ok(V_VT(&pvarValue) == data[i].initial_var_type || V_VT(&pvarValue) == VT_EMPTY,
731  "Property %s has unexpected initial type, V_VT=%i\n",
732  wine_dbgstr_w(data[i].name), V_VT(&pvarValue));
733 
734  if(V_VT(&pvarValue) == data[i].initial_var_type)
735  {
736  switch (data[i].initial_var_type)
737  {
738  case VT_BOOL:
739  case VT_UI1:
740  ok(V_UNION(&pvarValue, bVal) == data[i].i_init_val, "Property %s has an unexpected initial value, pvarValue=%i\n",
741  wine_dbgstr_w(data[i].name), V_UNION(&pvarValue, bVal));
742  break;
743  case VT_R4:
744  ok(V_UNION(&pvarValue, fltVal) == data[i].f_init_val, "Property %s has an unexpected initial value, pvarValue=%f\n",
745  wine_dbgstr_w(data[i].name), V_UNION(&pvarValue, fltVal));
746  break;
747  default:
748  break;
749  }
750  }
751 
752  VariantClear(&pvarValue);
753  }
754 
755  i++;
756  }
757 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static LPOLESTR
Definition: stg_prop.c:27
if SUCCEEDED(hr)
unsigned int idx
Definition: utils.c:41
LONG HRESULT
Definition: typedefs.h:79
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
Definition: compat.h:2158
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:51
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 V_UNION(A, B)
Definition: oleauto.h:212
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
Definition: name.c:38
#define win_skip
Definition: test.h:149
static int find_property_index(const WCHAR *name, PROPBAG2 *all_props, int all_prop_cnt)
Definition: converter.c:679

Referenced by test_encoder_properties().

Variable Documentation

◆ BitmapTestSrc_Vtbl

const IWICBitmapSourceVtbl BitmapTestSrc_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI BitmapTestSrc_QueryInterface(IWICBitmapSource *iface, REFIID iid, void **ppv)
Definition: converter.c:65
static ULONG WINAPI BitmapTestSrc_Release(IWICBitmapSource *iface)
Definition: converter.c:87
static HRESULT WINAPI BitmapTestSrc_CopyPixels(IWICBitmapSource *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: converter.c:147
static HRESULT WINAPI BitmapTestSrc_GetResolution(IWICBitmapSource *iface, double *pDpiX, double *pDpiY)
Definition: converter.c:111
static ULONG WINAPI BitmapTestSrc_AddRef(IWICBitmapSource *iface)
Definition: converter.c:80
static HRESULT WINAPI BitmapTestSrc_GetPixelFormat(IWICBitmapSource *iface, WICPixelFormatGUID *pPixelFormat)
Definition: converter.c:103
static HRESULT WINAPI BitmapTestSrc_CopyPalette(IWICBitmapSource *iface, IWICPalette *palette)
Definition: converter.c:120
static HRESULT WINAPI BitmapTestSrc_GetSize(IWICBitmapSource *iface, UINT *puiWidth, UINT *puiHeight)
Definition: converter.c:94

Definition at line 204 of file converter.c.

Referenced by CreateTestBitmap(), and DeleteTestBitmap().

◆ bits_1bpp

const BYTE bits_1bpp[]
static
Initial value:
= {
0x55,0x55,0x55,0x55,
0xaa,0xaa,0xaa,0xaa}

Definition at line 383 of file converter.c.

◆ bits_24bppBGR

const BYTE bits_24bppBGR[]
static
Initial value:
= {
255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255}

Definition at line 424 of file converter.c.

◆ bits_24bppBGR_gray

const BYTE bits_24bppBGR_gray[]
static
Initial value:
= {
76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255}

Definition at line 547 of file converter.c.

◆ bits_24bppRGB

const BYTE bits_24bppRGB[]
static
Initial value:
= {
0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255 }

Definition at line 436 of file converter.c.

◆ bits_2bpp

const BYTE bits_2bpp[]
static
Initial value:
= {
0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24}

Definition at line 392 of file converter.c.

◆ bits_32bppBGR

const BYTE bits_32bppBGR[]
static
Initial value:
= {
255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80,
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80,
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80,
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80}

Definition at line 448 of file converter.c.

◆ bits_32bppBGRA

const BYTE bits_32bppBGRA[]
static
Initial value:
= {
255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255,
0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255,
0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255,
0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255}

Definition at line 464 of file converter.c.

◆ bits_32bppGrayFloat

const float bits_32bppGrayFloat[]
static
Initial value:
= {
0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f}

Definition at line 519 of file converter.c.

Referenced by test_color_formats().

◆ bits_32bppGrayFloat_xp

const float bits_32bppGrayFloat_xp[]
static
Initial value:
= {
0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f}

Definition at line 507 of file converter.c.

◆ bits_32bppPBGRA

const BYTE bits_32bppPBGRA[]
static
Initial value:
= {
80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80,
0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80,
0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80,
0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80}

Definition at line 480 of file converter.c.

◆ bits_4bpp

const BYTE bits_4bpp[]
static
Initial value:
= {
0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44}

Definition at line 399 of file converter.c.

◆ bits_64bppRGBA

const BYTE bits_64bppRGBA[]
static
Initial value:
= {
128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,
128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,
128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,
128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,
128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,
128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,
128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,
128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255}

Definition at line 494 of file converter.c.

Referenced by test_color_formats().

◆ bits_8bpp

const BYTE bits_8bpp[]
static
Initial value:
= {
0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}

Definition at line 418 of file converter.c.

◆ bits_8bpp_4colors

const BYTE bits_8bpp_4colors[]
static
Initial value:
= {
0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,
3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3}

Definition at line 412 of file converter.c.

◆ bits_8bpp_BW

const BYTE bits_8bpp_BW[]
static
Initial value:
= {
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0}

Definition at line 406 of file converter.c.

◆ bits_8bppGray

const BYTE bits_8bppGray[]
static
Initial value:
= {
76,220,127,0,76,220,127,0,76,220,127,0,76,220,127,0,
76,220,127,0,76,220,127,0,76,220,127,0,76,220,127,0,
247,145,230,255,247,145,230,255,247,145,230,255,247,145,230,255,
247,145,230,255,247,145,230,255,247,145,230,255,247,145,230,255}

Definition at line 539 of file converter.c.

Referenced by test_color_formats().

◆ bits_8bppGray_xp

const BYTE bits_8bppGray_xp[]
static
Initial value:
= {
29,150,76,0,29,150,76,0,29,150,76,0,29,150,76,0,
29,150,76,0,29,150,76,0,29,150,76,0,29,150,76,0,
226,105,179,255,226,105,179,255,226,105,179,255,226,105,179,255,
226,105,179,255,226,105,179,255,226,105,179,255,226,105,179,255}

Definition at line 531 of file converter.c.

◆ factory

Definition at line 33 of file converter.c.

Referenced by test_set_frame_palette().

◆ multiple_frames

const struct bitmap_data* multiple_frames[3]
static
Initial value:
= {
static const struct bitmap_data testdata_24bppBGR
Definition: converter.c:433
#define NULL
Definition: types.h:112

Definition at line 1673 of file converter.c.

Referenced by START_TEST().

◆ png_interlace_settings

const struct setting png_interlace_settings[]
static
Initial value:
= {
{wszInterlaceOption, PROPBAG2_TYPE_DATA, VT_BOOL, (void*)VARIANT_TRUE},
{NULL}
}
static const WCHAR wszInterlaceOption[]
Definition: converter.c:642
#define NULL
Definition: types.h:112

Definition at line 1682 of file converter.c.

Referenced by START_TEST().

◆ single_frame

const struct bitmap_data* single_frame[2]
static
Initial value:
= {
static const struct bitmap_data testdata_24bppBGR
Definition: converter.c:433
#define NULL
Definition: types.h:112

Definition at line 1678 of file converter.c.

Referenced by START_TEST().

◆ testdata_1bppIndexed

const struct bitmap_data testdata_1bppIndexed
static
Initial value:
= {
&GUID_WICPixelFormat1bppIndexed, 1, bits_1bpp, 32, 2, 96.0, 96.0}
static const BYTE bits_1bpp[]
Definition: converter.c:383

Definition at line 388 of file converter.c.

Referenced by START_TEST().

◆ testdata_24bppBGR

const struct bitmap_data testdata_24bppBGR
static
Initial value:
= {
&GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR, 32, 2, 96.0, 96.0}
static const BYTE bits_24bppBGR[]
Definition: converter.c:424

Definition at line 433 of file converter.c.

Referenced by START_TEST(), test_converter_8bppIndexed(), and test_encoder_rects().

◆ testdata_24bppBGR_gray

const struct bitmap_data testdata_24bppBGR_gray
static
Initial value:
= {
&GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR_gray, 32, 2, 96.0, 96.0}
static const BYTE bits_24bppBGR_gray[]
Definition: converter.c:547

Definition at line 556 of file converter.c.

Referenced by START_TEST().

◆ testdata_24bppRGB

const struct bitmap_data testdata_24bppRGB
static
Initial value:
= {
&GUID_WICPixelFormat24bppRGB, 24, bits_24bppRGB, 32, 2, 96.0, 96.0}
static const BYTE bits_24bppRGB[]
Definition: converter.c:436

Definition at line 445 of file converter.c.

Referenced by START_TEST().

◆ testdata_2bppIndexed

const struct bitmap_data testdata_2bppIndexed
static
Initial value:
= {
&GUID_WICPixelFormat2bppIndexed, 2, bits_2bpp, 32, 2, 96.0, 96.0}
static const BYTE bits_2bpp[]
Definition: converter.c:392

Definition at line 395 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppBGR

const struct bitmap_data testdata_32bppBGR
static
Initial value:
= {
&GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppBGR[]
Definition: converter.c:448

Definition at line 457 of file converter.c.

Referenced by START_TEST(), and test_default_converter().

◆ testdata_32bppBGRA

const struct bitmap_data testdata_32bppBGRA
static
Initial value:
= {
&GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppBGRA[]
Definition: converter.c:464

Definition at line 473 of file converter.c.

Referenced by START_TEST(), test_default_converter(), and test_invalid_conversion().

◆ testdata_32bppBGRA80

const struct bitmap_data testdata_32bppBGRA80
static
Initial value:
= {
&GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGR, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppBGR[]
Definition: converter.c:448

Definition at line 459 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppGrayFloat

const struct bitmap_data testdata_32bppGrayFloat
static
Initial value:
= {
&GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat, 32, 2, 96.0, 96.0, &testdata_32bppGrayFloat_xp}
static const float bits_32bppGrayFloat[]
Definition: converter.c:519
static const struct bitmap_data testdata_32bppGrayFloat_xp
Definition: converter.c:516
unsigned char BYTE
Definition: xxhash.c:193

Definition at line 528 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppGrayFloat_xp

const struct bitmap_data testdata_32bppGrayFloat_xp
static
Initial value:
= {
&GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat_xp, 32, 2, 96.0, 96.0}
static const float bits_32bppGrayFloat_xp[]
Definition: converter.c:507
unsigned char BYTE
Definition: xxhash.c:193

Definition at line 516 of file converter.c.

◆ testdata_32bppPBGRA

const struct bitmap_data testdata_32bppPBGRA
static
Initial value:
= {
&GUID_WICPixelFormat32bppPBGRA, 32, bits_32bppPBGRA, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppPBGRA[]
Definition: converter.c:480

Definition at line 489 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppPRGBA

const struct bitmap_data testdata_32bppPRGBA
static
Initial value:
= {
&GUID_WICPixelFormat32bppPRGBA, 32, bits_32bppPBGRA, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppPBGRA[]
Definition: converter.c:480

Definition at line 491 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppRGB

const struct bitmap_data testdata_32bppRGB
static
Initial value:
= {
&GUID_WICPixelFormat32bppRGB, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppBGRA[]
Definition: converter.c:464

Definition at line 477 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppRGBA

const struct bitmap_data testdata_32bppRGBA
static
Initial value:
= {
&GUID_WICPixelFormat32bppRGBA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppBGRA[]
Definition: converter.c:464

Definition at line 475 of file converter.c.

Referenced by START_TEST().

◆ testdata_32bppRGBA80

const struct bitmap_data testdata_32bppRGBA80
static
Initial value:
= {
&GUID_WICPixelFormat32bppRGBA, 32, bits_32bppBGR, 32, 2, 96.0, 96.0}
static const BYTE bits_32bppBGR[]
Definition: converter.c:448

Definition at line 461 of file converter.c.

Referenced by START_TEST().

◆ testdata_4bppIndexed

const struct bitmap_data testdata_4bppIndexed
static
Initial value:
= {
&GUID_WICPixelFormat4bppIndexed, 4, bits_4bpp, 32, 2, 96.0, 96.0}
static const BYTE bits_4bpp[]
Definition: converter.c:399

Definition at line 403 of file converter.c.

Referenced by START_TEST().

◆ testdata_64bppRGBA

const struct bitmap_data testdata_64bppRGBA
static
Initial value:
= {
&GUID_WICPixelFormat64bppRGBA, 64, bits_64bppRGBA, 32, 2, 96.0, 96.0}
static const BYTE bits_64bppRGBA[]
Definition: converter.c:494

Definition at line 503 of file converter.c.

Referenced by START_TEST().

◆ testdata_8bppGray

const struct bitmap_data testdata_8bppGray
static
Initial value:
= {
&GUID_WICPixelFormat8bppGray, 8, bits_8bppGray, 32, 2, 96.0, 96.0, &testdata_8bppGray_xp}
static const BYTE bits_8bppGray[]
Definition: converter.c:539
static const struct bitmap_data testdata_8bppGray_xp
Definition: converter.c:536

Definition at line 544 of file converter.c.

Referenced by START_TEST().

◆ testdata_8bppGray_xp

const struct bitmap_data testdata_8bppGray_xp
static
Initial value:
= {
&GUID_WICPixelFormat8bppGray, 8, bits_8bppGray_xp, 32, 2, 96.0, 96.0}
static const BYTE bits_8bppGray_xp[]
Definition: converter.c:531

Definition at line 536 of file converter.c.

◆ testdata_8bppIndexed

const struct bitmap_data testdata_8bppIndexed
static
Initial value:
= {
&GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp, 32, 2, 96.0, 96.0}
static const BYTE bits_8bpp[]
Definition: converter.c:418

Definition at line 421 of file converter.c.

Referenced by START_TEST().

◆ testdata_8bppIndexed_4colors

const struct bitmap_data testdata_8bppIndexed_4colors
static
Initial value:
= {
&GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_4colors, 32, 2, 96.0, 96.0}
static const BYTE bits_8bpp_4colors[]
Definition: converter.c:412

Definition at line 415 of file converter.c.

Referenced by START_TEST().

◆ testdata_8bppIndexed_BW

const struct bitmap_data testdata_8bppIndexed_BW
static
Initial value:
= {
&GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_BW, 32, 2, 96.0, 96.0}
static const BYTE bits_8bpp_BW[]
Definition: converter.c:406

Definition at line 409 of file converter.c.

Referenced by START_TEST().

◆ testdata_BlackWhite

const struct bitmap_data testdata_BlackWhite
static
Initial value:
= {
&GUID_WICPixelFormatBlackWhite, 1, bits_1bpp, 32, 2, 96.0, 96.0}
static const BYTE bits_1bpp[]
Definition: converter.c:383

Definition at line 386 of file converter.c.

Referenced by START_TEST().

◆ testdata_bmp_props

const struct property_opt_test_data testdata_bmp_props[]
static
Initial value:
= {
{ wszEnableV5Header32bppBGRA, VT_BOOL, VT_BOOL, VARIANT_FALSE, 0.0f, TRUE },
{ NULL }
}
#define TRUE
Definition: types.h:120
static const WCHAR wszEnableV5Header32bppBGRA[]
Definition: converter.c:650
#define NULL
Definition: types.h:112

Definition at line 674 of file converter.c.

Referenced by test_encoder_properties().

◆ testdata_jpeg_props

const struct property_opt_test_data testdata_jpeg_props[]
static
Initial value:
= {
{ NULL }
}
Definition: compat.h:2157
#define TRUE
Definition: types.h:120
static const WCHAR wszBitmapTransform[]
Definition: converter.c:645
static const WCHAR wszLuminance[]
Definition: converter.c:646
#define FALSE
Definition: types.h:117
static const WCHAR wszSuppressApp0[]
Definition: converter.c:649
Definition: compat.h:2158
static const WCHAR wszImageQuality[]
Definition: converter.c:644
static const WCHAR wszChrominance[]
Definition: converter.c:647
#define NULL
Definition: types.h:112
static const WCHAR wszJpegYCrCbSubsampling[]
Definition: converter.c:648

Definition at line 664 of file converter.c.

Referenced by test_encoder_properties().

◆ testdata_png_props

const struct property_opt_test_data testdata_png_props[]
static
Initial value:
= {
{ NULL }
}
static const WCHAR wszFilterOption[]
Definition: converter.c:643
#define TRUE
Definition: types.h:120
static const WCHAR wszInterlaceOption[]
Definition: converter.c:642
#define NULL
Definition: types.h:112

Definition at line 658 of file converter.c.

Referenced by test_encoder_properties().

◆ testdata_tiff_props

const struct property_opt_test_data testdata_tiff_props[]
static
Initial value:
= {
{ NULL }
}
static const WCHAR wszCompressionQuality[]
Definition: converter.c:641
Definition: compat.h:2158
#define NULL
Definition: types.h:112
static const WCHAR wszTiffCompressionMethod[]
Definition: converter.c:640

Definition at line 652 of file converter.c.

Referenced by test_encoder_properties().

◆ wszBitmapTransform

const WCHAR wszBitmapTransform[] = {'B','i','t','m','a','p','T','r','a','n','s','f','o','r','m',0}
static

Definition at line 645 of file converter.c.

◆ wszChrominance

const WCHAR wszChrominance[] = {'C','h','r','o','m','i','n','a','n','c','e',0}
static

Definition at line 647 of file converter.c.

◆ wszCompressionQuality

const WCHAR wszCompressionQuality[] = {'C','o','m','p','r','e','s','s','i','o','n','Q','u','a','l','i','t','y',0}
static

Definition at line 641 of file converter.c.

◆ wszEnableV5Header32bppBGRA

const WCHAR wszEnableV5Header32bppBGRA[] = {'E','n','a','b','l','e','V','5','H','e','a','d','e','r','3','2','b','p','p','B','G','R','A',0}
static

Definition at line 650 of file converter.c.

◆ wszFilterOption

const WCHAR wszFilterOption[] = {'F','i','l','t','e','r','O','p','t','i','o','n',0}
static

Definition at line 643 of file converter.c.

◆ wszImageQuality

const WCHAR wszImageQuality[] = {'I','m','a','g','e','Q','u','a','l','i','t','y',0}
static

Definition at line 644 of file converter.c.

◆ wszInterlaceOption

const WCHAR wszInterlaceOption[] = {'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0}
static

Definition at line 642 of file converter.c.

◆ wszJpegYCrCbSubsampling

const WCHAR wszJpegYCrCbSubsampling[] = {'J','p','e','g','Y','C','r','C','b','S','u','b','s','a','m','p','l','i','n','g',0}
static

Definition at line 648 of file converter.c.

◆ wszLuminance

const WCHAR wszLuminance[] = {'L','u','m','i','n','a','n','c','e',0}
static

Definition at line 646 of file converter.c.

◆ wszSuppressApp0

const WCHAR wszSuppressApp0[] = {'S','u','p','p','r','e','s','s','A','p','p','0',0}
static

Definition at line 649 of file converter.c.

◆ wszTiffCompressionMethod

const WCHAR wszTiffCompressionMethod[] = {'T','i','f','f','C','o','m','p','r','e','s','s','i','o','n','M','e','t','h','o','d',0}
static

Definition at line 640 of file converter.c.