ReactOS 0.4.16-dev-974-g5022a45
bmpdecode.c
Go to the documentation of this file.
1/*
2 * Copyright 2009 Vincent Povirk for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include <assert.h>
20#include <stdarg.h>
21
22#define COBJMACROS
23
24#include "windef.h"
25#include "winbase.h"
26#include "winreg.h"
27#include "wingdi.h"
28#include "objbase.h"
29
30#include "wincodecs_private.h"
31
32#include "wine/debug.h"
33
35
36typedef struct {
48 /* same as BITMAPINFOHEADER until this point */
58
60
61struct BmpDecoder {
69 BITMAPV5HEADER bih;
76 CRITICAL_SECTION lock; /* must be held when initialized/imagedata is set or stream is accessed */
77 int packed; /* If TRUE, don't look for a file header and assume a packed DIB. */
78 int icoframe; /* If TRUE, this is a frame of a .ico file. */
79};
80
82{
83 return CONTAINING_RECORD(iface, BmpDecoder, IWICBitmapDecoder_iface);
84}
85
87{
88 return CONTAINING_RECORD(iface, BmpDecoder, IWICBitmapFrameDecode_iface);
89}
90
92 void **ppv)
93{
95
96 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
97
98 if (!ppv) return E_INVALIDARG;
99
100 if (IsEqualIID(&IID_IUnknown, iid) ||
101 IsEqualIID(&IID_IWICBitmapSource, iid) ||
102 IsEqualIID(&IID_IWICBitmapFrameDecode, iid))
103 {
104 *ppv = &This->IWICBitmapFrameDecode_iface;
105 }
106 else
107 {
108 *ppv = NULL;
109 return E_NOINTERFACE;
110 }
111
112 IUnknown_AddRef((IUnknown*)*ppv);
113 return S_OK;
114}
115
117{
119
120 return IWICBitmapDecoder_AddRef(&This->IWICBitmapDecoder_iface);
121}
122
124{
126
127 return IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
128}
129
131 UINT *puiWidth, UINT *puiHeight)
132{
134 TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
135
136 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
137 {
139 *puiWidth = bch->bcWidth;
140 *puiHeight = bch->bcHeight;
141 }
142 else
143 {
144 *puiWidth = This->bih.bV5Width;
145 *puiHeight = abs(This->bih.bV5Height);
146 }
147 return S_OK;
148}
149
151 WICPixelFormatGUID *pPixelFormat)
152{
154 TRACE("(%p,%p)\n", iface, pPixelFormat);
155
156 memcpy(pPixelFormat, This->pixelformat, sizeof(GUID));
157
158 return S_OK;
159}
160
161static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, double *pDpiY)
162{
163 LONG resx = 0, resy = 0;
164
165 switch (bih->bV5Size)
166 {
167 default:
168 case sizeof(BITMAPCOREHEADER):
169 break;
170
171 case sizeof(BITMAPCOREHEADER2):
172 case sizeof(BITMAPINFOHEADER):
173 case sizeof(BITMAPV4HEADER):
174 case sizeof(BITMAPV5HEADER):
175 resx = bih->bV5XPelsPerMeter;
176 resy = bih->bV5YPelsPerMeter;
177 break;
178 }
179
180 if (!resx || !resy)
181 {
182 *pDpiX = 96.0;
183 *pDpiY = 96.0;
184 }
185 else
186 {
187 *pDpiX = resx * 0.0254;
188 *pDpiY = resy * 0.0254;
189 }
190
191 return S_OK;
192}
193
195 double *pDpiX, double *pDpiY)
196{
198 TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
199
200 return BmpHeader_GetResolution(&This->bih, pDpiX, pDpiY);
201}
202
204 IWICPalette *pIPalette)
205{
206 HRESULT hr;
208 int count;
209 WICColor *wiccolors=NULL;
210 RGBTRIPLE *bgrcolors=NULL;
211
212 TRACE("(%p,%p)\n", iface, pIPalette);
213
215
216 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
217 {
219 if (bch->bcBitCount <= 8)
220 {
221 /* 2**n colors in BGR format after the header */
222 ULONG tablesize, bytesread;
224 int i;
225
226 count = 1 << bch->bcBitCount;
227 wiccolors = malloc(sizeof(WICColor) * count);
228 tablesize = sizeof(RGBTRIPLE) * count;
229 bgrcolors = malloc(tablesize);
230 if (!wiccolors || !bgrcolors)
231 {
233 goto end;
234 }
235
236 offset.QuadPart = This->palette_offset;
237 hr = IStream_Seek(This->stream, offset, STREAM_SEEK_SET, NULL);
238 if (FAILED(hr)) goto end;
239
240 hr = IStream_Read(This->stream, bgrcolors, tablesize, &bytesread);
241 if (FAILED(hr)) goto end;
242 if (bytesread != tablesize) {
243 hr = E_FAIL;
244 goto end;
245 }
246
247 for (i=0; i<count; i++)
248 {
249 wiccolors[i] = 0xff000000|
250 (bgrcolors[i].rgbtRed<<16)|
251 (bgrcolors[i].rgbtGreen<<8)|
252 bgrcolors[i].rgbtBlue;
253 }
254 }
255 else
256 {
258 goto end;
259 }
260 }
261 else
262 {
263 if (This->bih.bV5BitCount <= 8)
264 {
265 ULONG tablesize, bytesread;
267 int i;
268
269 if (This->bih.bV5ClrUsed == 0)
270 count = 1 << This->bih.bV5BitCount;
271 else
272 count = min(This->bih.bV5ClrUsed, 1 << This->bih.bV5BitCount);
273
274 tablesize = sizeof(WICColor) * count;
275 wiccolors = malloc(tablesize);
276 if (!wiccolors)
277 {
279 goto end;
280 }
281
282 offset.QuadPart = This->palette_offset;
283 hr = IStream_Seek(This->stream, offset, STREAM_SEEK_SET, NULL);
284 if (FAILED(hr)) goto end;
285
286 hr = IStream_Read(This->stream, wiccolors, tablesize, &bytesread);
287 if (FAILED(hr)) goto end;
288 if (bytesread != tablesize) {
289 hr = E_FAIL;
290 goto end;
291 }
292
293 /* convert from BGR to BGRA by setting alpha to 100% */
294 for (i=0; i<count; i++)
295 wiccolors[i] |= 0xff000000;
296 }
297 else
298 {
300 goto end;
301 }
302 }
303
304end:
305
307
308 if (SUCCEEDED(hr))
309 hr = IWICPalette_InitializeCustom(pIPalette, wiccolors, count);
310
311 free(wiccolors);
312 free(bgrcolors);
313 return hr;
314}
315
317 const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
318{
322 TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
323
325 if (!This->imagedata)
326 {
327 hr = This->read_data_func(This);
328 }
330 if (FAILED(hr)) return hr;
331
333 if (FAILED(hr)) return hr;
334
335 return copy_pixels(This->bitsperpixel, This->imagedatastart,
336 width, height, This->stride,
337 prc, cbStride, cbBufferSize, pbBuffer);
338}
339
341 IWICMetadataQueryReader **ppIMetadataQueryReader)
342{
343 TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
345}
346
348 UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
349{
350 TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
352}
353
355 IWICBitmapSource **ppIThumbnail)
356{
357 TRACE("(%p,%p)\n", iface, ppIThumbnail);
359}
360
362{
363 UINT bytesperrow;
366 int bottomup;
367 HRESULT hr;
368 LARGE_INTEGER offbits;
369 ULONG bytesread;
370
371 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
372 {
374 width = bch->bcWidth;
375 height = bch->bcHeight;
376 bottomup = 1;
377 }
378 else
379 {
380 width = This->bih.bV5Width;
381 height = abs(This->bih.bV5Height);
382 bottomup = (This->bih.bV5Height > 0);
383 }
384
385 /* row sizes in BMP files must be divisible by 4 bytes */
386 bytesperrow = (((width * This->bitsperpixel)+31)/32)*4;
387 datasize = bytesperrow * height;
388
389 This->imagedata = malloc(datasize);
390 if (!This->imagedata) return E_OUTOFMEMORY;
391
392 offbits.QuadPart = This->image_offset;
393 hr = IStream_Seek(This->stream, offbits, STREAM_SEEK_SET, NULL);
394 if (FAILED(hr)) goto fail;
395
396 hr = IStream_Read(This->stream, This->imagedata, datasize, &bytesread);
397 if (FAILED(hr) || bytesread != datasize) goto fail;
398
399 if (bottomup)
400 {
401 This->imagedatastart = This->imagedata + (height-1) * bytesperrow;
402 This->stride = -bytesperrow;
403 }
404 else
405 {
406 This->imagedatastart = This->imagedata;
407 This->stride = bytesperrow;
408 }
409 return S_OK;
410
411fail:
412 free(This->imagedata);
413 This->imagedata = NULL;
414 if (SUCCEEDED(hr)) hr = E_FAIL;
415 return hr;
416}
417
419{
420 UINT x, y, width, height;
421 BYTE *pixel;
422 HRESULT hr;
423
424 hr = IWICBitmapFrameDecode_GetSize(&This->IWICBitmapFrameDecode_iface, &width, &height);
425
426 if (SUCCEEDED(hr))
427 {
429 }
430
431 if (SUCCEEDED(hr))
432 {
433 for (y = 0; y < height; y++)
434 {
435 pixel = This->imagedatastart + This->stride * (INT)y;
436
437 for (x = 0; x < width; x++)
438 {
439 pixel[0] = pixel[1];
440 pixel[1] = pixel[2];
441 pixel[2] = pixel[3];
442 pixel[3] = 0;
443 pixel += 4;
444 }
445 }
446 }
447
448 return hr;
449}
450
452{
453 HRESULT hr;
455
456 hr = IWICBitmapFrameDecode_GetSize(&This->IWICBitmapFrameDecode_iface, &width, &height);
457
458 if (SUCCEEDED(hr))
459 {
461 }
462
463 if (SUCCEEDED(hr))
464 {
465 reverse_bgr8(This->bitsperpixel/8, This->imagedatastart,
466 width, height, This->stride);
467 }
468
469 return hr;
470}
471
473 ULONG *cursor, ULONG *bytesread, BYTE *result)
474{
476
477 if (*bytesread == 0 || *cursor == *bytesread)
478 {
479 hr = IStream_Read(stream, buffer, buffer_size, bytesread);
480 *cursor = 0;
481 }
482
483 if (SUCCEEDED(hr))
484 {
485 if (*cursor < *bytesread)
486 *result = buffer[(*cursor)++];
487 else
488 hr = E_FAIL;
489 }
490
491 return hr;
492}
493
495{
496 UINT bytesperrow;
498 BYTE rledata[4096];
499 UINT datasize, palettesize;
500 DWORD palette[256];
501 UINT x, y;
502 DWORD *bgrdata;
503 HRESULT hr;
504 LARGE_INTEGER offbits;
505 ULONG cursor=0, bytesread=0;
506
507 width = This->bih.bV5Width;
508 height = abs(This->bih.bV5Height);
509 bytesperrow = width * 4;
510 datasize = bytesperrow * height;
511 if (This->bih.bV5ClrUsed && This->bih.bV5ClrUsed < 256)
512 palettesize = 4 * This->bih.bV5ClrUsed;
513 else
514 palettesize = 4 * 256;
515
516 This->imagedata = malloc(datasize);
517 if (!This->imagedata)
518 {
520 goto fail;
521 }
522
523 /* read palette */
524 offbits.QuadPart = This->palette_offset;
525 hr = IStream_Seek(This->stream, offbits, STREAM_SEEK_SET, NULL);
526 if (FAILED(hr)) goto fail;
527
528 hr = IStream_Read(This->stream, palette, palettesize, &bytesread);
529 if (FAILED(hr) || bytesread != palettesize) goto fail;
530
531 /* read RLE data */
532 offbits.QuadPart = This->image_offset;
533 hr = IStream_Seek(This->stream, offbits, STREAM_SEEK_SET, NULL);
534 if (FAILED(hr)) goto fail;
535
536 /* decode RLE */
537 bgrdata = (DWORD*)This->imagedata;
538 x = 0;
539 y = 0;
540 cursor = 0;
541 bytesread = 0;
542 while (y < height)
543 {
544 BYTE length;
545 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &length);
546
547 if (FAILED(hr))
548 goto fail;
549 else if (length == 0)
550 {
551 /* escape code */
552 BYTE escape;
553 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &escape);
554 if (FAILED(hr))
555 goto fail;
556 switch(escape)
557 {
558 case 0: /* end of line */
559 x = 0;
560 y++;
561 break;
562 case 1: /* end of bitmap */
563 goto end;
564 case 2: /* delta */
565 {
566 BYTE dx, dy;
567 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &dx);
568 if (SUCCEEDED(hr))
569 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &dy);
570 if (FAILED(hr))
571 goto fail;
572 x += dx;
573 y += dy;
574 break;
575 }
576 default: /* absolute mode */
577 length = escape;
578 while (length-- && x < width)
579 {
580 BYTE index;
581 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &index);
582 if (FAILED(hr))
583 goto fail;
584 bgrdata[y*width + x++] = palette[index];
585 }
586 if (escape & 1)
587 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &length); /* skip pad byte */
588 if (FAILED(hr))
589 goto fail;
590 }
591 }
592 else
593 {
594 BYTE index;
595 DWORD color;
596 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &index);
597 if (FAILED(hr))
598 goto fail;
600 while (length-- && x < width)
601 bgrdata[y*width + x++] = color;
602 }
603 }
604
605end:
606 This->imagedatastart = This->imagedata + (height-1) * bytesperrow;
607 This->stride = -bytesperrow;
608
609 return S_OK;
610
611fail:
612 free(This->imagedata);
613 This->imagedata = NULL;
614 if (SUCCEEDED(hr)) hr = E_FAIL;
615 return hr;
616}
617
619{
620 UINT bytesperrow;
622 BYTE rledata[4096];
623 UINT datasize, palettesize;
624 DWORD palette[16];
625 UINT x, y;
626 DWORD *bgrdata;
627 HRESULT hr;
628 LARGE_INTEGER offbits;
629 ULONG cursor=0, bytesread=0;
630
631 width = This->bih.bV5Width;
632 height = abs(This->bih.bV5Height);
633 bytesperrow = width * 4;
634 datasize = bytesperrow * height;
635 if (This->bih.bV5ClrUsed && This->bih.bV5ClrUsed < 16)
636 palettesize = 4 * This->bih.bV5ClrUsed;
637 else
638 palettesize = 4 * 16;
639
640 This->imagedata = malloc(datasize);
641 if (!This->imagedata)
642 {
644 goto fail;
645 }
646
647 /* read palette */
648 offbits.QuadPart = This->palette_offset;
649 hr = IStream_Seek(This->stream, offbits, STREAM_SEEK_SET, NULL);
650 if (FAILED(hr)) goto fail;
651
652 hr = IStream_Read(This->stream, palette, palettesize, &bytesread);
653 if (FAILED(hr) || bytesread != palettesize) goto fail;
654
655 /* read RLE data */
656 offbits.QuadPart = This->image_offset;
657 hr = IStream_Seek(This->stream, offbits, STREAM_SEEK_SET, NULL);
658 if (FAILED(hr)) goto fail;
659
660 /* decode RLE */
661 bgrdata = (DWORD*)This->imagedata;
662 x = 0;
663 y = 0;
664 cursor = 0;
665 bytesread = 0;
666 while (y < height)
667 {
668 BYTE length;
669 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &length);
670
671 if (FAILED(hr))
672 goto fail;
673 else if (length == 0)
674 {
675 /* escape code */
676 BYTE escape;
677 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &escape);
678 if (FAILED(hr))
679 goto fail;
680 switch(escape)
681 {
682 case 0: /* end of line */
683 x = 0;
684 y++;
685 break;
686 case 1: /* end of bitmap */
687 goto end;
688 case 2: /* delta */
689 {
690 BYTE dx, dy;
691 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &dx);
692 if (SUCCEEDED(hr))
693 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &dy);
694 if (FAILED(hr))
695 goto fail;
696 x += dx;
697 y += dy;
698 break;
699 }
700 default: /* absolute mode */
701 {
702 BYTE realsize=0;
703 length = escape;
704 while (length-- && x < width)
705 {
706 BYTE colors;
707 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &colors);
708 realsize++;
709 if (FAILED(hr))
710 goto fail;
711 bgrdata[y*width + x++] = palette[colors>>4];
712 if (length-- && x < width)
713 bgrdata[y*width + x++] = palette[colors&0xf];
714 else
715 break;
716 }
717 if (realsize & 1)
718 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &length); /* skip pad byte */
719 if (FAILED(hr))
720 goto fail;
721 }
722 }
723 }
724 else
725 {
726 BYTE colors;
727 DWORD color1;
728 DWORD color2;
729 hr = ReadByte(This->stream, rledata, 4096, &cursor, &bytesread, &colors);
730 if (FAILED(hr))
731 goto fail;
732 color1 = palette[colors>>4];
733 color2 = palette[colors&0xf];
734 while (length-- && x < width)
735 {
736 bgrdata[y*width + x++] = color1;
737 if (length-- && x < width)
738 bgrdata[y*width + x++] = color2;
739 else
740 break;
741 }
742 }
743 }
744
745end:
746 This->imagedatastart = This->imagedata + (height-1) * bytesperrow;
747 This->stride = -bytesperrow;
748
749 return S_OK;
750
751fail:
752 free(This->imagedata);
753 This->imagedata = NULL;
754 if (SUCCEEDED(hr)) hr = E_FAIL;
755 return hr;
756}
757
759{
760 return E_FAIL;
761}
762
764 WORD bitcount; /* 0 for end of list */
771};
772
773static const struct bitfields_format bitfields_formats[] = {
774 {16,0x7c00,0x3e0,0x1f,0,&GUID_WICPixelFormat16bppBGR555,BmpFrameDecode_ReadUncompressed},
775 {16,0xf800,0x7e0,0x1f,0,&GUID_WICPixelFormat16bppBGR565,BmpFrameDecode_ReadUncompressed},
776 {32,0xff0000,0xff00,0xff,0,&GUID_WICPixelFormat32bppBGR,BmpFrameDecode_ReadUncompressed},
777 {32,0xff0000,0xff00,0xff,0xff000000,&GUID_WICPixelFormat32bppBGRA,BmpFrameDecode_ReadUncompressed},
778 {32,0xff000000,0xff0000,0xff00,0xff,&GUID_WICPixelFormat32bppBGR,BmpFrameDecode_ReadABGRasBGR},
779 {32,0xff,0xff00,0xff0000,0,&GUID_WICPixelFormat32bppBGR,BmpFrameDecode_ReadRGB8},
780 {0}
781};
782
783static const IWICBitmapFrameDecodeVtbl BmpDecoder_FrameVtbl = {
795};
796
798{
799 HRESULT hr;
800 ULONG bytestoread, bytesread;
802
803 if (This->initialized) return WINCODEC_ERR_WRONGSTATE;
804
805 seek.QuadPart = 0;
806 hr = IStream_Seek(stream, seek, STREAM_SEEK_SET, NULL);
807 if (FAILED(hr)) return hr;
808
809 if (!This->packed)
810 {
812 hr = IStream_Read(stream, &bfh, sizeof(BITMAPFILEHEADER), &bytesread);
813 if (FAILED(hr)) return hr;
814 if (bytesread != sizeof(BITMAPFILEHEADER) ||
815 bfh.bfType != 0x4d42 /* "BM" */) return E_FAIL;
816 This->image_offset = bfh.bfOffBits;
817 }
818
819 hr = IStream_Read(stream, &This->bih.bV5Size, sizeof(DWORD), &bytesread);
820 if (FAILED(hr)) return hr;
821 if (bytesread != sizeof(DWORD) ||
822 (This->bih.bV5Size != sizeof(BITMAPCOREHEADER) &&
823 This->bih.bV5Size != sizeof(BITMAPCOREHEADER2) &&
824 This->bih.bV5Size != sizeof(BITMAPINFOHEADER) &&
825 This->bih.bV5Size != sizeof(BITMAPV4HEADER) &&
826 This->bih.bV5Size != sizeof(BITMAPV5HEADER))) return E_FAIL;
827
828 bytestoread = This->bih.bV5Size-sizeof(DWORD);
829 hr = IStream_Read(stream, &This->bih.bV5Width, bytestoread, &bytesread);
830 if (FAILED(hr)) return hr;
831 if (bytestoread != bytesread) return E_FAIL;
832
833 if (This->packed)
834 This->palette_offset = This->bih.bV5Size;
835 else
836 This->palette_offset = sizeof(BITMAPFILEHEADER) + This->bih.bV5Size;
837
838 if (This->icoframe)
839 {
840 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
841 {
843 bch->bcHeight /= 2;
844 }
845 else
846 {
847 This->bih.bV5Height /= 2;
848 }
849 }
850
851 /* if this is a BITMAPINFOHEADER with BI_BITFIELDS compression, we need to
852 read the extra fields */
853 if (This->bih.bV5Size == sizeof(BITMAPINFOHEADER) &&
854 This->bih.bV5Compression == BI_BITFIELDS)
855 {
856 hr = IStream_Read(stream, &This->bih.bV5RedMask, 12, &bytesread);
857 if (FAILED(hr)) return hr;
858 if (bytesread != 12) return E_FAIL;
859 This->bih.bV5AlphaMask = 0;
860 This->palette_offset += 12;
861 }
862
863 /* decide what kind of bitmap this is and how/if we can read it */
864 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
865 {
867 TRACE("BITMAPCOREHEADER with depth=%i\n", bch->bcBitCount);
868 This->bitsperpixel = bch->bcBitCount;
869 This->read_data_func = BmpFrameDecode_ReadUncompressed;
870 switch(bch->bcBitCount)
871 {
872 case 1:
873 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
874 break;
875 case 2:
876 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
877 break;
878 case 4:
879 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
880 break;
881 case 8:
882 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
883 break;
884 case 24:
885 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
886 break;
887 default:
888 This->pixelformat = &GUID_WICPixelFormatUndefined;
889 WARN("unsupported bit depth %i for BITMAPCOREHEADER\n", bch->bcBitCount);
890 break;
891 }
892 }
893 else /* struct is compatible with BITMAPINFOHEADER */
894 {
895 TRACE("bitmap header=%li compression=%li depth=%i\n", This->bih.bV5Size, This->bih.bV5Compression, This->bih.bV5BitCount);
896 switch(This->bih.bV5Compression)
897 {
898 case BI_RGB:
899 This->bitsperpixel = This->bih.bV5BitCount;
900 This->read_data_func = BmpFrameDecode_ReadUncompressed;
901 switch(This->bih.bV5BitCount)
902 {
903 case 1:
904 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
905 break;
906 case 2:
907 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
908 break;
909 case 4:
910 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
911 break;
912 case 8:
913 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
914 break;
915 case 16:
916 This->pixelformat = &GUID_WICPixelFormat16bppBGR555;
917 break;
918 case 24:
919 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
920 break;
921 case 32:
922 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
923 break;
924 default:
925 This->pixelformat = &GUID_WICPixelFormatUndefined;
926 FIXME("unsupported bit depth %i for uncompressed RGB\n", This->bih.bV5BitCount);
927 }
928 break;
929 case BI_RLE8:
930 This->bitsperpixel = 32;
931 This->read_data_func = BmpFrameDecode_ReadRLE8;
932 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
933 break;
934 case BI_RLE4:
935 This->bitsperpixel = 32;
936 This->read_data_func = BmpFrameDecode_ReadRLE4;
937 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
938 break;
939 case BI_BITFIELDS:
940 {
941 const struct bitfields_format *format;
942 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER2))
943 {
944 /* BCH2 doesn't support bitfields; this is Huffman 1D compression */
945 This->bitsperpixel = 0;
946 This->read_data_func = BmpFrameDecode_ReadUnsupported;
947 This->pixelformat = &GUID_WICPixelFormatUndefined;
948 FIXME("Huffman 1D compression is unsupported\n");
949 break;
950 }
951 This->bitsperpixel = This->bih.bV5BitCount;
952 for (format = bitfields_formats; format->bitcount; format++)
953 {
954 if ((format->bitcount == This->bih.bV5BitCount) &&
955 (format->redmask == This->bih.bV5RedMask) &&
956 (format->greenmask == This->bih.bV5GreenMask) &&
957 (format->bluemask == This->bih.bV5BlueMask) &&
958 (format->alphamask == This->bih.bV5AlphaMask))
959 {
960 This->read_data_func = format->read_data_func;
961 This->pixelformat = format->pixelformat;
962 break;
963 }
964 }
965 if (!format->bitcount)
966 {
967 This->read_data_func = BmpFrameDecode_ReadUncompressed;
968 This->pixelformat = &GUID_WICPixelFormatUndefined;
969 FIXME("unsupported bitfields type depth=%i red=%lx green=%lx blue=%lx alpha=%lx\n",
970 This->bih.bV5BitCount, This->bih.bV5RedMask, This->bih.bV5GreenMask, This->bih.bV5BlueMask, This->bih.bV5AlphaMask);
971 }
972 break;
973 }
974 default:
975 This->bitsperpixel = 0;
976 This->read_data_func = BmpFrameDecode_ReadUnsupported;
977 This->pixelformat = &GUID_WICPixelFormatUndefined;
978 FIXME("unsupported bitmap type header=%li compression=%li depth=%i\n", This->bih.bV5Size, This->bih.bV5Compression, This->bih.bV5BitCount);
979 break;
980 }
981 }
982
983 if (This->packed)
984 {
985 /* In a packed DIB, the image follows the palette. */
986 ULONG palette_count, palette_size;
987 if (This->bih.bV5ClrUsed)
988 palette_count = This->bih.bV5ClrUsed;
989 else if (This->bih.bV5BitCount <= 8)
990 palette_count = 1 << This->bih.bV5BitCount;
991 else
992 palette_count = 0;
993 if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
994 palette_size = sizeof(RGBTRIPLE) * palette_count;
995 else
996 palette_size = sizeof(RGBQUAD) * palette_count;
997 This->image_offset = This->palette_offset + palette_size;
998 }
999
1000 This->initialized = TRUE;
1001
1002 return S_OK;
1003}
1004
1006 void **ppv)
1007{
1009 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
1010
1011 if (!ppv) return E_INVALIDARG;
1012
1013 if (IsEqualIID(&IID_IUnknown, iid) ||
1014 IsEqualIID(&IID_IWICBitmapDecoder, iid))
1015 {
1016 *ppv = &This->IWICBitmapDecoder_iface;
1017 }
1018 else
1019 {
1020 *ppv = NULL;
1021 return E_NOINTERFACE;
1022 }
1023
1024 IUnknown_AddRef((IUnknown*)*ppv);
1025 return S_OK;
1026}
1027
1029{
1032
1033 TRACE("(%p) refcount=%lu\n", iface, ref);
1034
1035 return ref;
1036}
1037
1039{
1042
1043 TRACE("(%p) refcount=%lu\n", iface, ref);
1044
1045 if (ref == 0)
1046 {
1047 if (This->stream) IStream_Release(This->stream);
1048 free(This->imagedata);
1049 This->lock.DebugInfo->Spare[0] = 0;
1051 free(This);
1052 }
1053
1054 return ref;
1055}
1056
1058 DWORD *capability)
1059{
1060 HRESULT hr;
1062
1063 TRACE("(%p,%p,%p)\n", iface, stream, capability);
1064
1065 if (!stream || !capability) return E_INVALIDARG;
1066
1067 hr = IWICBitmapDecoder_Initialize(iface, stream, WICDecodeMetadataCacheOnDemand);
1068 if (hr != S_OK) return hr;
1069
1071 return S_OK;
1072}
1073
1075 WICDecodeOptions cacheOptions)
1076{
1077 HRESULT hr;
1079
1080 EnterCriticalSection(&This->lock);
1081 hr = BmpDecoder_ReadHeaders(This, pIStream);
1082
1083 if (SUCCEEDED(hr))
1084 {
1085 This->stream = pIStream;
1086 IStream_AddRef(pIStream);
1087 }
1088 LeaveCriticalSection(&This->lock);
1089
1090 return hr;
1091}
1092
1094 GUID *pguidContainerFormat)
1095{
1096 memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID));
1097 return S_OK;
1098}
1099
1101 IWICBitmapDecoderInfo **ppIDecoderInfo)
1102{
1103 TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
1104
1105 return get_decoder_info(&CLSID_WICBmpDecoder, ppIDecoderInfo);
1106}
1107
1109 IWICPalette *pIPalette)
1110{
1111 TRACE("(%p,%p)\n", iface, pIPalette);
1112
1114}
1115
1117 IWICMetadataQueryReader **ppIMetadataQueryReader)
1118{
1119 TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
1121}
1122
1124 IWICBitmapSource **ppIBitmapSource)
1125{
1126 TRACE("(%p,%p)\n", iface, ppIBitmapSource);
1128}
1129
1131 UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
1132{
1133 TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
1135}
1136
1138 IWICBitmapSource **ppIThumbnail)
1139{
1140 TRACE("(%p,%p)\n", iface, ppIThumbnail);
1142}
1143
1145 UINT *pCount)
1146{
1147 if (!pCount) return E_INVALIDARG;
1148
1149 *pCount = 1;
1150 return S_OK;
1151}
1152
1154 UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
1155{
1157
1158 if (index != 0) return E_INVALIDARG;
1159
1160 if (!This->stream) return WINCODEC_ERR_FRAMEMISSING;
1161
1162 *ppIBitmapFrame = &This->IWICBitmapFrameDecode_iface;
1163 IWICBitmapDecoder_AddRef(iface);
1164
1165 return S_OK;
1166}
1167
1168static const IWICBitmapDecoderVtbl BmpDecoder_Vtbl = {
1183};
1184
1185static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecoder)
1186{
1188
1189 This = malloc(sizeof(BmpDecoder));
1190 if (!This) return E_OUTOFMEMORY;
1191
1192 This->IWICBitmapDecoder_iface.lpVtbl = &BmpDecoder_Vtbl;
1193 This->IWICBitmapFrameDecode_iface.lpVtbl = &BmpDecoder_FrameVtbl;
1194 This->ref = 1;
1195 This->initialized = FALSE;
1196 This->stream = NULL;
1197 This->imagedata = NULL;
1198#ifdef __REACTOS__
1200#else
1202#endif
1203 This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BmpDecoder.lock");
1204 This->packed = packed;
1205 This->icoframe = icoframe;
1206
1207 *ppDecoder = This;
1208
1209 return S_OK;
1210}
1211
1212static HRESULT BmpDecoder_Construct(int packed, int icoframe, REFIID iid, void** ppv)
1213{
1215 HRESULT ret;
1216
1217 TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
1218
1219 *ppv = NULL;
1220
1221 ret = BmpDecoder_Create(packed, icoframe, &This);
1222 if (FAILED(ret)) return ret;
1223
1224 ret = IWICBitmapDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv);
1225 IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
1226
1227 return ret;
1228}
1229
1231{
1232 return BmpDecoder_Construct(FALSE, FALSE, iid, ppv);
1233}
1234
1236{
1237 return BmpDecoder_Construct(TRUE, FALSE, iid, ppv);
1238}
1239
1241{
1242 return BmpDecoder_Create(TRUE, TRUE, ppDecoder);
1243}
1244
1246{
1247 *ppDecoder = &This->IWICBitmapDecoder_iface;
1248}
1249
1250/* Return the offset where the mask of an icon might be, or 0 for failure. */
1251void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown)
1252{
1253 assert(This->stream != NULL);
1254
1255 if (This->read_data_func == BmpFrameDecode_ReadUncompressed)
1256 {
1257 /* RGB or BITFIELDS data */
1258 UINT width, height;
1259 ULONG bytesperrow, datasize;
1260 IWICBitmapFrameDecode_GetSize(&This->IWICBitmapFrameDecode_iface, &width, &height);
1261 bytesperrow = (((width * This->bitsperpixel)+31)/32)*4;
1262 datasize = bytesperrow * height;
1263 *mask_offset = This->image_offset + datasize;
1264 }
1265 else
1266 *mask_offset = 0;
1267
1268 *topdown = This->stride > 0;
1269}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
static ULONG WINAPI BmpDecoder_AddRef(IWICBitmapDecoder *iface)
Definition: bmpdecode.c:1028
static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette)
Definition: bmpdecode.c:203
static HRESULT WINAPI BmpDecoder_GetContainerFormat(IWICBitmapDecoder *iface, GUID *pguidContainerFormat)
Definition: bmpdecode.c:1093
static HRESULT WINAPI BmpDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
Definition: bmpdecode.c:1130
static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface)
Definition: bmpdecode.c:1038
static HRESULT WINAPI BmpDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream, DWORD *capability)
Definition: bmpdecode.c:1057
HRESULT DibDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: bmpdecode.c:1235
static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, void **ppv)
Definition: bmpdecode.c:91
HRESULT(* ReadDataFunc)(BmpDecoder *This)
Definition: bmpdecode.c:59
static const IWICBitmapFrameDecodeVtbl BmpDecoder_FrameVtbl
Definition: bmpdecode.c:783
static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecoder)
Definition: bmpdecode.c:1185
static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder *This)
Definition: bmpdecode.c:494
static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *pIPalette)
Definition: bmpdecode.c:1108
static BmpDecoder * impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
Definition: bmpdecode.c:86
void BmpDecoder_GetWICDecoder(BmpDecoder *This, IWICBitmapDecoder **ppDecoder)
Definition: bmpdecode.c:1245
static HRESULT WINAPI BmpDecoder_GetFrame(IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
Definition: bmpdecode.c:1153
static HRESULT BmpFrameDecode_ReadABGRasBGR(BmpDecoder *This)
Definition: bmpdecode.c:418
void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown)
Definition: bmpdecode.c:1251
static HRESULT BmpDecoder_Construct(int packed, int icoframe, REFIID iid, void **ppv)
Definition: bmpdecode.c:1212
static HRESULT WINAPI BmpDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, void **ppv)
Definition: bmpdecode.c:1005
static const struct bitfields_format bitfields_formats[]
Definition: bmpdecode.c:773
static HRESULT BmpFrameDecode_ReadUnsupported(BmpDecoder *This)
Definition: bmpdecode.c:758
static HRESULT WINAPI BmpDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail)
Definition: bmpdecode.c:1137
static HRESULT WINAPI BmpDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream, WICDecodeOptions cacheOptions)
Definition: bmpdecode.c:1074
HRESULT BmpDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: bmpdecode.c:1230
static HRESULT WINAPI BmpDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
Definition: bmpdecode.c:1116
static HRESULT WINAPI BmpDecoder_GetFrameCount(IWICBitmapDecoder *iface, UINT *pCount)
Definition: bmpdecode.c:1144
static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY)
Definition: bmpdecode.c:194
static HRESULT BmpFrameDecode_ReadRGB8(BmpDecoder *This)
Definition: bmpdecode.c:451
static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder *This)
Definition: bmpdecode.c:361
HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder)
Definition: bmpdecode.c:1240
static const IWICBitmapDecoderVtbl BmpDecoder_Vtbl
Definition: bmpdecode.c:1168
static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder *This)
Definition: bmpdecode.c:618
static HRESULT WINAPI BmpFrameDecode_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail)
Definition: bmpdecode.c:354
static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo)
Definition: bmpdecode.c:1100
static ULONG WINAPI BmpFrameDecode_Release(IWICBitmapFrameDecode *iface)
Definition: bmpdecode.c:123
static HRESULT BmpDecoder_ReadHeaders(BmpDecoder *This, IStream *stream)
Definition: bmpdecode.c:797
static HRESULT WINAPI BmpFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader)
Definition: bmpdecode.c:340
static HRESULT ReadByte(IStream *stream, BYTE *buffer, ULONG buffer_size, ULONG *cursor, ULONG *bytesread, BYTE *result)
Definition: bmpdecode.c:472
static HRESULT WINAPI BmpDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource)
Definition: bmpdecode.c:1123
static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface, WICPixelFormatGUID *pPixelFormat)
Definition: bmpdecode.c:150
static BmpDecoder * impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface)
Definition: bmpdecode.c:81
static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, double *pDpiY)
Definition: bmpdecode.c:161
static ULONG WINAPI BmpFrameDecode_AddRef(IWICBitmapFrameDecode *iface)
Definition: bmpdecode.c:116
static HRESULT WINAPI BmpFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
Definition: bmpdecode.c:347
static HRESULT WINAPI BmpFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: bmpdecode.c:316
static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight)
Definition: bmpdecode.c:130
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
static SIZE_T datasize
Definition: asm.c:30
void copy_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *size, const struct pixel_format_desc *format) DECLSPEC_HIDDEN
Definition: surface.c:1700
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static unsigned int palette_size(DWORD flags)
Definition: palette.c:241
static GpStatus get_decoder_info(IStream *stream, const struct image_codec **result)
Definition: image.c:4285
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
#define assert(x)
Definition: debug.h:53
#define BI_RLE4
Definition: precomp.h:57
#define BI_RGB
Definition: precomp.h:56
ULONG RGBQUAD
Definition: precomp.h:59
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint buffer
Definition: glext.h:5915
GLintptr offset
Definition: glext.h:5920
GLuint color
Definition: glext.h:6243
GLuint index
Definition: glext.h:6031
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint64EXT * result
Definition: glext.h:11304
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
Definition: glext.h:9271
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
const char cursor[]
Definition: icontest.c:13
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 debugstr_guid
Definition: kernel32.h:35
GLint dy
Definition: linetemp.h:97
if(dx< 0)
Definition: linetemp.h:194
GLint dx
Definition: linetemp.h:97
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define BI_BITFIELDS
Definition: mmreg.h:507
static HPALETTE palette
Definition: clipboard.c:1345
static WCHAR escape[]
Definition: url.c:36
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define DWORD
Definition: nt_native.h:44
_Out_ LPRECT prc
Definition: ntgdi.h:1658
long LONG
Definition: pedump.c:60
#define INT
Definition: polytest.cpp:20
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
DWORD bc2HalftoneSize1
Definition: bmpdecode.c:53
DWORD bc2ClrImportant
Definition: bmpdecode.c:47
DWORD bc2Compression
Definition: bmpdecode.c:42
DWORD bc2HalftoneSize2
Definition: bmpdecode.c:54
DWORD bc2SizeImage
Definition: bmpdecode.c:43
DWORD bc2ColorSpace
Definition: bmpdecode.c:55
BOOL initialized
Definition: bmpdecode.c:65
ULONG palette_offset
Definition: bmpdecode.c:67
INT stride
Definition: bmpdecode.c:73
int icoframe
Definition: bmpdecode.c:78
LONG ref
Definition: bmpdecode.c:64
ULONG image_offset
Definition: bmpdecode.c:68
BYTE * imagedatastart
Definition: bmpdecode.c:75
int packed
Definition: bmpdecode.c:77
IWICBitmapDecoder IWICBitmapDecoder_iface
Definition: bmpdecode.c:62
const WICPixelFormatGUID * pixelformat
Definition: bmpdecode.c:70
ReadDataFunc read_data_func
Definition: bmpdecode.c:72
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
Definition: bmpdecode.c:63
IStream * stream
Definition: bmpdecode.c:66
int bitsperpixel
Definition: bmpdecode.c:71
CRITICAL_SECTION lock
Definition: bmpdecode.c:76
BYTE * imagedata
Definition: bmpdecode.c:74
BITMAPV5HEADER bih
Definition: bmpdecode.c:69
const WICPixelFormatGUID * pixelformat
Definition: bmpdecode.c:769
ReadDataFunc read_data_func
Definition: bmpdecode.c:770
Definition: format.c:58
Definition: send.c:48
Definition: parse.h:23
BYTE rgbtBlue
Definition: wingdi.h:1438
BYTE rgbtRed
Definition: wingdi.h:1440
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76
int32_t INT
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
int ret
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
WICDecodeOptions
Definition: wincodec.idl:28
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:29
UINT32 WICColor
Definition: wincodec.idl:364
@ WICBitmapDecoderCapabilityCanDecodeAllImages
Definition: wincodec.idl:50
void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride)
static const char * debug_wic_rect(const WICRect *rect)
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3281
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
Definition: winerror.h:3308
#define E_NOINTERFACE
Definition: winerror.h:2364
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3292
#define WINCODEC_ERR_CODECNOTHUMBNAIL
Definition: winerror.h:3291
#define WINCODEC_ERR_FRAMEMISSING
Definition: winerror.h:3301
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
struct tagRGBTRIPLE RGBTRIPLE
struct tagBITMAPCOREHEADER BITMAPCOREHEADER
#define BI_RLE8
Definition: wingdi.h:35
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1116
unsigned char BYTE
Definition: xxhash.c:193