24#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
25#define GetCurrentProcess GetCurrentProcess_Mac
26#define GetCurrentThread GetCurrentThread_Mac
27#define LoadResource LoadResource_Mac
28#define AnimatePalette AnimatePalette_Mac
29#define EqualRgn EqualRgn_Mac
30#define FillRgn FillRgn_Mac
31#define FrameRgn FrameRgn_Mac
32#define GetPixel GetPixel_Mac
33#define InvertRgn InvertRgn_Mac
34#define LineTo LineTo_Mac
35#define OffsetRgn OffsetRgn_Mac
36#define PaintRgn PaintRgn_Mac
37#define Polygon Polygon_Mac
38#define ResizePalette ResizePalette_Mac
39#define SetRectRgn SetRectRgn_Mac
40#define EqualRect EqualRect_Mac
41#define FillRect FillRect_Mac
42#define FrameRect FrameRect_Mac
43#define GetCursor GetCursor_Mac
44#define InvertRect InvertRect_Mac
45#define OffsetRect OffsetRect_Mac
46#define PtInRect PtInRect_Mac
47#define SetCursor SetCursor_Mac
48#define SetRect SetRect_Mac
49#define ShowCursor ShowCursor_Mac
50#define UnionRect UnionRect_Mac
51#include <ApplicationServices/ApplicationServices.h>
52#undef GetCurrentProcess
53#undef GetCurrentThread
93#if defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) && \
94 MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
96typedef struct IcnsEncoder {
100 IconFamilyHandle icns_family;
101 BOOL any_frame_committed;
102 int outstanding_commits;
112typedef struct IcnsFrameEncode {
114 IcnsEncoder *encoder;
140 *
ppv = &
This->IWICBitmapFrameEncode_iface;
157 TRACE(
"(%p) refcount=%u\n", iface,
ref);
167 TRACE(
"(%p) refcount=%u\n", iface,
ref);
171 if (!
This->committed)
174 This->encoder->outstanding_commits--;
179 IWICBitmapEncoder_Release(&
This->encoder->IWICBitmapEncoder_iface);
192 TRACE(
"(%p,%p)\n", iface, pIEncoderOptions);
196 if (
This->initialized)
214 TRACE(
"(%p,%u,%u)\n", iface, uiWidth, uiHeight);
218 if (!
This->initialized ||
This->icns_image)
224 if (uiWidth != uiHeight)
226 WARN(
"cannot generate ICNS icon from %dx%d image\n", uiWidth, uiHeight);
241 WARN(
"cannot generate ICNS icon from %dx%d image\n",
This->size,
This->size);
246 This->size = uiWidth;
254 double dpiX,
double dpiY)
259 TRACE(
"(%p,%0.2f,%0.2f)\n", iface, dpiX, dpiY);
263 if (!
This->initialized ||
This->icns_image)
284 if (!
This->initialized ||
This->icns_image)
290 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGRA,
sizeof(
GUID));
300 FIXME(
"(%p,%u,%p): stub\n", iface, cCount, ppIColorContext);
307 FIXME(
"(%p,%p): stub\n", iface, pIPalette);
314 FIXME(
"(%p,%p): stub\n", iface, pIThumbnail);
325 TRACE(
"(%p,%u,%u,%u,%p)\n", iface, lineCount, cbStride, cbBufferSize, pbPixels);
329 if (!
This->initialized || !
This->size)
334 if (lineCount == 0 || lineCount +
This->lines_written >
This->size)
340 if (!
This->icns_image)
344 case 16:
This->icns_type = kIconServices16PixelDataARGB;
break;
345 case 32:
This->icns_type = kIconServices32PixelDataARGB;
break;
346 case 48:
This->icns_type = kIconServices48PixelDataARGB;
break;
347 case 128:
This->icns_type = kIconServices128PixelDataARGB;
break;
348 case 256:
This->icns_type = kIconServices256PixelDataARGB;
break;
349 case 512:
This->icns_type = kIconServices512PixelDataARGB;
break;
351 WARN(
"cannot generate ICNS icon from %dx%d image\n",
This->size,
This->size);
356 if (!
This->icns_image)
358 WARN(
"failed to allocate image buffer\n");
364 for (
i = 0;
i < lineCount;
i++)
366 BYTE *src_row, *dst_row;
368 src_row = pbPixels + cbStride *
i;
369 dst_row =
This->icns_image + (
This->lines_written +
i)*(
This->size*4);
371 for (
j = 0;
j <
This->size*4;
j += 4)
373 dst_row[
j] = src_row[
j+3];
374 dst_row[
j+1] = src_row[
j+2];
375 dst_row[
j+2] = src_row[
j+1];
376 dst_row[
j+3] = src_row[
j];
379 This->lines_written += lineCount;
394 if (!
This->initialized)
398 &GUID_WICPixelFormat32bppBGRA,
This->size,
This->size,
404 &GUID_WICPixelFormat32bppBGRA, 32,
This->size,
This->size);
417 TRACE(
"(%p)\n", iface);
421 if (!
This->icns_image ||
This->lines_written !=
This->size ||
This->committed)
430 WARN(
"PtrToHand failed with error %d\n",
ret);
440 WARN(
"SetIconFamilyData failed for image with error %d\n",
ret);
446 This->encoder->any_frame_committed =
TRUE;
447 This->encoder->outstanding_commits--;
457 FIXME(
"(%p, %p): stub\n", iface, ppIMetadataQueryWriter);
461static const IWICBitmapFrameEncodeVtbl IcnsEncoder_FrameVtbl = {
462 IcnsFrameEncode_QueryInterface,
463 IcnsFrameEncode_AddRef,
464 IcnsFrameEncode_Release,
465 IcnsFrameEncode_Initialize,
466 IcnsFrameEncode_SetSize,
467 IcnsFrameEncode_SetResolution,
468 IcnsFrameEncode_SetPixelFormat,
469 IcnsFrameEncode_SetColorContexts,
470 IcnsFrameEncode_SetPalette,
471 IcnsFrameEncode_SetThumbnail,
472 IcnsFrameEncode_WritePixels,
473 IcnsFrameEncode_WriteSource,
474 IcnsFrameEncode_Commit,
475 IcnsFrameEncode_GetMetadataQueryWriter
489 *
ppv = &
This->IWICBitmapEncoder_iface;
506 TRACE(
"(%p) refcount=%u\n", iface,
ref);
516 TRACE(
"(%p) refcount=%u\n", iface,
ref);
520 This->lock.DebugInfo->Spare[0] = 0;
522 if (
This->icns_family)
525 IStream_Release(
This->stream);
538 TRACE(
"(%p,%p,%u)\n", iface, pIStream, cacheOption);
542 if (
This->icns_family)
547 This->icns_family = (IconFamilyHandle)NewHandle(0);
548 if (!
This->icns_family)
550 WARN(
"error creating icns family\n");
554 IStream_AddRef(pIStream);
555 This->stream = pIStream;
564 GUID *pguidContainerFormat)
573 FIXME(
"(%p,%p): stub\n", iface, ppIEncoderInfo);
580 FIXME(
"(%p,%u,%p): stub\n", iface, cCount, ppIColorContext);
586 TRACE(
"(%p,%p)\n", iface, pIPalette);
592 TRACE(
"(%p,%p)\n", iface, pIThumbnail);
598 TRACE(
"(%p,%p)\n", iface, pIPreview);
607 IcnsFrameEncode *frameEncode =
NULL;
609 TRACE(
"(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
613 if (!
This->icns_family)
619 if (ppIEncoderOptions)
627 if (frameEncode ==
NULL)
632 frameEncode->IWICBitmapFrameEncode_iface.lpVtbl = &IcnsEncoder_FrameVtbl;
633 frameEncode->encoder =
This;
634 frameEncode->ref = 1;
635 frameEncode->initialized =
FALSE;
636 frameEncode->size = 0;
637 frameEncode->icns_image =
NULL;
638 frameEncode->lines_written = 0;
639 frameEncode->committed =
FALSE;
640 *ppIFrameEncode = &frameEncode->IWICBitmapFrameEncode_iface;
641 This->outstanding_commits++;
642 IWICBitmapEncoder_AddRef(&
This->IWICBitmapEncoder_iface);
657 TRACE(
"(%p)\n", iface);
661 if (!
This->any_frame_committed ||
This->outstanding_commits > 0 ||
This->committed)
671 WARN(
"writing file failed, hr = 0x%08X\n",
hr);
686 FIXME(
"(%p,%p): stub\n", iface, ppIMetadataQueryWriter);
690static const IWICBitmapEncoderVtbl IcnsEncoder_Vtbl = {
691 IcnsEncoder_QueryInterface,
694 IcnsEncoder_Initialize,
695 IcnsEncoder_GetContainerFormat,
696 IcnsEncoder_GetEncoderInfo,
697 IcnsEncoder_SetColorContexts,
698 IcnsEncoder_SetPalette,
699 IcnsEncoder_SetThumbnail,
700 IcnsEncoder_SetPreview,
701 IcnsEncoder_CreateNewFrame,
703 IcnsEncoder_GetMetadataQueryWriter
718 This->IWICBitmapEncoder_iface.lpVtbl = &IcnsEncoder_Vtbl;
723 This->outstanding_commits = 0;
726 This->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": IcnsEncoder.lock");
728 ret = IWICBitmapEncoder_QueryInterface(&
This->IWICBitmapEncoder_iface, iid,
ppv);
729 IWICBitmapEncoder_Release(&
This->IWICBitmapEncoder_iface);
739 ERR(
"Trying to save ICNS picture, but ICNS support is not compiled in.\n");
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static BmpFrameEncode * impl_from_IWICBitmapFrameEncode(IWICBitmapFrameEncode *iface)
static BmpEncoder * impl_from_IWICBitmapEncoder(IWICBitmapEncoder *iface)
#define HeapFree(x, y, z)
HRESULT write_source(IWICBitmapFrameEncode *iface, IWICBitmapSource *source, const WICRect *prc, const WICPixelFormatGUID *format, UINT bpp, INT width, INT height)
HRESULT configure_write_source(IWICBitmapFrameEncode *iface, IWICBitmapSource *source, const WICRect *prc, const WICPixelFormatGUID *format, INT width, INT height, double xres, double yres)
HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, IPropertyBag2 **ppPropertyBag2)
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
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
#define memcpy(s1, s2, n)
#define IsEqualIID(riid1, riid2)
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define CONTAINING_RECORD(address, type, field)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
WICBitmapEncoderCacheOption
static const char * debug_wic_rect(const WICRect *rect)
#define WINCODEC_ERR_WRONGSTATE
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
#define WINCODEC_ERR_NOTINITIALIZED