ReactOS  0.4.14-dev-342-gdc047f9
bitmap.c
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 "config.h"
20 
21 #include <stdarg.h>
22 
23 #define COBJMACROS
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "objbase.h"
28 
29 #include "wincodecs_private.h"
30 
31 #include "wine/debug.h"
32 
34 
35 /* WARNING: .NET Media Integration Layer (MIL) directly dereferences
36  * BitmapImpl members and depends on its exact layout.
37  */
38 typedef struct BitmapImpl {
41  IMILBitmapSource IMILBitmapSource_iface;
43  IMILUnknown2 IMILUnknown2_iface;
46  LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */
48  void *view; /* used if data is a section created by an application */
49  UINT offset; /* offset into view */
54  double dpix, dpiy;
56 } BitmapImpl;
57 
58 typedef struct BitmapLockImpl {
65 
67 {
68  return CONTAINING_RECORD(iface, BitmapImpl, IWICBitmap_iface);
69 }
70 
71 static inline BitmapImpl *impl_from_IMILBitmapSource(IMILBitmapSource *iface)
72 {
73  return CONTAINING_RECORD(iface, BitmapImpl, IMILBitmapSource_iface);
74 }
75 
77 {
78  return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown1_iface);
79 }
80 
81 static inline BitmapImpl *impl_from_IMILUnknown2(IMILUnknown2 *iface)
82 {
83  return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown2_iface);
84 }
85 
87 {
88  return CONTAINING_RECORD(iface, BitmapLockImpl, IWICBitmapLock_iface);
89 }
90 
92 {
93  if (write)
94  {
95  return 0 == InterlockedCompareExchange(&This->lock, -1, 0);
96  }
97  else
98  {
99  while (1)
100  {
101  LONG prev_val = This->lock;
102  if (prev_val == -1)
103  return FALSE;
104  if (prev_val == InterlockedCompareExchange(&This->lock, prev_val+1, prev_val))
105  return TRUE;
106  }
107  }
108 }
109 
111 {
112  while (1)
113  {
114  LONG prev_val = This->lock, new_val;
115  if (prev_val == -1)
116  new_val = 0;
117  else
118  new_val = prev_val - 1;
119  if (prev_val == InterlockedCompareExchange(&This->lock, new_val, prev_val))
120  break;
121  }
122 }
123 
124 
126  void **ppv)
127 {
129  TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
130 
131  if (!ppv) return E_INVALIDARG;
132 
133  if (IsEqualIID(&IID_IUnknown, iid) ||
134  IsEqualIID(&IID_IWICBitmapLock, iid))
135  {
136  *ppv = &This->IWICBitmapLock_iface;
137  }
138  else
139  {
140  FIXME("unknown interface %s\n", debugstr_guid(iid));
141  *ppv = NULL;
142  return E_NOINTERFACE;
143  }
144 
145  IUnknown_AddRef((IUnknown*)*ppv);
146  return S_OK;
147 }
148 
150 {
153 
154  TRACE("(%p) refcount=%u\n", iface, ref);
155 
156  return ref;
157 }
158 
160 {
163 
164  TRACE("(%p) refcount=%u\n", iface, ref);
165 
166  if (ref == 0)
167  {
168  BitmapImpl_ReleaseLock(This->parent);
169  IWICBitmap_Release(&This->parent->IWICBitmap_iface);
171  }
172 
173  return ref;
174 }
175 
177  UINT *puiWidth, UINT *puiHeight)
178 {
180  TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
181 
182  if (!puiWidth || !puiHeight)
183  return E_INVALIDARG;
184 
185  *puiWidth = This->width;
186  *puiHeight = This->height;
187 
188  return S_OK;
189 }
190 
192  UINT *pcbStride)
193 {
195  TRACE("(%p,%p)\n", iface, pcbStride);
196 
197  if (!pcbStride)
198  return E_INVALIDARG;
199 
200  *pcbStride = This->parent->stride;
201 
202  return S_OK;
203 }
204 
206  UINT *pcbBufferSize, BYTE **ppbData)
207 {
209  TRACE("(%p,%p,%p)\n", iface, pcbBufferSize, ppbData);
210 
211  if (!pcbBufferSize || !ppbData)
212  return E_INVALIDARG;
213 
214  *pcbBufferSize = This->parent->stride * (This->height - 1) +
215  ((This->parent->bpp * This->width) + 7)/8;
216  *ppbData = This->data;
217 
218  return S_OK;
219 }
220 
222  WICPixelFormatGUID *pPixelFormat)
223 {
225  TRACE("(%p,%p)\n", iface, pPixelFormat);
226 
227  return IWICBitmap_GetPixelFormat(&This->parent->IWICBitmap_iface, pPixelFormat);
228 }
229 
230 static const IWICBitmapLockVtbl BitmapLockImpl_Vtbl = {
238 };
239 
241  void **ppv)
242 {
244  TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
245 
246  if (!ppv) return E_INVALIDARG;
247 
248  if (IsEqualIID(&IID_IUnknown, iid) ||
249  IsEqualIID(&IID_IWICBitmapSource, iid) ||
250  IsEqualIID(&IID_IWICBitmap, iid))
251  {
252  *ppv = &This->IWICBitmap_iface;
253  }
254  else if (IsEqualIID(&IID_IMILBitmap, iid) ||
255  IsEqualIID(&IID_IMILBitmapSource, iid))
256  {
257  *ppv = &This->IMILBitmapSource_iface;
258  }
259  else
260  {
261  FIXME("unknown interface %s\n", debugstr_guid(iid));
262  *ppv = NULL;
263  return E_NOINTERFACE;
264  }
265 
266  IUnknown_AddRef((IUnknown*)*ppv);
267  return S_OK;
268 }
269 
271 {
274 
275  TRACE("(%p) refcount=%u\n", iface, ref);
276 
277  return ref;
278 }
279 
281 {
284 
285  TRACE("(%p) refcount=%u\n", iface, ref);
286 
287  if (ref == 0)
288  {
289  if (This->palette) IWICPalette_Release(This->palette);
290  This->cs.DebugInfo->Spare[0] = 0;
292  if (This->view)
293  UnmapViewOfFile(This->view);
294  else
295  HeapFree(GetProcessHeap(), 0, This->data);
297  }
298 
299  return ref;
300 }
301 
303  UINT *puiWidth, UINT *puiHeight)
304 {
306  TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
307 
308  if (!puiWidth || !puiHeight)
309  return E_INVALIDARG;
310 
311  *puiWidth = This->width;
312  *puiHeight = This->height;
313 
314  return S_OK;
315 }
316 
318  WICPixelFormatGUID *pPixelFormat)
319 {
321  TRACE("(%p,%p)\n", iface, pPixelFormat);
322 
323  if (!pPixelFormat)
324  return E_INVALIDARG;
325 
326  memcpy(pPixelFormat, &This->pixelformat, sizeof(GUID));
327 
328  return S_OK;
329 }
330 
332  double *pDpiX, double *pDpiY)
333 {
335  TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
336 
337  if (!pDpiX || !pDpiY)
338  return E_INVALIDARG;
339 
341  *pDpiX = This->dpix;
342  *pDpiY = This->dpiy;
344 
345  return S_OK;
346 }
347 
349  IWICPalette *pIPalette)
350 {
352  TRACE("(%p,%p)\n", iface, pIPalette);
353 
354  if (!This->palette_set)
356 
357  return IWICPalette_InitializeFromPalette(pIPalette, This->palette);
358 }
359 
361  const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
362 {
364  TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
365 
366  return copy_pixels(This->bpp, This->data, This->width, This->height,
367  This->stride, prc, cbStride, cbBufferSize, pbBuffer);
368 }
369 
370 static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
371  DWORD flags, IWICBitmapLock **ppILock)
372 {
375  WICRect rc;
376 
377  TRACE("(%p,%s,%x,%p)\n", iface, debug_wic_rect(prcLock), flags, ppILock);
378 
379  if (!(flags & (WICBitmapLockRead|WICBitmapLockWrite)) || !ppILock)
380  return E_INVALIDARG;
381 
382  if (!prcLock)
383  {
384  rc.X = rc.Y = 0;
385  rc.Width = This->width;
386  rc.Height = This->height;
387  prcLock = &rc;
388  }
389  else if (prcLock->X >= This->width || prcLock->Y >= This->height ||
390  prcLock->X + prcLock->Width > This->width ||
391  prcLock->Y + prcLock->Height > This->height ||
392  prcLock->Width <= 0 || prcLock->Height <= 0)
393  return E_INVALIDARG;
394  else if (((prcLock->X * This->bpp) % 8) != 0)
395  {
396  FIXME("Cannot lock at an X coordinate not at a full byte\n");
397  return E_FAIL;
398  }
399 
401  if (!result)
402  return E_OUTOFMEMORY;
403 
405  {
408  }
409 
410  result->IWICBitmapLock_iface.lpVtbl = &BitmapLockImpl_Vtbl;
411  result->ref = 1;
412  result->parent = This;
413  result->width = prcLock->Width;
414  result->height = prcLock->Height;
415  result->data = This->data + This->stride * prcLock->Y +
416  (This->bpp * prcLock->X)/8;
417 
418  IWICBitmap_AddRef(&This->IWICBitmap_iface);
419  *ppILock = &result->IWICBitmapLock_iface;
420 
421  return S_OK;
422 }
423 
425 {
427  HRESULT hr;
428 
429  TRACE("(%p,%p)\n", iface, pIPalette);
430 
431  if (!This->palette)
432  {
433  IWICPalette *new_palette;
434  hr = PaletteImpl_Create(&new_palette);
435 
436  if (FAILED(hr)) return hr;
437 
438  if (InterlockedCompareExchangePointer((void**)&This->palette, new_palette, NULL))
439  {
440  /* someone beat us to it */
441  IWICPalette_Release(new_palette);
442  }
443  }
444 
445  hr = IWICPalette_InitializeFromPalette(This->palette, pIPalette);
446 
447  if (SUCCEEDED(hr))
448  This->palette_set = 1;
449 
450  return S_OK;
451 }
452 
454  double dpiX, double dpiY)
455 {
457  TRACE("(%p,%f,%f)\n", iface, dpiX, dpiY);
458 
460  This->dpix = dpiX;
461  This->dpiy = dpiY;
463 
464  return S_OK;
465 }
466 
467 static const IWICBitmapVtbl BitmapImpl_Vtbl = {
479 };
480 
481 static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REFIID iid,
482  void **ppv)
483 {
485  TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
486 
487  if (!ppv) return E_INVALIDARG;
488 
489  if (IsEqualIID(&IID_IUnknown, iid) ||
490  IsEqualIID(&IID_IMILBitmap, iid) ||
491  IsEqualIID(&IID_IMILBitmapSource, iid))
492  {
493  IUnknown_AddRef(&This->IMILBitmapSource_iface);
494  *ppv = &This->IMILBitmapSource_iface;
495  return S_OK;
496  }
497  else if (IsEqualIID(&IID_IWICBitmap, iid) ||
498  IsEqualIID(&IID_IWICBitmapSource, iid))
499  {
500  IUnknown_AddRef(&This->IWICBitmap_iface);
501  *ppv = &This->IWICBitmap_iface;
502  return S_OK;
503  }
504 
505  FIXME("unknown interface %s\n", debugstr_guid(iid));
506  *ppv = NULL;
507  return E_NOINTERFACE;
508 }
509 
510 static ULONG WINAPI IMILBitmapImpl_AddRef(IMILBitmapSource *iface)
511 {
513  return IWICBitmap_AddRef(&This->IWICBitmap_iface);
514 }
515 
516 static ULONG WINAPI IMILBitmapImpl_Release(IMILBitmapSource *iface)
517 {
519  return IWICBitmap_Release(&This->IWICBitmap_iface);
520 }
521 
522 static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface,
523  UINT *width, UINT *height)
524 {
526  TRACE("(%p,%p,%p)\n", iface, width, height);
527  return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height);
528 }
529 
530 static const struct
531 {
532  const GUID *WIC_format;
534 } pixel_fmt_map[] =
535 {
536  { &GUID_WICPixelFormatDontCare, 0 },
537  { &GUID_WICPixelFormat1bppIndexed, 1 },
538  { &GUID_WICPixelFormat2bppIndexed, 2 },
539  { &GUID_WICPixelFormat4bppIndexed, 3 },
540  { &GUID_WICPixelFormat8bppIndexed, 4 },
541  { &GUID_WICPixelFormatBlackWhite, 5 },
542  { &GUID_WICPixelFormat2bppGray, 6 },
543  { &GUID_WICPixelFormat4bppGray, 7 },
544  { &GUID_WICPixelFormat8bppGray, 8 },
545  { &GUID_WICPixelFormat16bppBGR555, 9 },
546  { &GUID_WICPixelFormat16bppBGR565, 0x0a },
547  { &GUID_WICPixelFormat16bppGray, 0x0b },
548  { &GUID_WICPixelFormat24bppBGR, 0x0c },
549  { &GUID_WICPixelFormat24bppRGB, 0x0d },
550  { &GUID_WICPixelFormat32bppBGR, 0x0e },
551  { &GUID_WICPixelFormat32bppBGRA, 0x0f },
552  { &GUID_WICPixelFormat32bppPBGRA, 0x10 },
553  { &GUID_WICPixelFormat48bppRGB, 0x15 },
554  { &GUID_WICPixelFormat64bppRGBA, 0x16 },
555  { &GUID_WICPixelFormat64bppPRGBA, 0x17 },
556  { &GUID_WICPixelFormat32bppCMYK, 0x1c }
557 };
558 
559 static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface,
560  int *format)
561 {
563  int i;
564 
565  TRACE("(%p,%p)\n", iface, format);
566 
567  if (!format) return E_INVALIDARG;
568 
569  *format = 0;
570 
571  for (i = 0; i < ARRAY_SIZE(pixel_fmt_map); i++)
572  {
573  if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat))
574  {
575  *format = pixel_fmt_map[i].enum_format;
576  break;
577  }
578  }
579 
580  TRACE("=> %u\n", *format);
581  return S_OK;
582 }
583 
584 static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface,
585  double *dpix, double *dpiy)
586 {
588  TRACE("(%p,%p,%p)\n", iface, dpix, dpiy);
589  return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy);
590 }
591 
592 static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface,
594 {
596  TRACE("(%p,%p)\n", iface, palette);
597  return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette);
598 }
599 
600 static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface,
601  const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
602 {
604  TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer);
605  return IWICBitmap_CopyPixels(&This->IWICBitmap_iface, rc, stride, size, buffer);
606 }
607 
608 static HRESULT WINAPI IMILBitmapImpl_unknown1(IMILBitmapSource *iface, void **ppv)
609 {
611 
612  TRACE("(%p,%p)\n", iface, ppv);
613 
614  if (!ppv) return E_INVALIDARG;
615 
616  /* reference count is not incremented here */
617  *ppv = &This->IMILUnknown1_iface;
618 
619  return S_OK;
620 }
621 
622 static HRESULT WINAPI IMILBitmapImpl_Lock(IMILBitmapSource *iface, const WICRect *rc, DWORD flags, IWICBitmapLock **lock)
623 {
625  TRACE("(%p,%p,%08x,%p)\n", iface, rc, flags, lock);
626  return IWICBitmap_Lock(&This->IWICBitmap_iface, rc, flags, lock);
627 }
628 
629 static HRESULT WINAPI IMILBitmapImpl_Unlock(IMILBitmapSource *iface, IWICBitmapLock *lock)
630 {
631  TRACE("(%p,%p)\n", iface, lock);
632  IWICBitmapLock_Release(lock);
633  return S_OK;
634 }
635 
636 static HRESULT WINAPI IMILBitmapImpl_SetPalette(IMILBitmapSource *iface, IWICPalette *palette)
637 {
639  TRACE("(%p,%p)\n", iface, palette);
640  return IWICBitmap_SetPalette(&This->IWICBitmap_iface, palette);
641 }
642 
643 static HRESULT WINAPI IMILBitmapImpl_SetResolution(IMILBitmapSource *iface, double dpix, double dpiy)
644 {
646  TRACE("(%p,%f,%f)\n", iface, dpix, dpiy);
647  return IWICBitmap_SetResolution(&This->IWICBitmap_iface, dpix, dpiy);
648 }
649 
650 static HRESULT WINAPI IMILBitmapImpl_AddDirtyRect(IMILBitmapSource *iface, const WICRect *rc)
651 {
652  FIXME("(%p,%p): stub\n", iface, rc);
653  return E_NOTIMPL;
654 }
655 
656 static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl =
657 {
672 };
673 
675  void **ppv)
676 {
677  FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv);
678  *ppv = NULL;
679  return E_NOINTERFACE;
680 }
681 
683 {
685  return IWICBitmap_AddRef(&This->IWICBitmap_iface);
686 }
687 
689 {
691  return IWICBitmap_Release(&This->IWICBitmap_iface);
692 }
693 
695 {
696  FIXME("(%p,%p): stub\n", iface, arg);
697 }
698 
700 {
701  FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2);
702  return E_NOTIMPL;
703 }
704 
706 {
707  FIXME("(%p,%p): stub\n", iface, arg);
708  return E_NOTIMPL;
709 }
710 
712 {
713  FIXME("(%p,%p): stub\n", iface, arg);
714  return E_NOTIMPL;
715 }
716 
718 {
719  FIXME("(%p,%p): stub\n", iface, arg);
720  return E_NOTIMPL;
721 }
722 
724 {
725  FIXME("(%p,%s): stub\n", iface, wine_dbgstr_longlong(arg));
726  return E_NOTIMPL;
727 }
728 
730 {
731  FIXME("(%p,%p): stub\n", iface, arg);
732  return E_NOTIMPL;
733 }
734 
736 {
737  FIXME("(%p): stub\n", iface);
738  return E_NOTIMPL;
739 }
740 
744 
745 static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl =
746 {
758 };
759 
760 static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid,
761  void **ppv)
762 {
763  FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv);
764  *ppv = NULL;
765  return E_NOINTERFACE;
766 }
767 
768 static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface)
769 {
770  FIXME("(%p): stub\n", iface);
771  return 0;
772 }
773 
774 static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface)
775 {
776  FIXME("(%p): stub\n", iface);
777  return 0;
778 }
779 
780 static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void **arg2)
781 {
782  FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2);
783  if (arg2) *arg2 = NULL;
784  return E_NOTIMPL;
785 }
786 
787 static HRESULT WINAPI IMILUnknown2Impl_unknown2(IMILUnknown2 *iface, void *arg1, void *arg2)
788 {
789  FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2);
790  return E_NOTIMPL;
791 }
792 
793 static HRESULT WINAPI IMILUnknown2Impl_unknown3(IMILUnknown2 *iface, void *arg1)
794 {
795  FIXME("(%p,%p): stub\n", iface, arg1);
796  return E_NOTIMPL;
797 }
798 
799 static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl =
800 {
807 };
808 
811  IWICBitmap **ppIBitmap)
812 {
813  HRESULT hr;
814  BitmapImpl *This;
815  BYTE *data;
816  UINT bpp;
817 
818  hr = get_pixelformat_bpp(pixelFormat, &bpp);
819  if (FAILED(hr)) return hr;
820 
821  if (!stride) stride = (((bpp*uiWidth)+31)/32)*4;
822  if (!datasize) datasize = stride * uiHeight;
823 
824  if (datasize < stride * uiHeight) return WINCODEC_ERR_INSUFFICIENTBUFFER;
825  if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG;
826 
827  This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl));
828  if (!This) return E_OUTOFMEMORY;
829 
830  if (view) data = (BYTE *)view + offset;
832  {
834  return E_OUTOFMEMORY;
835  }
836 
837  This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl;
838  This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl;
839  This->IMILUnknown1_iface.lpVtbl = &IMILUnknown1Impl_Vtbl;
840  This->IMILUnknown2_iface.lpVtbl = &IMILUnknown2Impl_Vtbl;
841  This->ref = 1;
842  This->palette = NULL;
843  This->palette_set = 0;
844  This->lock = 0;
845  This->data = data;
846  This->view = view;
847  This->offset = offset;
848  This->width = uiWidth;
849  This->height = uiHeight;
850  This->stride = stride;
851  This->bpp = bpp;
852  memcpy(&This->pixelformat, pixelFormat, sizeof(GUID));
853  This->dpix = This->dpiy = 0.0;
855  This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BitmapImpl.lock");
856 
857  *ppIBitmap = &This->IWICBitmap_iface;
858 
859  return S_OK;
860 }
static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid, void **ppv)
Definition: bitmap.c:240
IMILUnknown2 IMILUnknown2_iface
Definition: bitmap.c:43
static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl
Definition: bitmap.c:745
static BitmapImpl * impl_from_IMILUnknown1(IMILUnknown1 *iface)
Definition: bitmap.c:76
UINT width
Definition: bitmap.c:50
static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl
Definition: bitmap.c:799
GLint GLint GLsizei width
Definition: gl.h:1546
BYTE * data
Definition: bitmap.c:47
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
LONG ref
Definition: bitmap.c:40
static ULONG WINAPI BitmapLockImpl_AddRef(IWICBitmapLock *iface)
Definition: bitmap.c:149
rwlock_t lock
Definition: tcpcore.h:1163
static SIZE_T datasize
Definition: asm.c:30
#define DWORD_PTR
Definition: treelist.c:76
static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface, UINT *width, UINT *height)
Definition: bitmap.c:522
static BitmapImpl * impl_from_IMILBitmapSource(IMILBitmapSource *iface)
Definition: bitmap.c:71
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
static BitmapImpl * impl_from_IMILUnknown2(IMILUnknown2 *iface)
Definition: bitmap.c:81
static ULONG WINAPI BitmapImpl_AddRef(IWICBitmap *iface)
Definition: bitmap.c:270
static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void **arg2)
Definition: bitmap.c:780
static BOOL BitmapImpl_AcquireLock(BitmapImpl *This, int write)
Definition: bitmap.c:91
static BitmapImpl * impl_from_IWICBitmap(IWICBitmap *iface)
Definition: bitmap.c:66
static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REFIID iid, void **ppv)
Definition: bitmap.c:481
HRESULT PaletteImpl_Create(IWICPalette **palette)
Definition: palette.c:899
static ULONG WINAPI IMILBitmapImpl_Release(IMILBitmapSource *iface)
Definition: bitmap.c:516
GLintptr offset
Definition: glext.h:5920
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HRESULT WINAPI BitmapImpl_SetResolution(IWICBitmap *iface, double dpiX, double dpiY)
Definition: bitmap.c:453
#define InterlockedCompareExchange
Definition: interlocked.h:104
GLuint buffer
Definition: glext.h:5915
static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid, void **ppv)
Definition: bitmap.c:760
double dpix
Definition: bitmap.c:54
static HRESULT WINAPI BitmapLockImpl_GetSize(IWICBitmapLock *iface, UINT *puiWidth, UINT *puiHeight)
Definition: bitmap.c:176
int enum_format
Definition: bitmap.c:533
static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface)
Definition: bitmap.c:774
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI IMILUnknown1Impl_unknown4(IMILUnknown1 *iface, void *arg)
Definition: bitmap.c:711
IWICBitmap IWICBitmap_iface
Definition: bitmap.c:42
#define E_FAIL
Definition: ddrawi.h:102
Definition: send.c:47
int palette_set
Definition: bitmap.c:45
IWICPalette * palette
Definition: bitmap.c:44
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown3(IMILUnknown1 *iface, void *arg)
Definition: bitmap.c:705
static HRESULT WINAPI IMILBitmapImpl_Unlock(IMILBitmapSource *iface, IWICBitmapLock *lock)
Definition: bitmap.c:629
WICBitmapCreateCacheOption
Definition: wincodec.idl:33
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
#define write
Definition: acwin.h:97
static HRESULT WINAPI BitmapLockImpl_GetStride(IWICBitmapLock *iface, UINT *pcbStride)
Definition: bitmap.c:191
static HRESULT WINAPI IMILUnknown1Impl_unknown5(IMILUnknown1 *iface, void *arg)
Definition: bitmap.c:717
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static ULONG WINAPI IMILBitmapImpl_AddRef(IMILBitmapSource *iface)
Definition: bitmap.c:510
static HRESULT WINAPI BitmapImpl_GetSize(IWICBitmap *iface, UINT *puiWidth, UINT *puiHeight)
Definition: bitmap.c:302
static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface, double *dpix, double *dpiy)
Definition: bitmap.c:584
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DECLSPEC_HIDDEN void WINAPI IMILUnknown1Impl_unknown1(IMILUnknown1 *iface, void *arg)
Definition: bitmap.c:694
BYTE * data
Definition: bitmap.c:63
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, void *view, UINT offset, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
Definition: bitmap.c:809
static HRESULT WINAPI BitmapImpl_CopyPixels(IWICBitmap *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: bitmap.c:360
static HRESULT WINAPI IMILBitmapImpl_SetPalette(IMILBitmapSource *iface, IWICPalette *palette)
Definition: bitmap.c:636
#define E_INVALIDARG
Definition: ddrawi.h:101
static HRESULT WINAPI BitmapImpl_GetPixelFormat(IWICBitmap *iface, WICPixelFormatGUID *pPixelFormat)
Definition: bitmap.c:317
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3284
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
Definition: getopt.h:108
UINT offset
Definition: bitmap.c:49
INT Height
Definition: wincodec.idl:239
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs)
static HRESULT WINAPI IMILUnknown2Impl_unknown2(IMILUnknown2 *iface, void *arg1, void *arg2)
Definition: bitmap.c:787
WICPixelFormatGUID pixelformat
Definition: bitmap.c:53
IMILUnknown1 IMILUnknown1_iface
Definition: bitmap.c:39
static ULONG WINAPI BitmapLockImpl_Release(IWICBitmapLock *iface)
Definition: bitmap.c:159
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei stride
Definition: glext.h:5848
BitmapImpl * parent
Definition: bitmap.c:61
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
LONG HRESULT
Definition: typedefs.h:77
#define THISCALL(func)
Definition: txthost.c:526
static HRESULT WINAPI IMILUnknown1Impl_QueryInterface(IMILUnknown1 *iface, REFIID iid, void **ppv)
Definition: bitmap.c:674
const GUID IID_IUnknown
static HRESULT WINAPI BitmapImpl_CopyPalette(IWICBitmap *iface, IWICPalette *pIPalette)
Definition: bitmap.c:348
static HRESULT WINAPI BitmapLockImpl_GetDataPointer(IWICBitmapLock *iface, UINT *pcbBufferSize, BYTE **ppbData)
Definition: bitmap.c:205
#define WINAPI
Definition: msvc.h:8
double dpiy
Definition: bitmap.c:54
IMILBitmapSource IMILBitmapSource_iface
Definition: bitmap.c:41
#define IMILUnknown1
Definition: msvc.h:10
unsigned long DWORD
Definition: ntddk_ex.h:95
static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface)
Definition: bitmap.c:768
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DEFINE_THISCALL_WRAPPER(func, args)
Definition: msvc-thiscall.c:2
GLbitfield flags
Definition: glext.h:7161
static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl
Definition: bitmap.c:656
static HRESULT WINAPI BitmapLockImpl_QueryInterface(IWICBitmapLock *iface, REFIID iid, void **ppv)
Definition: bitmap.c:125
struct BitmapLockImpl BitmapLockImpl
static HRESULT WINAPI BitmapImpl_SetPalette(IWICBitmap *iface, IWICPalette *pIPalette)
Definition: bitmap.c:424
UINT stride
Definition: bitmap.c:51
#define WINCODEC_ERR_ALREADYLOCKED
Definition: winerror.h:3278
UINT height
Definition: bitmap.c:50
#define InterlockedDecrement
Definition: armddk.h:52
static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface, IWICPalette *palette)
Definition: bitmap.c:592
static const char * debug_wic_rect(const WICRect *rect)
LONG ref
Definition: bitmap.c:60
static HRESULT WINAPI IMILBitmapImpl_unknown1(IMILBitmapSource *iface, void **ppv)
Definition: bitmap.c:608
static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock, DWORD flags, IWICBitmapLock **ppILock)
Definition: bitmap.c:370
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface)
Definition: bitmap.c:688
static HRESULT WINAPI IMILBitmapImpl_SetResolution(IMILBitmapSource *iface, double dpix, double dpiy)
Definition: bitmap.c:643
static HRESULT WINAPI IMILUnknown1Impl_unknown7(IMILUnknown1 *iface, void *arg)
Definition: bitmap.c:729
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:1601
static HRESULT WINAPI IMILUnknown2Impl_unknown3(IMILUnknown2 *iface, void *arg1)
Definition: bitmap.c:793
static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface, const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
Definition: bitmap.c:600
static HRESULT WINAPI IMILBitmapImpl_AddDirtyRect(IMILBitmapSource *iface, const WICRect *rc)
Definition: bitmap.c:650
#define S_OK
Definition: intsafe.h:59
UINT bpp
Definition: bitmap.c:52
#define InterlockedIncrement
Definition: armddk.h:53
IWICBitmapLock IWICBitmapLock_iface
Definition: bitmap.c:59
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
uint64_t DWORD64
Definition: typedefs.h:65
LONG lock
Definition: bitmap.c:46
#define ARRAY_SIZE(a)
Definition: main.h:24
CRITICAL_SECTION cs
Definition: bitmap.c:55
UINT height
Definition: bitmap.c:62
#define E_NOTIMPL
Definition: ddrawi.h:99
static const IWICBitmapVtbl BitmapImpl_Vtbl
Definition: bitmap.c:467
static const IWICBitmapLockVtbl BitmapLockImpl_Vtbl
Definition: bitmap.c:230
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static HRESULT WINAPI IMILBitmapImpl_Lock(IMILBitmapSource *iface, const WICRect *rc, DWORD flags, IWICBitmapLock **lock)
Definition: bitmap.c:622
struct BitmapImpl BitmapImpl
static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface, double *pDpiX, double *pDpiY)
Definition: bitmap.c:331
static HRESULT WINAPI BitmapLockImpl_GetPixelFormat(IWICBitmapLock *iface, WICPixelFormatGUID *pPixelFormat)
Definition: bitmap.c:221
static BitmapLockImpl * impl_from_IWICBitmapLock(IWICBitmapLock *iface)
Definition: bitmap.c:86
INT Width
Definition: wincodec.idl:238
static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
Definition: bitmap.c:280
unsigned int ULONG
Definition: retypes.h:1
#define const
Definition: zconf.h:230
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
static HRESULT WINAPI IMILUnknown1Impl_unknown6(IMILUnknown1 *iface, DWORD64 arg)
Definition: bitmap.c:723
static IOleDocumentView * view
Definition: activex.c:1749
DWORD bpp
Definition: surface.c:181
DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown8(IMILUnknown1 *iface)
Definition: bitmap.c:735
#define WINCODEC_ERR_INSUFFICIENTBUFFER
Definition: winerror.h:3303
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface, int *format)
Definition: bitmap.c:559
UINT width
Definition: bitmap.c:62
const GUID * WIC_format
Definition: bitmap.c:532
#define UnmapViewOfFile
Definition: compat.h:411
_Out_ LPRECT prc
Definition: ntgdi.h:1658
GLuint64EXT * result
Definition: glext.h:11304
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
Definition: main.c:231
static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface)
Definition: bitmap.c:682
#define HeapFree(x, y, z)
Definition: compat.h:402
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static const struct @574 pixel_fmt_map[]
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static void BitmapImpl_ReleaseLock(BitmapImpl *This)
Definition: bitmap.c:110
void * view
Definition: bitmap.c:48
static HRESULT WINAPI IMILUnknown1Impl_unknown2(IMILUnknown1 *iface, void *arg1, void *arg2)
Definition: bitmap.c:699