ReactOS 0.4.15-dev-7942-gd23573b
gifformat.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "wincodec.h"
#include "wine/test.h"
Include dependency graph for gifformat.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

HRESULT WINAPI WICCreateImagingFactory_Proxy (UINT, IWICImagingFactory **)
 
static IStreamcreate_stream (const void *image_data, UINT image_size)
 
static IWICBitmapDecodercreate_decoder (const void *image_data, UINT image_size)
 
static void test_global_gif_palette (void)
 
static void test_global_gif_palette_2frames (void)
 
static void test_local_gif_palette (void)
 
static void test_gif_frame_sizes (void)
 
static void test_truncated_gif (void)
 
static void test_gif_notrailer (void)
 
 START_TEST (gifformat)
 

Variables

static const char gif_global_palette []
 
static const char gif_global_palette_2frames []
 
static const char gif_local_palette []
 
static const char gif_frame_sizes []
 
static IWICImagingFactoryfactory
 
static const char gif_with_trailer_1 []
 
static const char gif_with_trailer_2 []
 
static const char gif_without_trailer_1 []
 
static const char gif_without_trailer_2 []
 
static unsigned char gifimage_notrailer []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file gifformat.c.

Function Documentation

◆ create_decoder()

static IWICBitmapDecoder * create_decoder ( const void image_data,
UINT  image_size 
)
static

Definition at line 101 of file gifformat.c.

102{
103 HRESULT hr;
104 IWICBitmapDecoder *decoder;
106 GUID format;
107 LONG refcount;
108
109 stream = create_stream(image_data, image_size);
110 if (!stream) return NULL;
111
112 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
113 ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
114
115 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
116 ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
117 ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
118 "wrong container format %s\n", wine_dbgstr_guid(&format));
119
120 refcount = IStream_Release(stream);
121 ok(refcount > 0, "expected stream refcount > 0\n");
122
123 return decoder;
124}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
static IStream * create_stream(const void *data, int data_size)
Definition: gifformat.c:533
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define S_OK
Definition: intsafe.h:52
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
HRESULT hr
Definition: shlfolder.c:183
Definition: main.c:439
Definition: parse.h:23

Referenced by test_gif_frame_sizes(), test_global_gif_palette(), test_global_gif_palette_2frames(), and test_local_gif_palette().

◆ create_stream()

static IStream * create_stream ( const void image_data,
UINT  image_size 
)
static

Definition at line 83 of file gifformat.c.

84{
85 HGLOBAL hmem;
86 BYTE *data;
87 HRESULT hr;
89
90 hmem = GlobalAlloc(0, image_size);
91 data = GlobalLock(hmem);
92 memcpy(data, image_data, image_size);
93 GlobalUnlock(hmem);
94
96 ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
97
98 return stream;
99}
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: xxhash.c:193

◆ START_TEST()

START_TEST ( gifformat  )

Definition at line 567 of file gifformat.c.

568{
569 HRESULT hr;
570
572 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
573 &IID_IWICImagingFactory, (void **)&factory);
574 ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
575 if (FAILED(hr)) return;
576
582
583 IWICImagingFactory_Release(factory);
585
586 /* run the same tests with no COM initialization */
587 hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
588 ok(hr == S_OK, "WICCreateImagingFactory_Proxy error %#x\n", hr);
589
595
596 IWICImagingFactory_Release(factory);
597}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define FAILED(hr)
Definition: intsafe.h:51
static void test_gif_frame_sizes(void)
Definition: gifformat.c:367
static void test_global_gif_palette_2frames(void)
Definition: gifformat.c:187
static void test_gif_notrailer(void)
Definition: gifformat.c:500
static void test_global_gif_palette(void)
Definition: gifformat.c:126
HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT, IWICImagingFactory **)
Definition: proxy.c:651
static void test_local_gif_palette(void)
Definition: gifformat.c:292
static void test_truncated_gif(void)
Definition: gifformat.c:440
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278

◆ test_gif_frame_sizes()

static void test_gif_frame_sizes ( void  )
static

