ReactOS 0.4.16-dev-981-g80eb313
converter.c
Go to the documentation of this file.
1/*
2 * Copyright 2009 Vincent Povirk
3 * Copyright 2016 Dmitry Timoshkov
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21#include <stdio.h>
22#include <math.h>
23
24#define COBJMACROS
25#define CONST_VTABLE
26
27#include "windef.h"
28#include "objbase.h"
29#include "wincodec.h"
30#include "wincodecsdk.h"
31#include "wine/test.h"
32
34
35typedef struct bitmap_data {
38 const BYTE *bits;
41 double xres;
42 double yres;
43 const struct bitmap_data *alt_data;
45
46typedef struct BitmapTestSrc {
51
53 IWICBitmapSource *pIBitmapSource, WICRect *prc);
54
55static BOOL near_equal(float a, float b)
56{
57 return fabsf(a - b) < 0.001;
58}
59
61{
62 return CONTAINING_RECORD(iface, BitmapTestSrc, IWICBitmapSource_iface);
63}
64
66 void **ppv)
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}
79
81{
84 return ref;
85}
86
88{
91 return ref;
92}
93
95 UINT *puiWidth, UINT *puiHeight)
96{
98 *puiWidth = This->data->width;
99 *puiHeight = This->data->height;
100 return S_OK;
101}
102
104 WICPixelFormatGUID *pPixelFormat)
105{
107 memcpy(pPixelFormat, This->data->format, sizeof(GUID));
108 return S_OK;
109}
110
112 double *pDpiX, double *pDpiY)
113{
115 *pDpiX = This->data->xres;
116 *pDpiY = This->data->yres;
117 return S_OK;
118}
119
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}
146
148 const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
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}
203
204static const IWICBitmapSourceVtbl BitmapTestSrc_Vtbl = {
213};
214
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}
226
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 %li references instead of 1\n", This, This->ref);
232}
233
234static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, const BYTE *converted_bits)
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}
314
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}
325
326static void compare_bitmap_data(const struct bitmap_data *src, const struct bitmap_data *expect,
327 IWICBitmapSource *source, const char *name)
328{
329 BYTE *converted_bits;
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=%lx\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=%lx\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=%lx\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=%lx\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=%lx\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}
381
382/* some encoders (like BMP) require data to be 4-bytes aligned */
383static const BYTE bits_1bpp[] = {
384 0x55,0x55,0x55,0x55, /*01010101*/
385 0xaa,0xaa,0xaa,0xaa}; /*10101010*/
386static const struct bitmap_data testdata_BlackWhite = {
387 &GUID_WICPixelFormatBlackWhite, 1, bits_1bpp, 32, 2, 96.0, 96.0};
388static const struct bitmap_data testdata_1bppIndexed = {
389 &GUID_WICPixelFormat1bppIndexed, 1, bits_1bpp, 32, 2, 96.0, 96.0};
390
391/* some encoders (like BMP) require data to be 4-bytes aligned */
392static const BYTE bits_2bpp[] = {
393 0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,
394 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24};
395static const struct bitmap_data testdata_2bppIndexed = {
396 &GUID_WICPixelFormat2bppIndexed, 2, bits_2bpp, 32, 2, 96.0, 96.0};
397
398/* some encoders (like BMP) require data to be 4-bytes aligned */
399static const BYTE bits_4bpp[] = {
400 0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,
401 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44};
402
403static const struct bitmap_data testdata_4bppIndexed = {
404 &GUID_WICPixelFormat4bppIndexed, 4, bits_4bpp, 32, 2, 96.0, 96.0};
405
406static const BYTE bits_8bpp_BW[] = {
407 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,
408 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};
410 &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_BW, 32, 2, 96.0, 96.0};
411
412static const BYTE bits_8bpp_4colors[] = {
413 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,
414 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};
416 &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_4colors, 32, 2, 96.0, 96.0};
417
418static const BYTE bits_8bpp[] = {
419 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,
420 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};
421static const struct bitmap_data testdata_8bppIndexed = {
422 &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp, 32, 2, 96.0, 96.0};
423
424static const BYTE bits_24bppBGR[] = {
425 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
426 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
427 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
428 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
429 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
430 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
431 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
432 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255};
433static const struct bitmap_data testdata_24bppBGR = {
434 &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR, 32, 2, 96.0, 96.0};
435
436static const BYTE bits_24bppRGB[] = {
437 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
438 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
439 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
440 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
441 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
442 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
443 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
444 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255 };
445static const struct bitmap_data testdata_24bppRGB = {
446 &GUID_WICPixelFormat24bppRGB, 24, bits_24bppRGB, 32, 2, 96.0, 96.0};
447
448static const BYTE bits_32bppBGR[] = {
449 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,
450 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,
451 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,
452 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,
453 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,
454 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,
455 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,
456 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,
457 3,3,3,80, 6,6,6,80, 12,12,12,80, 15,15,15,80, 19,19,19,80, 22,22,22,80, 28,28,28,80, 31,31,31,80,
458 35,35,35,80, 38,38,38,80, 41,41,41,80, 47,47,47,80, 47,47,47,80, 54,54,54,80, 57,57,57,80, 63,63,63,80,
459 66,66,66,80, 70,70,70,80, 73,73,73,80, 79,79,79,80, 82,82,82,80, 86,86,86,80, 89,89,89,80, 95,95,95,80,
460 98,98,98,80, 98,98,98,80, 105,105,105,80, 108,108,108,80, 114,114,114,80, 117,117,117,80, 121,121,121,80, 124,124,124,80,
461 130,130,130,80, 133,133,133,80, 137,137,137,80, 140,140,140,80, 146,146,146,80, 149,149,149,80, 156,156,156,80, 156,156,156,80,
462 159,159,159,80, 165,165,165,80, 168,168,168,80, 172,172,172,80, 175,175,175,80, 181,181,181,80, 184,184,184,80, 188,188,188,80,
463 191,191,191,80, 197,197,197,80, 200,200,200,80, 207,207,207,80, 207,207,207,80, 213,213,213,80, 216,216,216,80, 219,219,219,80,
464 223,223,223,80, 226,226,226,80, 232,232,232,80, 235,235,235,80, 239,239,239,80, 242,242,242,80, 248,248,248,80, 251,251,251,80};
465static const struct bitmap_data testdata_32bppBGR = {
466 &GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 32, 2, 96.0, 96.0};
467static const struct bitmap_data testdata_32bppBGRA80 = {
468 &GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGR, 32, 4, 96.0, 96.0};
469static const struct bitmap_data testdata_32bppRGBA80 = {
470 &GUID_WICPixelFormat32bppRGBA, 32, bits_32bppBGR, 32, 4, 96.0, 96.0};
471
472static const BYTE bits_32bppBGRA[] = {
473 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,
474 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,
475 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,
476 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,
477 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,
478 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,
479 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,
480 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,
481 3,3,3,255, 6,6,6,255, 12,12,12,255, 15,15,15,255, 19,19,19,255, 22,22,22,255, 28,28,28,255, 31,31,31,80,
482 35,35,35,255, 38,38,38,255, 41,41,41,255, 47,47,47,255, 47,47,47,255, 54,54,54,255, 57,57,57,255, 63,63,63,80,
483 66,66,66,255, 70,70,70,255, 73,73,73,255, 79,79,79,255, 82,82,82,255, 86,86,86,255, 89,89,89,255, 95,95,95,80,
484 98,98,98,255, 98,98,98,255, 105,105,105,255, 108,108,108,255, 114,114,114,255, 117,117,117,255, 121,121,121,255, 124,124,124,80,
485 130,130,130,255, 133,133,133,255, 137,137,137,255, 140,140,140,255, 146,146,146,255, 149,149,149,255, 156,156,156,255, 156,156,156,80,
486 159,159,159,255, 165,165,165,255, 168,168,168,255, 172,172,172,255, 175,175,175,255, 181,181,181,255, 184,184,184,255, 188,188,188,80,
487 191,191,191,255, 197,197,197,255, 200,200,200,255, 207,207,207,255, 207,207,207,255, 213,213,213,255, 216,216,216,255, 219,219,219,80,
488 223,223,223,255, 226,226,226,255, 232,232,232,255, 235,235,235,255, 239,239,239,255, 242,242,242,255, 248,248,248,255, 251,251,251,80};
489static const BYTE bits_32bppRGBA[] = {
490 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255, 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255,
491 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255, 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255,
492 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255, 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255,
493 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255, 0,0,255,255, 0,255,0,255, 255,0,0,255, 0,0,0,255,
494 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255, 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255,
495 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255, 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255,
496 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255, 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255,
497 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255, 255,255,0,255, 255,0,255,255, 0,255,255,255, 255,255,255,255};
498
499static const struct bitmap_data testdata_32bppBGRA = {
500 &GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0};
501static const struct bitmap_data testdata_32bppRGBA = {
502 &GUID_WICPixelFormat32bppRGBA, 32, bits_32bppRGBA, 32, 2, 96.0, 96.0};
503static const struct bitmap_data testdata_32bppRGB = {
504 &GUID_WICPixelFormat32bppRGB, 32, bits_32bppRGBA, 32, 2, 96.0, 96.0};
505
506static const BYTE bits_32bppPBGRA[] = {
507 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,
508 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,
509 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,
510 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,
511 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,
512 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,
513 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,
514 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,
515 1,1,1,80, 2,2,2,80, 4,4,4,80, 5,5,5,80, 6,6,6,80, 7,7,7,80, 9,9,9,80, 10,10,10,80,
516 11,11,11,80, 12,12,12,80, 13,13,13,80, 15,15,15,80, 15,15,15,80, 17,17,17,80, 18,18,18,80, 20,20,20,80,
517 21,21,21,80, 22,22,22,80, 23,23,23,80, 25,25,25,80, 26,26,26,80, 27,27,27,80, 28,28,28,80, 30,30,30,80,
518 31,31,31,80, 31,31,31,80, 33,33,33,80, 34,34,34,80, 36,36,36,80, 37,37,37,80, 38,38,38,80, 39,39,39,80,
519 41,41,41,80, 42,42,42,80, 43,43,43,80, 44,44,44,80, 46,46,46,80, 47,47,47,80, 49,49,49,80, 49,49,49,80,
520 50,50,50,80, 52,52,52,80, 53,53,53,80, 54,54,54,80, 55,55,55,80, 57,57,57,80, 58,58,58,80, 59,59,59,80,
521 60,60,60,80, 62,62,62,80, 63,63,63,80, 65,65,65,80, 65,65,65,80, 67,67,67,80, 68,68,68,80, 69,69,69,80,
522 70,70,70,80, 71,71,71,80, 73,73,73,80, 74,74,74,80, 75,75,75,80, 76,76,76,80, 78,78,78,80, 79,79,79,80};
523static const struct bitmap_data testdata_32bppPBGRA = {
524 &GUID_WICPixelFormat32bppPBGRA, 32, bits_32bppPBGRA, 32, 4, 96.0, 96.0};
525static const struct bitmap_data testdata_32bppPRGBA = {
526 &GUID_WICPixelFormat32bppPRGBA, 32, bits_32bppPBGRA, 32, 4, 96.0, 96.0};
527
528static const BYTE bits_64bppRGBA[] = {
529 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255, 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255,
530 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255, 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255,
531 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255, 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255,
532 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255, 128,0,128,0,128,255,128,255, 128,0,128,255,128,0,128,255, 128,255,128,0,128,0,128,255, 128,0,128,0,128,0,128,255,
533 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255, 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255,
534 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255, 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255,
535 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255, 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255,
536 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255, 128,255,128,255,128,0,128,255, 128,255,128,0,128,255,128,255, 128,0,128,255,128,255,128,255, 128,255,128,255,128,255,128,255};
537static const struct bitmap_data testdata_64bppRGBA = {
538 &GUID_WICPixelFormat64bppRGBA, 64, bits_64bppRGBA, 32, 2, 96.0, 96.0};
539
540/* XP and 2003 use linear color conversion, later versions use sRGB gamma */
541static const float bits_32bppGrayFloat_xp[] = {
542 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
543 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
544 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
545 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
546 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
547 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
548 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
549 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f};
551 &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat_xp, 32, 2, 96.0, 96.0};
552
553static const float bits_32bppGrayFloat[] = {
554 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
555 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
556 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
557 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
558 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
559 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
560 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
561 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f};
563 &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat, 32, 2, 96.0, 96.0, &testdata_32bppGrayFloat_xp};
564
565static const BYTE bits_4bppGray_xp[] = {
566 77,112,77,112,77,112,77,112,77,112,77,112,77,112,77,112,249,
567 239,249,239,249,239,249,239,249,239,249,239,249,239,249,239};
568static const struct bitmap_data testdata_4bppGray_xp = {
569 &GUID_WICPixelFormat4bppGray, 4, bits_4bppGray_xp, 32, 2, 96.0, 96.0};
570
571static const BYTE bits_4bppGray[] = {
572 77,112,77,112,77,112,77,112,77,112,77,112,77,112,77,112,249,
573 239,249,239,249,239,249,239,249,239,249,239,249,239,249,239};
574static const struct bitmap_data testdata_4bppGray = {
575 &GUID_WICPixelFormat4bppGray, 4, bits_4bppGray, 32, 2, 96.0, 96.0, &testdata_4bppGray_xp};
576
577static const BYTE bits_8bppGray_xp[] = {
578 29,150,76,0,29,150,76,0,29,150,76,0,29,150,76,0,
579 29,150,76,0,29,150,76,0,29,150,76,0,29,150,76,0,
580 226,105,179,255,226,105,179,255,226,105,179,255,226,105,179,255,
581 226,105,179,255,226,105,179,255,226,105,179,255,226,105,179,255};
582static const struct bitmap_data testdata_8bppGray_xp = {
583 &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray_xp, 32, 2, 96.0, 96.0};
584
585static const BYTE bits_8bppGray[] = {
586 76,220,127,0,76,220,127,0,76,220,127,0,76,220,127,0,
587 76,220,127,0,76,220,127,0,76,220,127,0,76,220,127,0,
588 247,145,230,255,247,145,230,255,247,145,230,255,247,145,230,255,
589 247,145,230,255,247,145,230,255,247,145,230,255,247,145,230,255};
590static const struct bitmap_data testdata_8bppGray = {
591 &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray, 32, 2, 96.0, 96.0, &testdata_8bppGray_xp};
592
593static const BYTE bits_24bppBGR_gray[] = {
594 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
595 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
596 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
597 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
598 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
599 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
600 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
601 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255};
602static const struct bitmap_data testdata_24bppBGR_gray = {
603 &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR_gray, 32, 2, 96.0, 96.0};
604
605#define TO_16bppBGRA5551(b,g,r,a) ( \
606 ((a >> 7) << 15) | \
607 ((r >> 3) << 10) | \
608 ((g >> 3) << 5) | \
609 ((b >> 3)) \
610)
611
612static const WORD bits_16bppBGRA5551[] = {
613 TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255), TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255),
614 TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255), TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255),
615 TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255), TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255),
616 TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255), TO_16bppBGRA5551(255,0,0,255), TO_16bppBGRA5551(0,255,0,255), TO_16bppBGRA5551(0,0,255,255), TO_16bppBGRA5551(0,0,0,255),
617 TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255), TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255),
618 TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255), TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255),
619 TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255), TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255),
620 TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255), TO_16bppBGRA5551(0,255,255,255), TO_16bppBGRA5551(255,0,255,255), TO_16bppBGRA5551(255,255,0,255), TO_16bppBGRA5551(255,255,255,255)};
621
622static const struct bitmap_data testdata_16bppBGRA5551 = {
623 &GUID_WICPixelFormat16bppBGRA5551, 16, (BYTE*)bits_16bppBGRA5551, 32, 2, 96.0, 96.0};
624
625static const WORD bits_48bppRGB[] = {
626 0,0,0, 0,65535,0, 32767,32768,32767,
627 65535,65535,65535, 10,10,10, 0,0,10};
628
629static const struct bitmap_data testdata_48bppRGB = {
630 &GUID_WICPixelFormat48bppRGB, 48, (BYTE*)bits_48bppRGB, 3, 2, 96.0, 96.0};
631
632static const WORD bits_64bppRGBA_2[] = {
633 0,0,0,65535, 0,65535,0,65535, 32767,32768,32767,65535,
634 65535,65535,65535,65535, 10,10,10,65535, 0,0,10,65535,};
635
636static const struct bitmap_data testdata_64bppRGBA_2 = {
637 &GUID_WICPixelFormat64bppRGBA, 64, (BYTE*)bits_64bppRGBA_2, 3, 2, 96.0, 96.0};
638
639static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
640{
641 BitmapTestSrc *src_obj;
642 IWICBitmapSource *dst_bitmap;
643 HRESULT hr;
644
645 CreateTestBitmap(src, &src_obj);
646
647 hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
649 ok(hr == S_OK ||
650 broken(hr == E_INVALIDARG || hr == WINCODEC_ERR_COMPONENTNOTFOUND) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%lx\n", name, hr);
651
652 if (hr == S_OK)
653 {
654 compare_bitmap_data(src, dst, dst_bitmap, name);
655
656 IWICBitmapSource_Release(dst_bitmap);
657 }
658
659 DeleteTestBitmap(src_obj);
660}
661
662static void test_invalid_conversion(void)
663{
664 BitmapTestSrc *src_obj;
665 IWICBitmapSource *dst_bitmap;
666 HRESULT hr;
667
669
670 /* convert to a non-pixel-format GUID */
671 hr = WICConvertBitmapSource(&GUID_VendorMicrosoft, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
672 ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "WICConvertBitmapSource returned %lx\n", hr);
673
674 DeleteTestBitmap(src_obj);
675}
676
677static void test_default_converter(void)
678{
679 BitmapTestSrc *src_obj;
680 IWICFormatConverter *converter;
681 BOOL can_convert = TRUE;
682 HRESULT hr;
683
685
686 hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
687 &IID_IWICFormatConverter, (void**)&converter);
688 ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
689 if (SUCCEEDED(hr))
690 {
691 hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
692 &GUID_WICPixelFormat32bppBGR, &can_convert);
693 ok(SUCCEEDED(hr), "CanConvert returned %lx\n", hr);
694 ok(can_convert, "expected TRUE, got %i\n", can_convert);
695
696 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
697 &GUID_WICPixelFormat32bppBGR, WICBitmapDitherTypeNone, NULL, 0.0,
699 ok(SUCCEEDED(hr), "Initialize returned %lx\n", hr);
700
701 if (SUCCEEDED(hr))
702 compare_bitmap_data(&testdata_32bppBGRA, &testdata_32bppBGR, (IWICBitmapSource*)converter, "default converter");
703
704 IWICFormatConverter_Release(converter);
705 }
706
707 DeleteTestBitmap(src_obj);
708}
709
710static void test_converter_4bppGray(void)
711{
712 BitmapTestSrc *src_obj;
713 IWICFormatConverter *converter;
714 BOOL can_convert = TRUE;
715 HRESULT hr;
716
718
719 hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
720 &IID_IWICFormatConverter, (void**)&converter);
721 ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
722 if (SUCCEEDED(hr))
723 {
724 hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
725 &GUID_WICPixelFormat4bppGray, &can_convert);
726 ok(SUCCEEDED(hr), "CanConvert returned %lx\n", hr);
727 todo_wine ok(can_convert, "expected TRUE, got %i\n", can_convert);
728
729 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
730 &GUID_WICPixelFormat4bppGray, WICBitmapDitherTypeNone, NULL, 0.0,
732 todo_wine ok(SUCCEEDED(hr), "Initialize returned %lx\n", hr);
733
734 if (SUCCEEDED(hr))
735 compare_bitmap_data(&testdata_32bppBGRA, &testdata_4bppGray, (IWICBitmapSource*)converter, "4bppGray converter");
736
737 IWICFormatConverter_Release(converter);
738 }
739
740 DeleteTestBitmap(src_obj);
741}
742
743static void test_converter_8bppGray(void)
744{
745 BitmapTestSrc *src_obj;
746 IWICFormatConverter *converter;
747 BOOL can_convert = TRUE;
748 HRESULT hr;
749
751
752 hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
753 &IID_IWICFormatConverter, (void**)&converter);
754 ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
755 if (SUCCEEDED(hr))
756 {
757 hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
758 &GUID_WICPixelFormat8bppGray, &can_convert);
759 ok(SUCCEEDED(hr), "CanConvert returned %lx\n", hr);
760 ok(can_convert, "expected TRUE, got %i\n", can_convert);
761
762 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
763 &GUID_WICPixelFormat8bppGray, WICBitmapDitherTypeNone, NULL, 0.0,
765 ok(SUCCEEDED(hr), "Initialize returned %lx\n", hr);
766
767 if (SUCCEEDED(hr))
768 compare_bitmap_data(&testdata_32bppBGRA, &testdata_8bppGray, (IWICBitmapSource*)converter, "8bppGray converter");
769
770 IWICFormatConverter_Release(converter);
771 }
772
773 DeleteTestBitmap(src_obj);
774}
775
777{
778 LPCOLESTR name;
785
786static 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};
787static const WCHAR wszCompressionQuality[] = {'C','o','m','p','r','e','s','s','i','o','n','Q','u','a','l','i','t','y',0};
788static const WCHAR wszInterlaceOption[] = {'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0};
789static const WCHAR wszFilterOption[] = {'F','i','l','t','e','r','O','p','t','i','o','n',0};
790static const WCHAR wszImageQuality[] = {'I','m','a','g','e','Q','u','a','l','i','t','y',0};
791static const WCHAR wszBitmapTransform[] = {'B','i','t','m','a','p','T','r','a','n','s','f','o','r','m',0};
792static const WCHAR wszLuminance[] = {'L','u','m','i','n','a','n','c','e',0};
793static const WCHAR wszChrominance[] = {'C','h','r','o','m','i','n','a','n','c','e',0};
794static const WCHAR wszJpegYCrCbSubsampling[] = {'J','p','e','g','Y','C','r','C','b','S','u','b','s','a','m','p','l','i','n','g',0};
795static const WCHAR wszSuppressApp0[] = {'S','u','p','p','r','e','s','s','A','p','p','0',0};
796static 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};
797
801 { NULL }
802};
803
806 { wszFilterOption, VT_UI1, VT_UI1, WICPngFilterUnspecified, 0.0f, TRUE /* not supported on XP/2k3 */},
807 { NULL }
808};
809
815 { wszJpegYCrCbSubsampling, VT_UI1, VT_UI1, WICJpegYCrCbSubsamplingDefault, 0.0f, TRUE }, /* not supported on XP/2k3 */
817 { NULL }
818};
819
821 { wszEnableV5Header32bppBGRA, VT_BOOL, VT_BOOL, VARIANT_FALSE, 0.0f, TRUE }, /* Supported since Win7 */
822 { NULL }
823};
824
825static int find_property_index(const WCHAR* name, PROPBAG2* all_props, int all_prop_cnt)
826{
827 int i;
828 for (i=0; i < all_prop_cnt; i++)
829 {
830 if (lstrcmpW(name, all_props[i].pstrName) == 0)
831 return i;
832 }
833 return -1;
834}
835
836static void test_specific_encoder_properties(IPropertyBag2 *options, const property_opt_test_data* data, PROPBAG2* all_props, int all_prop_cnt)
837{
838 HRESULT hr;
839 int i = 0;
840 VARIANT pvarValue;
841 HRESULT phrError = S_OK;
842
843 while (data[i].name)
844 {
845 int idx = find_property_index(data[i].name, all_props, all_prop_cnt);
846 PROPBAG2 pb = {0};
847 pb.pstrName = (LPOLESTR)data[i].name;
848
849 hr = IPropertyBag2_Read(options, 1, &pb, NULL, &pvarValue, &phrError);
850
851 if (data[i].skippable && idx == -1)
852 {
853 win_skip("Property %s is not supported on this machine.\n", wine_dbgstr_w(data[i].name));
854 i++;
855 continue;
856 }
857
858 ok(idx >= 0, "Property %s not in output of GetPropertyInfo\n",
860 if (idx >= 0)
861 {
862 ok(all_props[idx].vt == data[i].var_type, "Property %s has unexpected vt type, vt=%i\n",
863 wine_dbgstr_w(data[i].name), all_props[idx].vt);
864 ok(all_props[idx].dwType == PROPBAG2_TYPE_DATA, "Property %s has unexpected dw type, vt=%li\n",
865 wine_dbgstr_w(data[i].name), all_props[idx].dwType);
866 ok(all_props[idx].cfType == 0, "Property %s has unexpected cf type, vt=%i\n",
867 wine_dbgstr_w(data[i].name), all_props[idx].cfType);
868 }
869
870 ok(SUCCEEDED(hr), "Reading property %s from bag failed, hr=%lx\n",
872
873 if (SUCCEEDED(hr))
874 {
875 /* On XP the initial type is always VT_EMPTY */
876 ok(V_VT(&pvarValue) == data[i].initial_var_type || V_VT(&pvarValue) == VT_EMPTY,
877 "Property %s has unexpected initial type, V_VT=%i\n",
878 wine_dbgstr_w(data[i].name), V_VT(&pvarValue));
879
880 if(V_VT(&pvarValue) == data[i].initial_var_type)
881 {
882 switch (data[i].initial_var_type)
883 {
884 case VT_BOOL:
885 case VT_UI1:
886 ok(V_UNION(&pvarValue, bVal) == data[i].i_init_val, "Property %s has an unexpected initial value, pvarValue=%i\n",
887 wine_dbgstr_w(data[i].name), V_UNION(&pvarValue, bVal));
888 break;
889 case VT_R4:
890 ok(V_UNION(&pvarValue, fltVal) == data[i].f_init_val, "Property %s has an unexpected initial value, pvarValue=%f\n",
891 wine_dbgstr_w(data[i].name), V_UNION(&pvarValue, fltVal));
892 break;
893 default:
894 break;
895 }
896 }
897
898 VariantClear(&pvarValue);
899 }
900
901 i++;
902 }
903}
904
905static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *options)
906{
907 HRESULT hr;
908 ULONG cProperties = 0;
909 ULONG cProperties2 = 0;
910 PROPBAG2 all_props[64] = {{0}}; /* Should be enough for every encoder out there */
911 int i;
912
913 /* CountProperties */
914 {
915 hr = IPropertyBag2_CountProperties(options, &cProperties);
916 ok(SUCCEEDED(hr), "Reading property count, hr=%lx\n", hr);
917 }
918
919 /* GetPropertyInfo */
920 {
921 hr = IPropertyBag2_GetPropertyInfo(options, cProperties, 1, all_props, &cProperties2);
922 ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - iProperty out of bounce handled wrong, hr=%lx\n", hr);
923
924 hr = IPropertyBag2_GetPropertyInfo(options, 0, cProperties+1, all_props, &cProperties2);
925 ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - cProperty out of bounce handled wrong, hr=%lx\n", hr);
926
927 if (cProperties == 0) /* GetPropertyInfo can be called for zero items on Windows 8 but not on Windows 7 (wine behaves like Win8) */
928 {
929 cProperties2 = cProperties;
930 hr = S_OK;
931 }
932 else
933 {
934 hr = IPropertyBag2_GetPropertyInfo(options, 0, min(64, cProperties), all_props, &cProperties2);
935 ok(SUCCEEDED(hr), "Reading infos from property bag failed, hr=%lx\n", hr);
936 }
937
938 if (FAILED(hr))
939 return;
940
941 ok(cProperties == cProperties2, "Mismatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n",
942 (int)cProperties, (int)cProperties2);
943 }
944
945 if (IsEqualCLSID(clsid_encoder, &CLSID_WICTiffEncoder))
947 else if (IsEqualCLSID(clsid_encoder, &CLSID_WICPngEncoder))
949 else if (IsEqualCLSID(clsid_encoder, &CLSID_WICJpegEncoder))
951 else if (IsEqualCLSID(clsid_encoder, &CLSID_WICBmpEncoder))
953
954 for (i=0; i < cProperties2; i++)
955 {
956 ok(all_props[i].pstrName != NULL, "Unset property name in output of IPropertyBag2::GetPropertyInfo\n");
957 CoTaskMemFree(all_props[i].pstrName);
958 }
959}
960
962{
963 HRESULT hr;
964 IWICPersistStream *persist;
965
966 hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist);
967 ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr);
968
969 hr = IWICPersistStream_LoadEx(persist, stream, NULL, 0);
970 ok(hr == S_OK, "LoadEx failed, hr=%lx\n", hr);
971
972 IWICPersistStream_Release(persist);
973}
974
976{
977 HRESULT hr;
979 PROPVARIANT id, value;
980 struct
981 {
982 USHORT byte_order;
984 ULONG dir_offset;
985 } tiff;
987 UINT count, i;
988 int width, height, bps, photo, samples, colormap;
989 struct
990 {
991 int id, *value;
992 } tag[] =
993 {
994 { 0x100, &width }, { 0x101, &height }, { 0x102, &bps },
995 { 0x106, &photo }, { 0x115, &samples }, { 0x140, &colormap }
996 };
997
998 memset(&tiff, 0, sizeof(tiff));
999 hr = IStream_Read(stream, &tiff, sizeof(tiff), NULL);
1000 ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
1001 ok(tiff.byte_order == MAKEWORD('I','I') || tiff.byte_order == MAKEWORD('M','M'),
1002 "wrong TIFF byte order mark %02x\n", tiff.byte_order);
1003 ok(tiff.version == 42, "wrong TIFF version %u\n", tiff.version);
1004
1005 pos.QuadPart = tiff.dir_offset;
1006 hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
1007 ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
1008
1009 hr = CoCreateInstance(&CLSID_WICIfdMetadataReader, NULL, CLSCTX_INPROC_SERVER,
1010 &IID_IWICMetadataReader, (void **)&reader);
1011 ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
1012
1014
1015 hr = IWICMetadataReader_GetCount(reader, &count);
1016 ok(hr == S_OK, "GetCount error %#lx\n", hr);
1017 ok(count != 0, "wrong count %u\n", count);
1018
1019 for (i = 0; i < ARRAY_SIZE(tag); i++)
1020 {
1021 PropVariantInit(&id);
1022 PropVariantInit(&value);
1023
1024 id.vt = VT_UI2;
1025 id.uiVal = tag[i].id;
1026 hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
1027 ok(hr == S_OK || (tag[i].id == 0x140 && hr == WINCODEC_ERR_PROPERTYNOTFOUND),
1028 "GetValue(%04x) error %#lx\n", tag[i].id, hr);
1029 if (hr == S_OK)
1030 {
1031 ok(value.vt == VT_UI2 || value.vt == VT_UI4 || value.vt == (VT_UI2 | VT_VECTOR), "wrong vt: %d\n", value.vt);
1032 tag[i].value[0] = value.uiVal;
1033 }
1034 else
1035 tag[i].value[0] = -1;
1036
1038 }
1039
1040 IWICMetadataReader_Release(reader);
1041
1042 if (IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite))
1043 {
1044 ok(width == 32, "wrong width %u\n", width);
1045 ok(height == 2, "wrong height %u\n", height);
1046
1047 ok(bps == 1, "wrong bps %d\n", bps);
1048 ok(photo == 1, "wrong photometric %d\n", photo);
1049 ok(samples == 1, "wrong samples %d\n", samples);
1050 ok(colormap == -1, "wrong colormap %d\n", colormap);
1051 }
1052 else if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
1053 {
1054 ok(width == 32, "wrong width %u\n", width);
1055 ok(height == 2, "wrong height %u\n", height);
1056
1057 ok(bps == 1, "wrong bps %d\n", bps);
1058 ok(photo == 3, "wrong photometric %d\n", photo);
1059 ok(samples == 1, "wrong samples %d\n", samples);
1060 ok(colormap == 6, "wrong colormap %d\n", colormap);
1061 }
1062 else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
1063 {
1064 ok(width == 32, "wrong width %u\n", width);
1065 ok(height == 2, "wrong height %u\n", height);
1066
1067 ok(bps == 4, "wrong bps %d\n", bps);
1068 ok(photo == 3, "wrong photometric %d\n", photo);
1069 ok(samples == 1, "wrong samples %d\n", samples);
1070 ok(colormap == 48, "wrong colormap %d\n", colormap);
1071 }
1072 else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
1073 {
1074 ok(width == 32, "wrong width %u\n", width);
1075 ok(height == 2, "wrong height %u\n", height);
1076
1077 ok(bps == 8, "wrong bps %d\n", bps);
1078 ok(photo == 3, "wrong photometric %d\n", photo);
1079 ok(samples == 1, "wrong samples %d\n", samples);
1080 ok(colormap == 768, "wrong colormap %d\n", colormap);
1081 }
1082 else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
1083 {
1084 ok(width == 32, "wrong width %u\n", width);
1085 ok(height == 2, "wrong height %u\n", height);
1086
1087 ok(bps == 3, "wrong bps %d\n", bps);
1088 ok(photo == 2, "wrong photometric %d\n", photo);
1089 ok(samples == 3, "wrong samples %d\n", samples);
1090 ok(colormap == -1, "wrong colormap %d\n", colormap);
1091 }
1092 else
1093 ok(0, "unknown TIFF pixel format %s\n", wine_dbgstr_guid(format));
1094}
1095
1097{
1098 HRESULT hr;
1099 BITMAPFILEHEADER bfh;
1100 BITMAPV5HEADER bih;
1101
1102 hr = IStream_Read(stream, &bfh, sizeof(bfh), NULL);
1103 ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
1104
1105 ok(bfh.bfType == 0x4d42, "wrong BMP signature %02x\n", bfh.bfType);
1106 ok(bfh.bfReserved1 == 0, "wrong bfReserved1 %02x\n", bfh.bfReserved1);
1107 ok(bfh.bfReserved2 == 0, "wrong bfReserved2 %02x\n", bfh.bfReserved2);
1108
1109 hr = IStream_Read(stream, &bih, sizeof(bih), NULL);
1110 ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
1111
1112 if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
1113 {
1114 ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
1115
1116 ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
1117 ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
1118
1119 ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
1120 ok(bih.bV5BitCount == 1, "wrong BitCount %d\n", bih.bV5BitCount);
1121 ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
1122 ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
1123 }
1124 else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
1125 {
1126 ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
1127
1128 ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
1129 ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
1130
1131 ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
1132 ok(bih.bV5BitCount == 4, "wrong BitCount %d\n", bih.bV5BitCount);
1133 ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
1134 ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
1135 }
1136 else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
1137 {
1138 ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
1139
1140 ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
1141 ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
1142
1143 ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
1144 ok(bih.bV5BitCount == 8, "wrong BitCount %d\n", bih.bV5BitCount);
1145 ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
1146 ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
1147 }
1148 else if (IsEqualGUID(format, &GUID_WICPixelFormat32bppBGR))
1149 {
1150 ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
1151
1152 ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
1153 ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
1154
1155 ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
1156 ok(bih.bV5BitCount == 32, "wrong BitCount %d\n", bih.bV5BitCount);
1157 ok(bih.bV5ClrUsed == 0, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
1158 ok(bih.bV5ClrImportant == 0, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
1159 }
1160 else
1161 ok(0, "unknown BMP pixel format %s\n", wine_dbgstr_guid(format));
1162}
1163
1164static unsigned be_uint(unsigned val)
1165{
1166 union
1167 {
1168 unsigned val;
1169 char c[4];
1170 } u;
1171
1172 u.val = val;
1173 return (u.c[0] << 24) | (u.c[1] << 16) | (u.c[2] << 8) | u.c[3];
1174}
1175
1177{
1178 static const char png_sig[8] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a};
1179 static const char png_IHDR[8] = {0,0,0,0x0d,'I','H','D','R'};
1180 HRESULT hr;
1181 struct
1182 {
1183 char png_sig[8];
1184 char ihdr_sig[8];
1185 unsigned width, height;
1186 char bit_depth, color_type, compression, filter, interlace;
1187 } png;
1188
1189 memset(&png, 0, sizeof(png));
1190 hr = IStream_Read(stream, &png, sizeof(png), NULL);
1191 ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
1192
1193 ok(!memcmp(png.png_sig, png_sig, sizeof(png_sig)), "expected PNG signature\n");
1194 ok(!memcmp(png.ihdr_sig, png_IHDR, sizeof(png_IHDR)), "expected PNG IHDR\n");
1195
1196 if (IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite))
1197 {
1198 ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1199 ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1200
1201 ok(png.bit_depth == 1, "wrong bit_depth %d\n", png.bit_depth);
1202 ok(png.color_type == 0, "wrong color_type %d\n", png.color_type);
1203 ok(png.compression == 0, "wrong compression %d\n", png.compression);
1204 ok(png.filter == 0, "wrong filter %d\n", png.filter);
1205 ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1206 }
1207 else if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
1208 {
1209 ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1210 ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1211
1212 ok(png.bit_depth == 1, "wrong bit_depth %d\n", png.bit_depth);
1213 ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1214 ok(png.compression == 0, "wrong compression %d\n", png.compression);
1215 ok(png.filter == 0, "wrong filter %d\n", png.filter);
1216 ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1217 }
1218 else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
1219 {
1220 ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1221 ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1222
1223 ok(png.bit_depth == 2, "wrong bit_depth %d\n", png.bit_depth);
1224 ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1225 ok(png.compression == 0, "wrong compression %d\n", png.compression);
1226 ok(png.filter == 0, "wrong filter %d\n", png.filter);
1227 ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1228 }
1229 else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
1230 {
1231 ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1232 ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1233
1234 ok(png.bit_depth == 4, "wrong bit_depth %d\n", png.bit_depth);
1235 ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1236 ok(png.compression == 0, "wrong compression %d\n", png.compression);
1237 ok(png.filter == 0, "wrong filter %d\n", png.filter);
1238 ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1239 }
1240 else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
1241 {
1242 ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1243 ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1244
1245 ok(png.bit_depth == 8, "wrong bit_depth %d\n", png.bit_depth);
1246 ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
1247 ok(png.compression == 0, "wrong compression %d\n", png.compression);
1248 ok(png.filter == 0, "wrong filter %d\n", png.filter);
1249 ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
1250 }
1251 else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
1252 {
1253 ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
1254 ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
1255
1256 ok(png.bit_depth == 8, "wrong bit_depth %d\n", png.bit_depth);
1257 ok(png.color_type == 2, "wrong color_type %d\n", png.color_type);
1258 ok(png.compression == 0, "wrong compression %d\n", png.compression);
1259 ok(png.filter == 0, "wrong filter %d\n", png.filter);
1260 ok(png.interlace == 0 || png.interlace == 1, "wrong interlace %d\n", png.interlace);
1261 }
1262 else
1263 ok(0, "unknown PNG pixel format %s\n", wine_dbgstr_guid(format));
1264}
1265
1267{
1268#include "pshpack1.h"
1270 {
1271 char signature[6];
1272 USHORT width;
1273 USHORT height;
1274 BYTE packed;
1275 /* global_color_table_flag : 1;
1276 * color_resolution : 3;
1277 * sort_flag : 1;
1278 * global_color_table_size : 3;
1279 */
1282 } lsd;
1283#include "poppack.h"
1284 UINT color_resolution;
1285 HRESULT hr;
1286
1287 memset(&lsd, 0, sizeof(lsd));
1288 hr = IStream_Read(stream, &lsd, sizeof(lsd), NULL);
1289 ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
1290
1291 ok(!memcmp(lsd.signature, "GIF89a", 6), "wrong GIF signature %.6s\n", lsd.signature);
1292
1293 ok(lsd.width == 32, "wrong width %u\n", lsd.width);
1294 ok(lsd.height == 2, "wrong height %u\n", lsd.height);
1295 color_resolution = 1 << (((lsd.packed >> 4) & 0x07) + 1);
1296 ok(color_resolution == 256, "wrong color resolution %u\n", color_resolution);
1297 ok(lsd.pixel_aspect_ratio == 0, "wrong pixel_aspect_ratio %u\n", lsd.pixel_aspect_ratio);
1298}
1299
1301{
1302 HRESULT hr;
1304
1305 pos.QuadPart = 0;
1306 hr = IStream_Seek(stream, pos, SEEK_SET, (ULARGE_INTEGER *)&pos);
1307 ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
1308
1309 if (IsEqualGUID(encoder, &CLSID_WICPngEncoder))
1311 else if (IsEqualGUID(encoder, &CLSID_WICBmpEncoder))
1313 else if (IsEqualGUID(encoder, &CLSID_WICTiffEncoder))
1315 else if (IsEqualGUID(encoder, &CLSID_WICGifEncoder))
1317 else
1318 ok(0, "unknown encoder %s\n", wine_dbgstr_guid(encoder));
1319
1320 hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
1321 ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
1322}
1323
1324struct setting {
1325 const WCHAR *name;
1326 PROPBAG2_TYPE type;
1328 void *value;
1329};
1330
1331#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
1333{
1334 ULONG rc;
1335 IUnknown_AddRef(obj);
1336 rc = IUnknown_Release(obj);
1337 ok_(__FILE__,line)(rc == ref, "expected refcount %ld, got %ld\n", ref, rc);
1338}
1339
1341{
1344 HRESULT hr;
1345
1346 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
1347 &IID_IWICComponentFactory, (void **)&factory);
1348 ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
1349
1350 hr = IWICBitmapFrameEncode_SetPalette(frameencode, NULL);
1351 ok(hr == E_INVALIDARG, "SetPalette failed, hr=%lx\n", hr);
1352
1353 hr = IWICComponentFactory_CreatePalette(factory, &palette);
1354 ok(hr == S_OK, "CreatePalette failed, hr=%lx\n", hr);
1355
1356 hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1357 todo_wine
1358 ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr=%lx\n", hr);
1359
1360 hr = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeFixedHalftone256, FALSE);
1361 ok(hr == S_OK, "InitializePredefined failed, hr=%lx\n", hr);
1362
1363 EXPECT_REF(palette, 1);
1364 hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1365 ok(hr == S_OK, "SetPalette failed, hr=%lx\n", hr);
1366 EXPECT_REF(palette, 1);
1367
1368 hr = IWICBitmapFrameEncode_SetPalette(frameencode, NULL);
1369 ok(hr == E_INVALIDARG, "SetPalette failed, hr=%lx\n", hr);
1370
1371 IWICPalette_Release(palette);
1372 IWICComponentFactory_Release(factory);
1373}
1374
1375static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID* clsid_encoder,
1376 const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc,
1377 const struct setting *settings, const char *name, IWICPalette *palette, BOOL set_size)
1378{
1379 const GUID *container_format = NULL;
1380 HRESULT hr;
1382 BitmapTestSrc *src_obj;
1383 HGLOBAL hglobal;
1384 IStream *stream;
1385 IWICBitmapFrameEncode *frameencode;
1388 IWICBitmapFrameDecode *framedecode;
1390 GUID guid;
1391 int i;
1392
1393 hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
1394 &IID_IWICBitmapEncoder, (void **)&encoder);
1395 ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
1396
1398 ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
1399
1400 hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
1401 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
1402
1403 if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
1404 container_format = &GUID_ContainerFormatPng;
1405 else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder))
1406 container_format = &GUID_ContainerFormatBmp;
1407 else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder))
1408 container_format = &GUID_ContainerFormatTiff;
1409 else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder))
1410 container_format = &GUID_ContainerFormatJpeg;
1411 else if (IsEqualGUID(clsid_encoder, &CLSID_WICGifEncoder))
1412 container_format = &GUID_ContainerFormatGif;
1413 else
1414 ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder));
1415
1416 if (container_format)
1417 {
1418 memset(&guid, 0, sizeof(guid));
1419 hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
1420 ok(SUCCEEDED(hr), "Failed to get container format, hr %#lx.\n", hr);
1421 ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
1422 }
1423
1424 hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
1425 ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
1426
1427 /* Encoder options are optional. */
1428 hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, NULL);
1429 ok(SUCCEEDED(hr), "Failed to create encode frame, hr %#lx.\n", hr);
1430
1431 IStream_Release(stream);
1432 IWICBitmapEncoder_Release(encoder);
1433 IWICBitmapFrameEncode_Release(frameencode);
1434
1435 hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
1436 &IID_IWICBitmapEncoder, (void**)&encoder);
1437 ok(SUCCEEDED(hr), "CoCreateInstance(%s) failed, hr=%lx\n", wine_dbgstr_guid(clsid_encoder), hr);
1438 if (SUCCEEDED(hr))
1439 {
1440 hglobal = GlobalAlloc(GMEM_MOVEABLE, 0);
1441 ok(hglobal != NULL, "GlobalAlloc failed\n");
1442 if (hglobal)
1443 {
1444 hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
1445 ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
1446 }
1447
1448 if (hglobal && SUCCEEDED(hr))
1449 {
1450 if (palette)
1451 {
1452 hr = IWICBitmapEncoder_SetPalette(encoder, palette);
1453 ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#lx (%s)\n", hr, name);
1454 }
1455
1456 hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
1457 ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
1458
1459 if (palette)
1460 {
1461 hr = IWICBitmapEncoder_SetPalette(encoder, palette);
1462 if (IsEqualGUID(clsid_encoder, &CLSID_WICGifEncoder))
1463 ok(hr == S_OK, "SetPalette failed, hr=%#lx\n", hr);
1464 else
1465 ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "wrong error %#lx\n", hr);
1466 hr = S_OK;
1467 }
1468
1469 i=0;
1470 while (SUCCEEDED(hr) && srcs[i])
1471 {
1472 CreateTestBitmap(srcs[i], &src_obj);
1473
1474 hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, &options);
1475 ok(SUCCEEDED(hr), "CreateFrame failed, hr=%lx\n", hr);
1476 if (SUCCEEDED(hr))
1477 {
1478 ok(options != NULL, "Encoder initialization has not created an property bag\n");
1479 if(options)
1480 test_encoder_properties(clsid_encoder, options);
1481
1482 if (settings)
1483 {
1484 int j;
1485 for (j=0; settings[j].name; j++)
1486 {
1487 PROPBAG2 propbag;
1488 VARIANT var;
1489
1490 memset(&propbag, 0, sizeof(propbag));
1491 memset(&var, 0, sizeof(var));
1492 propbag.pstrName = (LPOLESTR)settings[j].name;
1493 propbag.dwType = settings[j].type;
1494 V_VT(&var) = settings[j].vt;
1495 V_UNKNOWN(&var) = settings[j].value;
1496
1497 hr = IPropertyBag2_Write(options, 1, &propbag, &var);
1498 ok(SUCCEEDED(hr), "Writing property %s failed, hr=%lx\n", wine_dbgstr_w(settings[j].name), hr);
1499 }
1500 }
1501
1502 if (palette)
1503 {
1504 hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1505 ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#lx\n", hr);
1506 }
1507
1508 hr = IWICBitmapFrameEncode_Initialize(frameencode, options);
1509 ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
1510
1511 memcpy(&pixelformat, srcs[i]->format, sizeof(GUID));
1512 hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &pixelformat);
1513 ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%lx\n", hr);
1514 ok(IsEqualGUID(&pixelformat, dsts[i]->format) ||
1515 (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)) ||
1516 (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
1517 "SetPixelFormat changed the format to %s (%s)\n", wine_dbgstr_guid(&pixelformat), name);
1518
1519 if (set_size)
1520 {
1521 hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height);
1522 ok(hr == S_OK, "SetSize failed, hr=%lx\n", hr);
1523 }
1524
1525 if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
1526 test_set_frame_palette(frameencode);
1527
1528 if (palette)
1529 {
1530 hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
1531 ok(SUCCEEDED(hr), "SetPalette failed, hr=%lx (%s)\n", hr, name);
1532 }
1533
1534 hr = IWICBitmapFrameEncode_WriteSource(frameencode, &src_obj->IWICBitmapSource_iface, rc);
1535 if (rc && (rc->Width <= 0 || rc->Height <= 0))
1536 {
1537 /* WriteSource fails but WriteSource_Proxy succeeds. */
1538 ok(hr == E_INVALIDARG, "WriteSource should fail, hr=%lx (%s)\n", hr, name);
1540 if (!set_size && rc->Width < 0)
1541 todo_wine
1544 "WriteSource_Proxy(%dx%d) got unexpected hr %lx (%s)\n", rc->Width, rc->Height, hr, name);
1545 else
1546 ok(hr == S_OK, "WriteSource_Proxy failed, %dx%d, hr=%lx (%s)\n", rc->Width, rc->Height, hr, name);
1547 }
1548 else
1549 {
1550 if (rc)
1551 ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%lx (%s)\n", rc->Width, rc->Height, hr, name);
1552 else
1553 todo_wine_if((IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) ||
1554 (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2))
1555 ok(hr == S_OK, "WriteSource(NULL) failed, hr=%lx (%s)\n", hr, name);
1556
1557 }
1558
1559 if (SUCCEEDED(hr))
1560 {
1561 hr = IWICBitmapFrameEncode_Commit(frameencode);
1562 if (!set_size && rc && rc->Height < 0)
1563 todo_wine
1564 ok(hr == WINCODEC_ERR_UNEXPECTEDSIZE, "Commit got unexpected hr %lx (%s)\n", hr, name);
1565 else
1566 ok(hr == S_OK, "Commit failed, hr=%lx (%s)\n", hr, name);
1567 }
1568
1569 IWICBitmapFrameEncode_Release(frameencode);
1570 IPropertyBag2_Release(options);
1571 }
1572
1573 DeleteTestBitmap(src_obj);
1574
1575 i++;
1576 }
1577
1578 if (clsid_decoder == NULL)
1579 {
1580 IStream_Release(stream);
1581 IWICBitmapEncoder_Release(encoder);
1582 return;
1583 }
1584
1585 if (SUCCEEDED(hr))
1586 {
1587 hr = IWICBitmapEncoder_Commit(encoder);
1588 ok(SUCCEEDED(hr), "Commit failed, hr=%lx\n", hr);
1589
1590 if (IsEqualGUID(&pixelformat, dsts[0]->format))
1591 check_bitmap_format(stream, clsid_encoder, dsts[0]->format);
1592 }
1593
1594 if (SUCCEEDED(hr))
1595 {
1596 hr = CoCreateInstance(clsid_decoder, NULL, CLSCTX_INPROC_SERVER,
1597 &IID_IWICBitmapDecoder, (void**)&decoder);
1598 ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
1599 }
1600
1601 if (SUCCEEDED(hr))
1602 {
1603 IWICPalette *frame_palette;
1604
1605 hr = IWICImagingFactory_CreatePalette(factory, &frame_palette);
1606 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
1607
1608 hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
1609 if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
1610 ok(hr == WINCODEC_ERR_WRONGSTATE, "wrong error %#lx\n", hr);
1611 else
1612 ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#lx\n", hr);
1613
1614 hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
1615 ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
1616
1617 hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
1618 if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
1619 ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING) /* XP */, "CopyPalette failed, hr=%#lx\n", hr);
1620 else
1621 ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#lx\n", hr);
1622
1623 hr = S_OK;
1624 i=0;
1625 while (SUCCEEDED(hr) && dsts[i])
1626 {
1627 hr = IWICBitmapDecoder_GetFrame(decoder, i, &framedecode);
1628 ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx (%s)\n", hr, name);
1629
1630 if (SUCCEEDED(hr))
1631 {
1632 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &pixelformat);
1633 ok(hr == S_OK, "GetPixelFormat) failed, hr=%lx (%s)\n", hr, name);
1634 if (IsEqualGUID(&pixelformat, dsts[i]->format))
1635 compare_bitmap_data(srcs[i], dsts[i], (IWICBitmapSource*)framedecode, name);
1636
1637 hr = IWICBitmapFrameDecode_CopyPalette(framedecode, frame_palette);
1638 if (winetest_debug > 1)
1639 trace("%s, bpp %d, %s, hr %#lx\n", name, dsts[i]->bpp, wine_dbgstr_guid(dsts[i]->format), hr);
1640 if (dsts[i]->bpp > 8 || IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormatBlackWhite))
1641 ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#lx\n", hr);
1642 else
1643 {
1644 UINT count, ret;
1645 WICColor colors[256];
1646
1647 ok(hr == S_OK, "CopyPalette error %#lx (%s)\n", hr, name);
1648
1649 count = 0;
1650 hr = IWICPalette_GetColorCount(frame_palette, &count);
1651 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
1652
1653 memset(colors, 0, sizeof(colors));
1654 ret = 0;
1655 hr = IWICPalette_GetColors(frame_palette, count, colors, &ret);
1656 ok(hr == S_OK, "GetColors error %#lx\n", hr);
1657 ok(ret == count, "expected %u, got %u\n", count, ret);
1658 if (IsEqualGUID(clsid_decoder, &CLSID_WICPngDecoder))
1659 {
1660 /* Newer libpng versions don't accept larger palettes than the declared
1661 * bit depth, so we need to generate the palette of the correct length.
1662 */
1663 ok(count == 256 || (dsts[i]->bpp == 1 && count == 2) ||
1664 (dsts[i]->bpp == 2 && count == 4) || (dsts[i]->bpp == 4 && count == 16),
1665 "expected 256, got %u (%s)\n", count, name);
1666
1667 ok(colors[0] == 0x11111111, "got %08x (%s)\n", colors[0], name);
1668 ok(colors[1] == 0x22222222, "got %08x (%s)\n", colors[1], name);
1669 if (count > 2)
1670 {
1671 ok(colors[2] == 0x33333333, "got %08x (%s)\n", colors[2], name);
1672 ok(colors[3] == 0x44444444, "got %08x (%s)\n", colors[3], name);
1673 if (count > 4)
1674 {
1675 ok(colors[4] == 0x55555555, "got %08x (%s)\n", colors[4], name);
1676 ok(colors[5] == 0, "got %08x (%s)\n", colors[5], name);
1677 }
1678 }
1679 }
1680 else if (IsEqualGUID(clsid_decoder, &CLSID_WICBmpDecoder) ||
1681 IsEqualGUID(clsid_decoder, &CLSID_WICTiffDecoder) ||
1682 IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
1683 {
1684 if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormatBlackWhite) ||
1685 IsEqualGUID(&pixelformat, &GUID_WICPixelFormat8bppIndexed))
1686 {
1687 ok(count == 256, "expected 256, got %u (%s)\n", count, name);
1688
1689 ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
1690 ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
1691 ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
1692 ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
1693 ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
1694 ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
1695 }
1696 else if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed))
1697 {
1698 ok(count == 16, "expected 16, got %u (%s)\n", count, name);
1699
1700 ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
1701 ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
1702 ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
1703 ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
1704 ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
1705 ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
1706 }
1707 else
1708 {
1709 ok(count == 2, "expected 2, got %u (%s)\n", count, name);
1710
1711 ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
1712 ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
1713 }
1714 }
1715 else
1716 {
1717 ok(count == 2, "expected 2, got %u (%s)\n", count, name);
1718
1719 ok(colors[0] == 0xff111111, "got %08x\n", colors[0]);
1720 ok(colors[1] == 0xff222222, "got %08x\n", colors[1]);
1721 }
1722 }
1723
1724 IWICBitmapFrameDecode_Release(framedecode);
1725 }
1726
1727 i++;
1728 }
1729
1730 IWICPalette_Release(frame_palette);
1731 IWICBitmapDecoder_Release(decoder);
1732 }
1733
1734 IStream_Release(stream);
1735 }
1736
1737 IWICBitmapEncoder_Release(encoder);
1738 }
1739}
1740
1741static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* clsid_encoder,
1742 const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc,
1743 const struct setting *settings, const char *name, IWICPalette *palette)
1744{
1745 test_multi_encoder_impl(srcs, clsid_encoder, dsts, clsid_decoder, rc, settings, name, palette, TRUE);
1746 test_multi_encoder_impl(srcs, clsid_encoder, dsts, clsid_decoder, rc, settings, name, palette, FALSE);
1747}
1748
1749static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encoder,
1750 const struct bitmap_data *dst, const CLSID *clsid_decoder, const char *name)
1751{
1752 const struct bitmap_data *srcs[2];
1753 const struct bitmap_data *dsts[2];
1754 WICColor colors[256];
1756 HRESULT hr;
1757
1758 hr = IWICImagingFactory_CreatePalette(factory, &palette);
1759 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
1760
1761 memset(colors, 0, sizeof(colors));
1762 colors[0] = 0x11111111;
1763 colors[1] = 0x22222222;
1764 colors[2] = 0x33333333;
1765 colors[3] = 0x44444444;
1766 colors[4] = 0x55555555;
1767 /* TIFF decoder fails to decode a 8bpp frame if palette has less than 256 colors */
1768 hr = IWICPalette_InitializeCustom(palette, colors, 256);
1769 ok(hr == S_OK, "InitializeCustom error %#lx\n", hr);
1770
1771 srcs[0] = src;
1772 srcs[1] = NULL;
1773 dsts[0] = dst;
1774 dsts[1] = NULL;
1775
1776 test_multi_encoder(srcs, clsid_encoder, dsts, clsid_decoder, NULL, NULL, name, palette);
1777
1778 IWICPalette_Release(palette);
1779}
1780
1781static void test_encoder_rects(void)
1782{
1783 const struct bitmap_data *srcs[2];
1784 const struct bitmap_data *dsts[2];
1785 WICRect rc;
1786
1787 srcs[0] = &testdata_24bppBGR;
1788 srcs[1] = NULL;
1789 dsts[0] = &testdata_24bppBGR;
1790 dsts[1] = NULL;
1791
1792 rc.X = 0;
1793 rc.Y = 0;
1794 rc.Width = 32;
1795 rc.Height = 2;
1796
1797 test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects full", NULL);
1798
1799 rc.Width = 0;
1800 test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=0", NULL);
1801
1802 rc.Width = -1;
1803 test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=-1", NULL);
1804
1805 rc.Width = 32;
1806 rc.Height = 0;
1807 test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=0", NULL);
1808
1809 rc.Height = -1;
1810 test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=-1", NULL);
1811}
1812
1813static const struct bitmap_data *multiple_frames[3] = {
1816 NULL};
1817
1818static const struct bitmap_data *single_frame[2] = {
1820 NULL};
1821
1822static const struct setting png_interlace_settings[] = {
1823 {wszInterlaceOption, PROPBAG2_TYPE_DATA, VT_BOOL, (void*)VARIANT_TRUE},
1824 {NULL}
1825};
1826
1828{
1829 HRESULT hr;
1830 BitmapTestSrc *src_obj;
1831 IWICFormatConverter *converter;
1833 UINT count, i;
1834 BYTE buf[32 * 2 * 3]; /* enough to hold 32x2 24bppBGR data */
1835
1837
1838 hr = IWICImagingFactory_CreatePalette(factory, &palette);
1839 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
1840 count = 0xdeadbeef;
1841 hr = IWICPalette_GetColorCount(palette, &count);
1842 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
1843 ok(count == 0, "expected 0, got %u\n", count);
1844
1845 /* NULL palette + Custom type */
1846 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1847 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1848 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1849 &GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone,
1851 ok(hr == S_OK, "Initialize error %#lx\n", hr);
1852 hr = IWICFormatConverter_CopyPalette(converter, palette);
1853 ok(hr == 0xdeadbeef, "unexpected error %#lx\n", hr);
1854 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32 * 3, sizeof(buf), buf);
1855 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
1856 IWICFormatConverter_Release(converter);
1857
1858 /* NULL palette + Custom type */
1859 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1860 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1861 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1862 &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1864 ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
1865 hr = IWICFormatConverter_CopyPalette(converter, palette);
1866 ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#lx\n", hr);
1867 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1868 ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#lx\n", hr);
1869 IWICFormatConverter_Release(converter);
1870
1871 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1872 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1873 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1874 &GUID_WICPixelFormat4bppIndexed, WICBitmapDitherTypeNone,
1876 ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
1877 IWICFormatConverter_Release(converter);
1878
1879 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1880 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1881 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1882 &GUID_WICPixelFormat2bppIndexed, WICBitmapDitherTypeNone,
1884 ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
1885 IWICFormatConverter_Release(converter);
1886
1887 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1888 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1889 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1890 &GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
1892 ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
1893 IWICFormatConverter_Release(converter);
1894
1895 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1896 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1897 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1898 &GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
1900 todo_wine ok(hr == S_OK, "unexpected error %#lx\n", hr);
1901 IWICFormatConverter_Release(converter);
1902
1903 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1904 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1905 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1906 &GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
1908 todo_wine ok(hr == S_OK, "unexpected error %#lx\n", hr);
1909 IWICFormatConverter_Release(converter);
1910
1911 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1912 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1913 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1914 &GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
1916 todo_wine ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
1917 IWICFormatConverter_Release(converter);
1918
1919 /* empty palette + Custom type */
1920 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1921 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1922 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1923 &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1925 ok(hr == S_OK, "Initialize error %#lx\n", hr);
1926 hr = IWICFormatConverter_CopyPalette(converter, palette);
1927 ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
1928 count = 0xdeadbeef;
1929 hr = IWICPalette_GetColorCount(palette, &count);
1930 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
1931 ok(count == 0, "expected 0, got %u\n", count);
1932 memset(buf, 0xaa, sizeof(buf));
1933 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1934 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
1935 count = 0;
1936 for (i = 0; i < 32 * 2; i++)
1937 if (buf[i] != 0) count++;
1938 ok(count == 0, "expected 0\n");
1939 IWICFormatConverter_Release(converter);
1940
1941 /* NULL palette + Predefined type */
1942 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1943 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1944 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1945 &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1947 ok(hr == S_OK, "Initialize error %#lx\n", hr);
1948 hr = IWICFormatConverter_CopyPalette(converter, palette);
1949 ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
1950 count = 0xdeadbeef;
1951 hr = IWICPalette_GetColorCount(palette, &count);
1952 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
1953 ok(count == 16, "expected 16, got %u\n", count);
1954 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1955 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
1956 count = 0;
1957 for (i = 0; i < 32 * 2; i++)
1958 if (buf[i] != 0) count++;
1959 ok(count != 0, "expected != 0\n");
1960 IWICFormatConverter_Release(converter);
1961
1962 /* not empty palette + Predefined type */
1963 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1964 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1965 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1966 &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1968 ok(hr == S_OK, "Initialize error %#lx\n", hr);
1969 hr = IWICFormatConverter_CopyPalette(converter, palette);
1970 ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
1971 count = 0xdeadbeef;
1972 hr = IWICPalette_GetColorCount(palette, &count);
1973 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
1974 ok(count == 16, "expected 16, got %u\n", count);
1975 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1976 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
1977 count = 0;
1978 for (i = 0; i < 32 * 2; i++)
1979 if (buf[i] != 0) count++;
1980 ok(count != 0, "expected != 0\n");
1981 IWICFormatConverter_Release(converter);
1982
1983 /* not empty palette + MedianCut type */
1984 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
1985 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
1986 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
1987 &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
1989 ok(hr == S_OK, "Initialize error %#lx\n", hr);
1990 hr = IWICFormatConverter_CopyPalette(converter, palette);
1991 ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
1992 count = 0xdeadbeef;
1993 hr = IWICPalette_GetColorCount(palette, &count);
1994 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
1995 ok(count == 16, "expected 16, got %u\n", count);
1996 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
1997 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
1998 count = 0;
1999 for (i = 0; i < 32 * 2; i++)
2000 if (buf[i] != 0) count++;
2001 ok(count != 0, "expected != 0\n");
2002 IWICFormatConverter_Release(converter);
2003
2004 /* NULL palette + MedianCut type */
2005 hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
2006 ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
2007 hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
2008 &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
2010 ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#lx\n", hr);
2011 if (hr == S_OK)
2012 {
2013 hr = IWICFormatConverter_CopyPalette(converter, palette);
2014 ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
2015 count = 0xdeadbeef;
2016 hr = IWICPalette_GetColorCount(palette, &count);
2017 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
2018 ok(count == 8, "expected 8, got %u\n", count);
2019 hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
2020 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
2021 count = 0;
2022 for (i = 0; i < 32 * 2; i++)
2023 if (buf[i] != 0) count++;
2024 ok(count != 0, "expected != 0\n");
2025 }
2026 IWICFormatConverter_Release(converter);
2027
2028 IWICPalette_Release(palette);
2029 DeleteTestBitmap(src_obj);
2030}
2031
2032START_TEST(converter)
2033{
2034 HRESULT hr;
2035
2037
2038 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
2039 &IID_IWICImagingFactory, (void **)&factory);
2040 ok(hr == S_OK, "failed to create factory: %#lx\n", hr);
2041
2042 test_conversion(&testdata_24bppRGB, &testdata_1bppIndexed, "24bppRGB -> 1bppIndexed", TRUE);
2043 test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 2bppIndexed", TRUE);
2044 test_conversion(&testdata_24bppRGB, &testdata_4bppIndexed, "24bppRGB -> 4bppIndexed", TRUE);
2045 test_conversion(&testdata_24bppRGB, &testdata_8bppIndexed, "24bppRGB -> 8bppIndexed", FALSE);
2046
2047 test_conversion(&testdata_BlackWhite, &testdata_8bppIndexed_BW, "BlackWhite -> 8bppIndexed", TRUE);
2048 test_conversion(&testdata_1bppIndexed, &testdata_8bppIndexed_BW, "1bppIndexed -> 8bppIndexed", TRUE);
2049 test_conversion(&testdata_2bppIndexed, &testdata_8bppIndexed_4colors, "2bppIndexed -> 8bppIndexed", TRUE);
2050 test_conversion(&testdata_4bppIndexed, &testdata_8bppIndexed, "4bppIndexed -> 8bppIndexed", TRUE);
2051
2056
2061
2062 test_conversion(&testdata_24bppBGR, &testdata_24bppBGR, "24bppBGR -> 24bppBGR", FALSE);
2063 test_conversion(&testdata_24bppBGR, &testdata_24bppRGB, "24bppBGR -> 24bppRGB", FALSE);
2064
2065 test_conversion(&testdata_24bppRGB, &testdata_24bppRGB, "24bppRGB -> 24bppRGB", FALSE);
2066 test_conversion(&testdata_24bppRGB, &testdata_24bppBGR, "24bppRGB -> 24bppBGR", FALSE);
2067
2068 test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
2069 test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
2070 test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE);
2071 test_conversion(&testdata_32bppRGBA, &testdata_24bppBGR, "32bppRGBA -> 24bppBGR", FALSE);
2072
2073 test_conversion(&testdata_32bppRGBA, &testdata_32bppBGRA, "32bppRGBA -> 32bppBGRA", FALSE);
2074 test_conversion(&testdata_32bppBGRA, &testdata_32bppRGBA, "32bppBGRA -> 32bppRGBA", FALSE);
2075
2076 test_conversion(&testdata_64bppRGBA, &testdata_32bppRGBA, "64bppRGBA -> 32bppRGBA", FALSE);
2077 test_conversion(&testdata_64bppRGBA, &testdata_32bppRGB, "64bppRGBA -> 32bppRGB", FALSE);
2078
2079 test_conversion(&testdata_24bppRGB, &testdata_32bppGrayFloat, "24bppRGB -> 32bppGrayFloat", FALSE);
2080 test_conversion(&testdata_32bppBGR, &testdata_32bppGrayFloat, "32bppBGR -> 32bppGrayFloat", FALSE);
2081
2082 test_conversion(&testdata_24bppBGR, &testdata_8bppGray, "24bppBGR -> 8bppGray", FALSE);
2083 test_conversion(&testdata_32bppBGR, &testdata_8bppGray, "32bppBGR -> 8bppGray", FALSE);
2084 test_conversion(&testdata_32bppGrayFloat, &testdata_24bppBGR_gray, "32bppGrayFloat -> 24bppBGR gray", FALSE);
2085 test_conversion(&testdata_32bppGrayFloat, &testdata_8bppGray, "32bppGrayFloat -> 8bppGray", FALSE);
2086 test_conversion(&testdata_32bppBGRA, &testdata_16bppBGRA5551, "32bppBGRA -> 16bppBGRA5551", FALSE);
2087 test_conversion(&testdata_48bppRGB, &testdata_64bppRGBA_2, "48bppRGB -> 64bppRGBA", FALSE);
2088
2094
2095 test_encoder(&testdata_8bppIndexed, &CLSID_WICGifEncoder,
2096 &testdata_8bppIndexed, &CLSID_WICGifDecoder, "GIF encoder 8bppIndexed");
2097
2098 test_encoder(&testdata_BlackWhite, &CLSID_WICPngEncoder,
2099 &testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
2100 test_encoder(&testdata_1bppIndexed, &CLSID_WICPngEncoder,
2101 &testdata_1bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 1bppIndexed");
2102 test_encoder(&testdata_2bppIndexed, &CLSID_WICPngEncoder,
2103 &testdata_2bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 2bppIndexed");
2104 test_encoder(&testdata_4bppIndexed, &CLSID_WICPngEncoder,
2105 &testdata_4bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 4bppIndexed");
2106 test_encoder(&testdata_8bppIndexed, &CLSID_WICPngEncoder,
2107 &testdata_8bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 8bppIndexed");
2108 test_encoder(&testdata_24bppBGR, &CLSID_WICPngEncoder,
2109 &testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 24bppBGR");
2110if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in Wine */
2111{
2112 test_encoder(&testdata_32bppBGR, &CLSID_WICPngEncoder,
2113 &testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 32bppBGR");
2114}
2115
2116 test_encoder(&testdata_BlackWhite, &CLSID_WICBmpEncoder,
2117 &testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder BlackWhite");
2118 test_encoder(&testdata_1bppIndexed, &CLSID_WICBmpEncoder,
2119 &testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 1bppIndexed");
2120 test_encoder(&testdata_2bppIndexed, &CLSID_WICBmpEncoder,
2121 &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 2bppIndexed");
2122 test_encoder(&testdata_4bppIndexed, &CLSID_WICBmpEncoder,
2123 &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 4bppIndexed");
2124 test_encoder(&testdata_8bppIndexed, &CLSID_WICBmpEncoder,
2125 &testdata_8bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 8bppIndexed");
2126 test_encoder(&testdata_32bppBGR, &CLSID_WICBmpEncoder,
2127 &testdata_32bppBGR, &CLSID_WICBmpDecoder, "BMP encoder 32bppBGR");
2128
2129 test_encoder(&testdata_BlackWhite, &CLSID_WICTiffEncoder,
2130 &testdata_BlackWhite, &CLSID_WICTiffDecoder, "TIFF encoder BlackWhite");
2131 test_encoder(&testdata_1bppIndexed, &CLSID_WICTiffEncoder,
2132 &testdata_1bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 1bppIndexed");
2133 test_encoder(&testdata_2bppIndexed, &CLSID_WICTiffEncoder,
2134 &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 2bppIndexed");
2135 test_encoder(&testdata_4bppIndexed, &CLSID_WICTiffEncoder,
2136 &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 4bppIndexed");
2137 test_encoder(&testdata_8bppIndexed, &CLSID_WICTiffEncoder,
2138 &testdata_8bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 8bppIndexed");
2139 test_encoder(&testdata_24bppBGR, &CLSID_WICTiffEncoder,
2140 &testdata_24bppBGR, &CLSID_WICTiffDecoder, "TIFF encoder 24bppBGR");
2141
2142 test_encoder(&testdata_24bppBGR, &CLSID_WICJpegEncoder,
2143 &testdata_24bppBGR, NULL, "JPEG encoder 24bppBGR");
2144
2145 test_multi_encoder(multiple_frames, &CLSID_WICTiffEncoder,
2146 multiple_frames, &CLSID_WICTiffDecoder, NULL, NULL, "TIFF encoder multi-frame", NULL);
2147
2149
2150 test_multi_encoder(single_frame, &CLSID_WICPngEncoder,
2151 single_frame, &CLSID_WICPngDecoder, NULL, png_interlace_settings, "PNG encoder interlaced", NULL);
2152
2153 IWICImagingFactory_Release(factory);
2154
2156}
struct mke2fs_defaults settings[]
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define ARRAY_SIZE(A)
Definition: main.h:20
static void set_size(float size)
Definition: wordpad.c:316
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
_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:1365
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DWORD bpp
Definition: surface.c:185
unsigned int idx
Definition: utils.c:41
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
unsigned short VARTYPE
Definition: compat.h:2254
#define HeapFree(x, y, z)
Definition: compat.h:735
@ VT_R4
Definition: compat.h:2299
@ VT_UI2
Definition: compat.h:2312
@ VT_ARRAY
Definition: compat.h:2341
@ VT_I4
Definition: compat.h:2298
@ VT_BOOL
Definition: compat.h:2306
@ VT_UI4
Definition: compat.h:2313
@ VT_EMPTY
Definition: compat.h:2295
@ VT_VECTOR
Definition: compat.h:2340
@ VT_UI1
Definition: compat.h:2311
static const WCHAR version[]
Definition: asmname.c:66
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:91
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
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
pixelformat
Definition: converter.c:37
HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst)
Definition: info.c:2437
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
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
#define printf
Definition: freeldr.h:97
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei stride
Definition: glext.h:5848
GLsizei samples
Definition: glext.h:7006
GLenum src
Definition: glext.h:6340
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLuint GLfloat * val
Definition: glext.h:7180
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint id
Definition: glext.h:5910
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
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
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
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
_Check_return_ __CRT_INLINE float __CRTDECL fabsf(_In_ float x)
Definition: math.h:193
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define SEEK_SET
Definition: jmemansi.c:26
#define wine_dbgstr_w
Definition: kernel32.h:34
const GUID * guid
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define for
Definition: utility.h:88
BOOL todo
Definition: filedlg.c:313
const char * var
Definition: shader.c:5666
#define todo_wine_if(is_todo)
Definition: custom.c:86
#define todo_wine
Definition: custom.c:89
static LPOLESTR
Definition: stg_prop.c:27
static HPALETTE palette
Definition: clipboard.c:1345
static const BYTE bits_8bpp_BW[]
Definition: converter.c:406
static const struct bitmap_data testdata_8bppGray
Definition: converter.c:590
static const struct property_opt_test_data testdata_jpeg_props[]
Definition: converter.c:810
static const WCHAR wszImageQuality[]
Definition: converter.c:790
static void test_set_frame_palette(IWICBitmapFrameEncode *frameencode)
Definition: converter.c:1340
static int find_property_index(const WCHAR *name, PROPBAG2 *all_props, int all_prop_cnt)
Definition: converter.c:825
static void test_encoder_properties(const CLSID *clsid_encoder, IPropertyBag2 *options)
Definition: converter.c:905
static HRESULT WINAPI BitmapTestSrc_GetResolution(IWICBitmapSource *iface, double *pDpiX, double *pDpiY)
Definition: converter.c:111
static const struct bitmap_data testdata_48bppRGB
Definition: converter.c:629
static void test_converter_4bppGray(void)
Definition: converter.c:710
static const struct setting png_interlace_settings[]
Definition: converter.c:1822
static const struct bitmap_data testdata_32bppRGBA
Definition: converter.c:501
static const struct bitmap_data testdata_4bppGray_xp
Definition: converter.c:568
static const struct bitmap_data testdata_32bppPBGRA
Definition: converter.c:523
static const struct bitmap_data testdata_32bppGrayFloat_xp
Definition: converter.c:550
static const struct bitmap_data testdata_BlackWhite
Definition: converter.c:386
static BOOL is_indexed_format(const GUID *format)
Definition: converter.c:315
static HRESULT WINAPI BitmapTestSrc_CopyPixels(IWICBitmapSource *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: converter.c:147
static const struct bitmap_data testdata_4bppIndexed
Definition: converter.c:403
static const struct bitmap_data testdata_8bppIndexed_BW
Definition: converter.c:409
static const BYTE bits_32bppPBGRA[]
Definition: converter.c:506
static const struct bitmap_data testdata_24bppBGR_gray
Definition: converter.c:602
static HRESULT WINAPI BitmapTestSrc_GetPixelFormat(IWICBitmapSource *iface, WICPixelFormatGUID *pPixelFormat)
Definition: converter.c:103
static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
Definition: converter.c:215
static const WCHAR wszInterlaceOption[]
Definition: converter.c:788
static const struct bitmap_data testdata_32bppPRGBA
Definition: converter.c:525
static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, const BYTE *converted_bits)
Definition: converter.c:234
static const BYTE bits_8bppGray_xp[]
Definition: converter.c:577
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:1741
static const struct bitmap_data testdata_32bppBGR
Definition: converter.c:465
static const BYTE bits_32bppBGR[]
Definition: converter.c:448
static void check_gif_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:1266
static unsigned be_uint(unsigned val)
Definition: converter.c:1164
static HRESULT WINAPI BitmapTestSrc_CopyPalette(IWICBitmapSource *iface, IWICPalette *palette)
Definition: converter.c:120
static const BYTE bits_4bppGray_xp[]
Definition: converter.c:565
static void test_multi_encoder_impl(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, BOOL set_size)
Definition: converter.c:1375
static const struct bitmap_data testdata_32bppGrayFloat
Definition: converter.c:562
static const float bits_32bppGrayFloat[]
Definition: converter.c:553
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
Definition: converter.c:1332
static ULONG WINAPI BitmapTestSrc_AddRef(IWICBitmapSource *iface)
Definition: converter.c:80
static const WCHAR wszChrominance[]
Definition: converter.c:793
static const struct bitmap_data testdata_64bppRGBA
Definition: converter.c:537
static const BYTE bits_4bpp[]
Definition: converter.c:399
static const IWICBitmapSourceVtbl BitmapTestSrc_Vtbl
Definition: converter.c:204
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 test_default_converter(void)
Definition: converter.c:677
static void test_encoder_rects(void)
Definition: converter.c:1781
static const struct bitmap_data testdata_8bppIndexed
Definition: converter.c:421
static const struct property_opt_test_data testdata_bmp_props[]
Definition: converter.c:820
static const BYTE bits_1bpp[]
Definition: converter.c:383
static const BYTE bits_24bppBGR_gray[]
Definition: converter.c:593
static const struct bitmap_data * single_frame[2]
Definition: converter.c:1818
static void DeleteTestBitmap(BitmapTestSrc *This)
Definition: converter.c:227
static const struct bitmap_data testdata_8bppIndexed_4colors
Definition: converter.c:415
static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WICPixelFormatGUID *format)
Definition: converter.c:1300
static IWICImagingFactory * factory
Definition: converter.c:33
static const WCHAR wszBitmapTransform[]
Definition: converter.c:791
static const WCHAR wszEnableV5Header32bppBGRA[]
Definition: converter.c:796
static const struct bitmap_data * multiple_frames[3]
Definition: converter.c:1813
static HRESULT WINAPI BitmapTestSrc_GetSize(IWICBitmapSource *iface, UINT *puiWidth, UINT *puiHeight)
Definition: converter.c:94
static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:975
HRESULT STDMETHODCALLTYPE IWICBitmapFrameEncode_WriteSource_Proxy(IWICBitmapFrameEncode *This, IWICBitmapSource *pIBitmapSource, WICRect *prc)
static const BYTE bits_8bpp[]
Definition: converter.c:418
static const BYTE bits_8bpp_4colors[]
Definition: converter.c:412
static const BYTE bits_32bppBGRA[]
Definition: converter.c:472
static const WORD bits_64bppRGBA_2[]
Definition: converter.c:632
static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
Definition: converter.c:639
static const BYTE bits_8bppGray[]
Definition: converter.c:585
static void test_converter_8bppGray(void)
Definition: converter.c:743
#define EXPECT_REF(obj, ref)
Definition: converter.c:1331
static const BYTE bits_32bppRGBA[]
Definition: converter.c:489
static const struct bitmap_data testdata_32bppBGRA80
Definition: converter.c:467
static const struct bitmap_data testdata_4bppGray
Definition: converter.c:574
static const BYTE bits_24bppRGB[]
Definition: converter.c:436
static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:1176
static void test_invalid_conversion(void)
Definition: converter.c:662
static void test_specific_encoder_properties(IPropertyBag2 *options, const property_opt_test_data *data, PROPBAG2 *all_props, int all_prop_cnt)
Definition: converter.c:836
#define TO_16bppBGRA5551(b, g, r, a)
Definition: converter.c:605
static HRESULT WINAPI BitmapTestSrc_QueryInterface(IWICBitmapSource *iface, REFIID iid, void **ppv)
Definition: converter.c:65
static BOOL near_equal(float a, float b)
Definition: converter.c:55
static const struct bitmap_data testdata_24bppRGB
Definition: converter.c:445
static const struct bitmap_data testdata_16bppBGRA5551
Definition: converter.c:622
static ULONG WINAPI BitmapTestSrc_Release(IWICBitmapSource *iface)
Definition: converter.c:87
static const WORD bits_16bppBGRA5551[]
Definition: converter.c:612
static const struct bitmap_data testdata_2bppIndexed
Definition: converter.c:395
static const float bits_32bppGrayFloat_xp[]
Definition: converter.c:541
static const struct bitmap_data testdata_32bppBGRA
Definition: converter.c:499
static BitmapTestSrc * impl_from_IWICBitmapSource(IWICBitmapSource *iface)
Definition: converter.c:60
static const WCHAR wszCompressionQuality[]
Definition: converter.c:787
static const struct property_opt_test_data testdata_png_props[]
Definition: converter.c:804
static const struct bitmap_data testdata_32bppRGB
Definition: converter.c:503
static const BYTE bits_64bppRGBA[]
Definition: converter.c:528
static const BYTE bits_24bppBGR[]
Definition: converter.c:424
static const struct bitmap_data testdata_1bppIndexed
Definition: converter.c:388
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:1749
static const struct bitmap_data testdata_24bppBGR
Definition: converter.c:433
static const struct bitmap_data testdata_32bppRGBA80
Definition: converter.c:469
static void load_stream(IUnknown *reader, IStream *stream)
Definition: converter.c:961
static const struct bitmap_data testdata_8bppGray_xp
Definition: converter.c:582
static const WCHAR wszSuppressApp0[]
Definition: converter.c:795
static void test_converter_8bppIndexed(void)
Definition: converter.c:1827
static const BYTE bits_4bppGray[]
Definition: converter.c:571
static const struct property_opt_test_data testdata_tiff_props[]
Definition: converter.c:798
static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
Definition: converter.c:1096
static const WORD bits_48bppRGB[]
Definition: converter.c:625
static const WCHAR wszFilterOption[]
Definition: converter.c:789
static const WCHAR wszLuminance[]
Definition: converter.c:792
static const WCHAR wszJpegYCrCbSubsampling[]
Definition: converter.c:794
static const WCHAR wszTiffCompressionMethod[]
Definition: converter.c:786
static const BYTE bits_2bpp[]
Definition: converter.c:392
static const struct bitmap_data testdata_64bppRGBA_2
Definition: converter.c:636
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
_Out_ LPRECT prc
Definition: ntgdi.h:1658
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_VT(A)
Definition: oleauto.h:211
#define V_UNION(A, B)
Definition: oleauto.h:212
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define png_IHDR
Definition: pngpriv.h:841
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define equal(x, y)
Definition: reader.cc:56
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
const char * winetest_platform
int winetest_debug
#define win_skip
Definition: test.h:164
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
const bitmap_data * data
Definition: converter.c:49
IWICBitmapSource IWICBitmapSource_iface
Definition: converter.c:47
INT Height
Definition: wincodec.idl:335
INT Width
Definition: wincodec.idl:334
double xres
Definition: converter.c:41
UINT bpp
Definition: converter.c:37
const BYTE * bits
Definition: converter.c:38
UINT width
Definition: converter.c:39
UINT height
Definition: converter.c:40
const WICPixelFormatGUID * format
Definition: converter.c:36
const struct bitmap_data * alt_data
Definition: converter.c:43
double yres
Definition: converter.c:42
Definition: main.c:439
Definition: format.c:58
Definition: parser.c:49
Definition: name.c:39
Definition: reader.h:84
Definition: send.c:48
void * value
Definition: converter.c:1328
PROPBAG2_TYPE type
Definition: converter.c:1326
VARTYPE vt
Definition: converter.c:1327
const WCHAR * name
Definition: converter.c:1325
Definition: parse.h:23
Definition: ecma_167.h:138
Definition: tiffiop.h:115
#define MAKEWORD(a, b)
Definition: typedefs.h:248
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:96
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
int ret
#define GMEM_MOVEABLE
Definition: winbase.h:320
@ WICBitmapEncoderNoCache
Definition: wincodec.idl:73
@ WICBitmapTransformRotate0
Definition: wincodec.idl:110
@ WICPngFilterUnspecified
Definition: wincodec.idl:181
@ WICTiffCompressionDontCare
Definition: wincodec.idl:169
@ WICBitmapDitherTypeNone
Definition: wincodec.idl:57
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:29
@ WICBitmapPaletteTypeFixedHalftone256
Definition: wincodec.idl:102
@ WICBitmapPaletteTypeCustom
Definition: wincodec.idl:92
@ WICBitmapPaletteTypeFixedBW
Definition: wincodec.idl:94
@ WICBitmapPaletteTypeFixedHalftone64
Definition: wincodec.idl:97
@ WICBitmapPaletteTypeFixedGray16
Definition: wincodec.idl:104
@ WICBitmapPaletteTypeMedianCut
Definition: wincodec.idl:93
@ WICBitmapPaletteTypeFixedHalftone8
Definition: wincodec.idl:95
UINT32 WICColor
Definition: wincodec.idl:364
@ WICJpegYCrCbSubsamplingDefault
Definition: wincodec.idl:151
#define WINAPI
Definition: msvc.h:6
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3296
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3281
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
Definition: winerror.h:3308
#define WINCODEC_ERR_NOTINITIALIZED
Definition: winerror.h:3285
#define E_NOINTERFACE
Definition: winerror.h:2364
#define WINCODEC_ERR_UNEXPECTEDSIZE
Definition: winerror.h:3314
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3292
#define WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS
Definition: winerror.h:3295
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_ARITHMETIC_OVERFLOW
Definition: winerror.h:351
#define WINCODEC_ERR_VALUEOUTOFRANGE
Definition: winerror.h:3282
#define WINCODEC_ERR_FRAMEMISSING
Definition: winerror.h:3301
#define WINCODEC_ERR_PROPERTYNOTFOUND
Definition: winerror.h:3287
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193