Definition at line 367 of file gifformat.c.

368{
369 static const BYTE frame0[] = {0, 1, 0xfe, 0xfe, 2, 3, 0xfe, 0xfe};
370 static const BYTE frame1[] = {0, 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
371
372 IWICBitmapDecoder *decoder;
375 BYTE buf[8];
376 HRESULT hr;
377
379 ok(decoder != 0, "Failed to load GIF image data\n");
380
381 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
382 ok(hr == S_OK, "GetFrame error %#x\n", hr);
383
384 hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
385 ok(hr == S_OK, "GetSize error %x\n", hr);
386 ok(width == 2, "width = %d\n", width);
387 ok(height == 2, "height = %d\n", height);
388
389 memset(buf, 0xfe, sizeof(buf));
390 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf);
391 ok(hr == S_OK, "CopyPixels error %x\n", hr);
392 ok(!memcmp(buf, frame0, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n",
393 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
394
395 IWICBitmapFrameDecode_Release(frame);
396
397 hr = IWICBitmapDecoder_GetFrame(decoder, 1, &frame);
398 ok(hr == S_OK, "GetFrame error %#x\n", hr);
399
400 hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
401 ok(hr == S_OK, "GetSize error %x\n", hr);
402 ok(width == 2, "width = %d\n", width);
403 ok(height == 1, "height = %d\n", height);
404
405 memset(buf, 0xfe, sizeof(buf));
406 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf);
407 ok(hr == S_OK, "CopyPixels error %x\n", hr);
408 ok(!memcmp(buf, frame1, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n",
409 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
410
411 IWICBitmapFrameDecode_Release(frame);
412
413 IWICBitmapDecoder_Release(decoder);
414}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static IWICBitmapDecoder * create_decoder(const void *image_data, UINT image_size)
Definition: gifformat.c:101
static const char gif_frame_sizes[]
Definition: gifformat.c:65
unsigned int UINT
Definition: ndis.h:50
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_gif_notrailer()

static void test_gif_notrailer ( void  )
static

Definition at line 500 of file gifformat.c.

501{
502 IWICBitmapDecoder *decoder;
504 HRESULT hr;
505 IWICStream *gifstream;
506 IWICBitmapFrameDecode *framedecode;
507 double dpiX = 0.0, dpiY = 0.0;
508 UINT framecount;
509
510 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
511 &IID_IWICImagingFactory, (void**)&factory);
512 ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
513 if (FAILED(hr)) return;
514
515 hr = IWICImagingFactory_CreateStream(factory, &gifstream);
516 ok(hr == S_OK, "CreateStream failed, hr=%x\n", hr);
517 if (SUCCEEDED(hr))
518 {
519 hr = IWICStream_InitializeFromMemory(gifstream, gifimage_notrailer,
520 sizeof(gifimage_notrailer));
521 ok(hr == S_OK, "InitializeFromMemory failed, hr=%x\n", hr);
522
523 if (SUCCEEDED(hr))
524 {
525 hr = CoCreateInstance(&CLSID_WICGifDecoder, NULL, CLSCTX_INPROC_SERVER,
526 &IID_IWICBitmapDecoder, (void**)&decoder);
527 ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
528 }
529
530 if (SUCCEEDED(hr))
531 {
532 hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)gifstream,
534 ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
535
536 if (SUCCEEDED(hr))
537 {
538 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
539 ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr);
540 if (SUCCEEDED(hr))
541 {
542 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
543 ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
544 ok(dpiX == 48.0, "expected dpiX=48.0, got %f\n", dpiX);
545 ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
546
547 IWICBitmapFrameDecode_Release(framedecode);
548 }
549 }
550
551 if (SUCCEEDED(hr))
552 {
553 hr = IWICBitmapDecoder_GetFrameCount(decoder, &framecount);
554 ok(hr == S_OK, "GetFrameCount failed, hr=%x\n", hr);
555 ok(framecount == 1, "framecount=%u\n", framecount);
556 }
557
558 IWICBitmapDecoder_Release(decoder);
559 }
560
561 IWICStream_Release(gifstream);
562 }
563
564 IWICImagingFactory_Release(factory);
565}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static IWICImagingFactory * factory
Definition: gifformat.c:81
static unsigned char gifimage_notrailer[]
Definition: gifformat.c:494
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:28

Referenced by START_TEST().

◆ test_global_gif_palette()

static void test_global_gif_palette ( void  )
static

Definition at line 126 of file gifformat.c.

127{
128 HRESULT hr;
129 IWICBitmapDecoder *decoder;
132 GUID format;
133 UINT count, ret;
134 WICColor color[256];
135
137 ok(decoder != 0, "Failed to load GIF image data\n");
138
139 hr = IWICImagingFactory_CreatePalette(factory, &palette);
140 ok(hr == S_OK, "CreatePalette error %#x\n", hr);
141
142 /* global palette */
143 hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
144 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
145
146 hr = IWICPalette_GetColorCount(palette, &count);
147 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
148 ok(count == 4, "expected 4, got %u\n", count);
149
150 hr = IWICPalette_GetColors(palette, count, color, &ret);
151 ok(hr == S_OK, "GetColors error %#x\n", hr);
152 ok(ret == count, "expected %u, got %u\n", count, ret);
153 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
154 ok(color[1] == 0x00040506, "expected 0x00040506, got %#x\n", color[1]);
155 ok(color[2] == 0xff070809, "expected 0xff070809, got %#x\n", color[2]);
156 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
157
158 /* frame palette */
159 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
160 ok(hr == S_OK, "GetFrame error %#x\n", hr);
161
162 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
163 ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
164 ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
165 "wrong pixel format %s\n", wine_dbgstr_guid(&format));
166
167 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
168 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
169
170 hr = IWICPalette_GetColorCount(palette, &count);
171 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
172 ok(count == 4, "expected 4, got %u\n", count);
173
174 hr = IWICPalette_GetColors(palette, count, color, &ret);
175 ok(hr == S_OK, "GetColors error %#x\n", hr);
176 ok(ret == count, "expected %u, got %u\n", count, ret);
177 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
178 ok(color[1] == 0x00040506, "expected 0x00040506, got %#x\n", color[1]);
179 ok(color[2] == 0xff070809, "expected 0xff070809, got %#x\n", color[2]);
180 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
181
182 IWICPalette_Release(palette);
183 IWICBitmapFrameDecode_Release(frame);
184 IWICBitmapDecoder_Release(decoder);
185}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint color
Definition: glext.h:6243
static HPALETTE palette
Definition: clipboard.c:1345
static const char gif_global_palette[]
Definition: gifformat.c:30
int ret
UINT32 WICColor
Definition: wincodec.idl:312

Referenced by START_TEST().

◆ test_global_gif_palette_2frames()

static void test_global_gif_palette_2frames ( void  )
static

Definition at line 187 of file gifformat.c.

188{
189 HRESULT hr;
190 IWICBitmapDecoder *decoder;
193 GUID format;
194 UINT count, ret;
195 WICColor color[256];
196
198 ok(decoder != 0, "Failed to load GIF image data\n");
199
200 /* active frame 0, GCE transparent index 1 */
201 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
202 ok(hr == S_OK, "GetFrame error %#x\n", hr);
203
204 hr = IWICImagingFactory_CreatePalette(factory, &palette);
205 ok(hr == S_OK, "CreatePalette error %#x\n", hr);
206
207 /* global palette */
208 hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
209 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
210
211 hr = IWICPalette_GetColorCount(palette, &count);
212 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
213 ok(count == 4, "expected 4, got %u\n", count);
214
215 hr = IWICPalette_GetColors(palette, count, color, &ret);
216 ok(hr == S_OK, "GetColors error %#x\n", hr);
217 ok(ret == count, "expected %u, got %u\n", count, ret);
218 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
219 ok(color[1] == 0x00040506, "expected 0x00040506, got %#x\n", color[1]);
220 ok(color[2] == 0xff070809, "expected 0xff070809, got %#x\n", color[2]);
221 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
222
223 /* frame 0 palette */
224 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
225 ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
226 ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
227 "wrong pixel format %s\n", wine_dbgstr_guid(&format));
228
229 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
230 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
231
232 hr = IWICPalette_GetColorCount(palette, &count);
233 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
234 ok(count == 4, "expected 4, got %u\n", count);
235
236 hr = IWICPalette_GetColors(palette, count, color, &ret);
237 ok(hr == S_OK, "GetColors error %#x\n", hr);
238 ok(ret == count, "expected %u, got %u\n", count, ret);
239 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
240 ok(color[1] == 0x00040506, "expected 0x00040506, got %#x\n", color[1]);
241 ok(color[2] == 0xff070809, "expected 0xff070809, got %#x\n", color[2]);
242 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
243
244 IWICBitmapFrameDecode_Release(frame);
245
246 /* active frame 1, GCE transparent index 2 */
247 hr = IWICBitmapDecoder_GetFrame(decoder, 1, &frame);
248 ok(hr == S_OK, "GetFrame error %#x\n", hr);
249
250 /* global palette */
251 hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
252 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
253
254 hr = IWICPalette_GetColorCount(palette, &count);
255 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
256 ok(count == 4, "expected 4, got %u\n", count);
257
258 hr = IWICPalette_GetColors(palette, count, color, &ret);
259 ok(hr == S_OK, "GetColors error %#x\n", hr);
260 ok(ret == count, "expected %u, got %u\n", count, ret);
261 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
262 ok(color[1] == 0xff040506 || broken(color[1] == 0x00040506) /* XP */, "expected 0xff040506, got %#x\n", color[1]);
263 ok(color[2] == 0x00070809 || broken(color[2] == 0xff070809) /* XP */, "expected 0x00070809, got %#x\n", color[2]);
264 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
265
266 /* frame 1 palette */
267 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
268 ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
269 ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
270 "wrong pixel format %s\n", wine_dbgstr_guid(&format));
271
272 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
273 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
274
275 hr = IWICPalette_GetColorCount(palette, &count);
276 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
277 ok(count == 4, "expected 4, got %u\n", count);
278
279 hr = IWICPalette_GetColors(palette, count, color, &ret);
280 ok(hr == S_OK, "GetColors error %#x\n", hr);
281 ok(ret == count, "expected %u, got %u\n", count, ret);
282 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
283 ok(color[1] == 0xff040506, "expected 0xff040506, got %#x\n", color[1]);
284 ok(color[2] == 0x00070809, "expected 0x00070809, got %#x\n", color[2]);
285 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
286
287 IWICPalette_Release(palette);
288 IWICBitmapFrameDecode_Release(frame);
289 IWICBitmapDecoder_Release(decoder);
290}
#define broken(x)
Definition: _sntprintf.h:21
static const char gif_global_palette_2frames[]
Definition: gifformat.c:41

Referenced by START_TEST().

◆ test_local_gif_palette()

static void test_local_gif_palette ( void  )
static

Definition at line 292 of file gifformat.c.

293{
294 HRESULT hr;
295 IWICBitmapDecoder *decoder;
299 GUID format;
300 UINT count, ret, i;
301 WICColor color[256];
302
304 ok(decoder != 0, "Failed to load GIF image data\n");
305
306 hr = IWICImagingFactory_CreatePalette(factory, &palette);
307 ok(hr == S_OK, "CreatePalette error %#x\n", hr);
308
309 /* global palette */
310 hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
311 ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING), "CopyPalette %#x\n", hr);
312 if (hr == S_OK)
313 {
314 type = -1;
315 hr = IWICPalette_GetType(palette, &type);
316 ok(hr == S_OK, "GetType error %#x\n", hr);
317 ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %#x\n", type);
318
319 hr = IWICPalette_GetColorCount(palette, &count);
320 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
321 ok(count == 256, "expected 256, got %u\n", count);
322
323 hr = IWICPalette_GetColors(palette, count, color, &ret);
324 ok(hr == S_OK, "GetColors error %#x\n", hr);
325 ok(ret == count, "expected %u, got %u\n", count, ret);
326 ok(color[0] == 0xff000000, "expected 0xff000000, got %#x\n", color[0]);
327 ok(color[1] == 0x00ffffff, "expected 0x00ffffff, got %#x\n", color[1]);
328
329 for (i = 2; i < 256; i++)
330 ok(color[i] == 0xff000000, "expected 0xff000000, got %#x\n", color[i]);
331 }
332
333 /* frame palette */
334 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
335 ok(hr == S_OK, "GetFrame error %#x\n", hr);
336
337 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
338 ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
339 ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
340 "wrong pixel format %s\n", wine_dbgstr_guid(&format));
341
342 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
343 ok(hr == S_OK, "CopyPalette error %#x\n", hr);
344
345 hr = IWICPalette_GetColorCount(palette, &count);
346 ok(hr == S_OK, "GetColorCount error %#x\n", hr);
347 ok(count == 4, "expected 4, got %u\n", count);
348
349 type = -1;
350 hr = IWICPalette_GetType(palette, &type);
351 ok(hr == S_OK, "GetType error %#x\n", hr);
352 ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %#x\n", type);
353
354 hr = IWICPalette_GetColors(palette, count, color, &ret);
355 ok(hr == S_OK, "GetColors error %#x\n", hr);
356 ok(ret == count, "expected %u, got %u\n", count, ret);
357 ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
358 ok(color[1] == 0x00040506, "expected 0x00040506, got %#x\n", color[1]);
359 ok(color[2] == 0xff070809, "expected 0xff070809, got %#x\n", color[2]);
360 ok(color[3] == 0xff0a0b0c, "expected 0xff0a0b0c, got %#x\n", color[3]);
361
362 IWICPalette_Release(palette);
363 IWICBitmapFrameDecode_Release(frame);
364 IWICBitmapDecoder_Release(decoder);
365}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
static const char gif_local_palette[]
Definition: gifformat.c:52
WICBitmapPaletteType
Definition: wincodec.idl:90
@ WICBitmapPaletteTypeCustom
Definition: wincodec.idl:91
#define WINCODEC_ERR_FRAMEMISSING
Definition: winerror.h:3301

Referenced by START_TEST().

◆ test_truncated_gif()

static void test_truncated_gif ( void  )
static

Definition at line 440 of file gifformat.c.

441{
442 HRESULT hr;
444 IWICBitmapDecoder *decoder;
445 GUID format;
446
448 if (!stream) return;
449
450 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
451 ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
452 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
453 ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
454 ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
455 "wrong container format %s\n", wine_dbgstr_guid(&format));
456 IWICBitmapDecoder_Release(decoder);
457 IStream_Release(stream);
458
460 if (!stream) return;
461 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
462 ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
463 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
464 ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
465 ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
466 "wrong container format %s\n", wine_dbgstr_guid(&format));
467 IWICBitmapDecoder_Release(decoder);
468 IStream_Release(stream);
469
471 if (!stream) return;
472 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
473 ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
474 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
475 ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
476 ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
477 "wrong container format %s\n", wine_dbgstr_guid(&format));
478 IWICBitmapDecoder_Release(decoder);
479 IStream_Release(stream);
480
482 if (!stream) return;
483 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
484 ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
485 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
486 ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
487 ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
488 "wrong container format %s\n", wine_dbgstr_guid(&format));
489 IWICBitmapDecoder_Release(decoder);
490 IStream_Release(stream);
491}
static const char gif_without_trailer_2[]
Definition: gifformat.c:434
static const char gif_with_trailer_2[]
Definition: gifformat.c:422
static const char gif_with_trailer_1[]
Definition: gifformat.c:416
static const char gif_without_trailer_1[]
Definition: gifformat.c:427

Referenced by START_TEST().

◆ WICCreateImagingFactory_Proxy()

HRESULT WINAPI WICCreateImagingFactory_Proxy ( UINT  SDKVersion,
IWICImagingFactory **  ppIImagingFactory 
)

Definition at line 651 of file proxy.c.

652{
653 TRACE("%x, %p\n", SDKVersion, ppIImagingFactory);
654
655 return ImagingFactory_CreateInstance(&IID_IWICImagingFactory, (void**)ppIImagingFactory);
656}
HRESULT ImagingFactory_CreateInstance(REFIID iid, void **ppv)
Definition: imgfactory.c:1470
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by START_TEST().

Variable Documentation

◆ factory

Definition at line 81 of file gifformat.c.

Referenced by test_gif_notrailer().

◆ gif_frame_sizes

const char gif_frame_sizes[]
static
Initial value:
= {
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x02, 0x00,
0x02, 0x00, 0xf1, 0x00, 0x00, 0xff, 0x00, 0x00,
0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00,
0x00, 0x21, 0xf9, 0x04, 0x00, 0x64, 0x00, 0x00,
0x00, 0x21, 0xff, 0x0b, 0x4e, 0x45, 0x54, 0x53,
0x43, 0x41, 0x50, 0x45, 0x32, 0x2e, 0x30, 0x03,
0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x03,
0x44, 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x04,
0x64, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x01, 0x00, 0x80, 0xff, 0xff,
0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x0a,
0x00, 0x3b
}

Definition at line 65 of file gifformat.c.

Referenced by test_gif_frame_sizes().

◆ gif_global_palette

const char gif_global_palette[]
static
Initial value:
= {
'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0xa1,0x02,0x00,
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,
0x21,0xf9,0x04,0x01,0x05,0x00,0x01,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0x01,0x00,0x3b
}

Definition at line 30 of file gifformat.c.

Referenced by test_global_gif_palette().

◆ gif_global_palette_2frames

const char gif_global_palette_2frames[]
static
Initial value:
= {
'G','I','F','8','9','a',0x01,0x00,0x01,0x00,0xa1,0x02,0x00,
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,
0x21,0xf9,0x04,0x01,0x05,0x00,0x01,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0x01,0x00,
0x21,0xf9,0x04,0x01,0x05,0x00,0x02,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0x01,0x00,0x3b
}

Definition at line 41 of file gifformat.c.

Referenced by test_global_gif_palette_2frames().

◆ gif_local_palette

const char gif_local_palette[]
static
Initial value:
= {
'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x27,0x02,0x00,
0x21,0xf9,0x04,0x01,0x05,0x00,0x01,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x81,
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,
0x02,0x02,0x44,0x01,0x00,0x3b
}

Definition at line 52 of file gifformat.c.

Referenced by test_local_gif_palette().

◆ gif_with_trailer_1

const char gif_with_trailer_1[]
static
Initial value:
= {
'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x80,0x00,0x00,
0xff,0xff,0xff,0xff,0xff,0xff,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0x01,0x00,0x3b
}

Definition at line 416 of file gifformat.c.

Referenced by test_truncated_gif().

◆ gif_with_trailer_2

const char gif_with_trailer_2[]
static
Initial value:
= {
'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x00,0x00,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0x3b
}

Definition at line 422 of file gifformat.c.

Referenced by test_truncated_gif().

◆ gif_without_trailer_1

const char gif_without_trailer_1[]
static
Initial value:
= {
'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x80,0x00,0x00,
0xff,0xff,0xff,0xff,0xff,0xff,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef
}

Definition at line 427 of file gifformat.c.

Referenced by test_truncated_gif().

◆ gif_without_trailer_2

const char gif_without_trailer_2[]
static
Initial value:
= {
'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x00,0x00,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x02,0x02,0x44,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef
}

Definition at line 434 of file gifformat.c.

Referenced by test_truncated_gif().

◆ gifimage_notrailer

unsigned char gifimage_notrailer[]
static
Initial value:
= {
0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x71,0xff,0xff,0xff,
0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
0x01,0x00
}

Definition at line 494 of file gifformat.c.

Referenced by test_gif_notrailer().