From bc58b627b025a8bdb9f4abea09a1630ca1f3961f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 27 Oct 2021 12:05:47 +0200 Subject: [PATCH] windowscodecs: Remove the no longer used icns encoder. Signed-off-by: Alexandre Julliard --- dlls/windowscodecs/Makefile.in | 2 - dlls/windowscodecs/clsfactory.c | 1 - dlls/windowscodecs/icnsencoder.c | 295 ------------------ dlls/windowscodecs/main.c | 14 - dlls/windowscodecs/regsvr.c | 15 - dlls/windowscodecs/unix_lib.c | 3 - dlls/windowscodecs/wincodecs_private.h | 5 - dlls/windowscodecs/windowscodecs_wincodec.idl | 7 - 8 files changed, 342 deletions(-) delete mode 100644 dlls/windowscodecs/icnsencoder.c diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in index f27ac0ab47a..fe6d8499e7a 100644 --- a/dlls/windowscodecs/Makefile.in +++ b/dlls/windowscodecs/Makefile.in @@ -2,7 +2,6 @@ MODULE = windowscodecs.dll IMPORTLIB = windowscodecs IMPORTS = $(TIFF_PE_LIBS) $(JPEG_PE_LIBS) $(PNG_PE_LIBS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32 EXTRAINCL = $(TIFF_PE_CFLAGS) $(JPEG_PE_CFLAGS) $(PNG_PE_CFLAGS) -EXTRALIBS = $(APPLICATIONSERVICES_LIBS) C_SRCS = \ bitmap.c \ @@ -18,7 +17,6 @@ C_SRCS = \ encoder.c \ fliprotate.c \ gifformat.c \ - icnsencoder.c \ icoformat.c \ imgfactory.c \ info.c \ diff --git a/dlls/windowscodecs/clsfactory.c b/dlls/windowscodecs/clsfactory.c index d6baea38a1c..c122f8c14bc 100644 --- a/dlls/windowscodecs/clsfactory.c +++ b/dlls/windowscodecs/clsfactory.c @@ -57,7 +57,6 @@ static const classinfo wic_classes[] = { {&CLSID_WICJpegEncoder, JpegEncoder_CreateInstance}, {&CLSID_WICTiffDecoder, TiffDecoder_CreateInstance}, {&CLSID_WICTiffEncoder, TiffEncoder_CreateInstance}, - {&CLSID_WICIcnsEncoder, IcnsEncoder_CreateInstance}, {&CLSID_WICDdsDecoder, DdsDecoder_CreateInstance}, {&CLSID_WICDdsEncoder, DdsEncoder_CreateInstance}, {&CLSID_WICDefaultFormatConverter, FormatConverter_CreateInstance}, diff --git a/dlls/windowscodecs/icnsencoder.c b/dlls/windowscodecs/icnsencoder.c deleted file mode 100644 index 76253712cfb..00000000000 --- a/dlls/windowscodecs/icnsencoder.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 2010 Damjan Jovanovic - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#if 0 -#pragma makedep unix -#endif - -#include "config.h" -#include "wine/port.h" - -#include - -#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H -#define GetCurrentProcess GetCurrentProcess_Mac -#define GetCurrentThread GetCurrentThread_Mac -#define LoadResource LoadResource_Mac -#define AnimatePalette AnimatePalette_Mac -#define EqualRgn EqualRgn_Mac -#define FillRgn FillRgn_Mac -#define FrameRgn FrameRgn_Mac -#define GetPixel GetPixel_Mac -#define InvertRgn InvertRgn_Mac -#define LineTo LineTo_Mac -#define OffsetRgn OffsetRgn_Mac -#define PaintRgn PaintRgn_Mac -#define Polygon Polygon_Mac -#define ResizePalette ResizePalette_Mac -#define SetRectRgn SetRectRgn_Mac -#define EqualRect EqualRect_Mac -#define FillRect FillRect_Mac -#define FrameRect FrameRect_Mac -#define GetCursor GetCursor_Mac -#define InvertRect InvertRect_Mac -#define OffsetRect OffsetRect_Mac -#define PtInRect PtInRect_Mac -#define SetCursor SetCursor_Mac -#define SetRect SetRect_Mac -#define ShowCursor ShowCursor_Mac -#define UnionRect UnionRect_Mac -#include -#undef GetCurrentProcess -#undef GetCurrentThread -#undef LoadResource -#undef AnimatePalette -#undef EqualRgn -#undef FillRgn -#undef FrameRgn -#undef GetPixel -#undef InvertRgn -#undef LineTo -#undef OffsetRgn -#undef PaintRgn -#undef Polygon -#undef ResizePalette -#undef SetRectRgn -#undef EqualRect -#undef FillRect -#undef FrameRect -#undef GetCursor -#undef InvertRect -#undef OffsetRect -#undef PtInRect -#undef SetCursor -#undef SetRect -#undef ShowCursor -#undef UnionRect -#endif - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winternl.h" -#include "winbase.h" -#include "objbase.h" - -#include "wincodecs_private.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); - -#if defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) && \ - MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4 - -typedef struct IcnsEncoder { - struct encoder encoder; - IStream *stream; - IconFamilyHandle icns_family; - struct encoder_frame frame; - OSType icns_type; - BYTE* icns_image; - int lines_written; -} IcnsEncoder; - -static inline IcnsEncoder *impl_from_encoder(struct encoder *iface) -{ - return CONTAINING_RECORD(iface, IcnsEncoder, encoder); -} - -void CDECL IcnsEncoder_destroy(struct encoder *iface) -{ - IcnsEncoder *This = impl_from_encoder(iface); - - free(This->icns_image); - - if (This->icns_family) - DisposeHandle((Handle)This->icns_family); - - RtlFreeHeap(GetProcessHeap(), 0, This); -} - -HRESULT CDECL IcnsEncoder_get_supported_format(struct encoder *iface, - GUID *pixel_format, DWORD *bpp, BOOL *indexed) -{ - *pixel_format = GUID_WICPixelFormat32bppBGRA; - *bpp = 32; - *indexed = FALSE; - return S_OK; -} - -HRESULT CDECL IcnsEncoder_create_frame(struct encoder *iface, const struct encoder_frame *frame) -{ - IcnsEncoder *This = impl_from_encoder(iface); - - This->frame = *frame; - - switch (frame->width) - { - case 16: This->icns_type = kIconServices16PixelDataARGB; break; - case 32: This->icns_type = kIconServices32PixelDataARGB; break; - case 48: This->icns_type = kIconServices48PixelDataARGB; break; - case 128: This->icns_type = kIconServices128PixelDataARGB; break; - case 256: This->icns_type = kIconServices256PixelDataARGB; break; - case 512: This->icns_type = kIconServices512PixelDataARGB; break; - default: - ERR("cannot generate ICNS icon from %dx%d image\n", frame->width, frame->height); - return E_INVALIDARG; - } - This->icns_image = malloc(frame->width * frame->height * 4); - if (!This->icns_image) - { - WARN("failed to allocate image buffer\n"); - return E_FAIL; - } - This->lines_written = 0; - - return S_OK; -} - -static HRESULT CDECL IcnsEncoder_write_lines(struct encoder* iface, - BYTE *data, DWORD line_count, DWORD stride) -{ - IcnsEncoder *This = impl_from_encoder(iface); - UINT i; - - for (i = 0; i < line_count; i++) - { - BYTE *src_row, *dst_row; - UINT j; - src_row = data + stride * i; - dst_row = This->icns_image + (This->lines_written + i)*(This->frame.width*4); - /* swap bgr -> rgb */ - for (j = 0; j < This->frame.width*4; j += 4) - { - dst_row[j] = src_row[j+3]; - dst_row[j+1] = src_row[j+2]; - dst_row[j+2] = src_row[j+1]; - dst_row[j+3] = src_row[j]; - } - } - This->lines_written += line_count; - - return S_OK; -} - -static HRESULT CDECL IcnsEncoder_commit_frame(struct encoder *iface) -{ - IcnsEncoder *This = impl_from_encoder(iface); - Handle handle; - OSErr ret; - - ret = PtrToHand(This->icns_image, &handle, This->frame.width * This->frame.height * 4); - if (ret != noErr || !handle) - { - WARN("PtrToHand failed with error %d\n", ret); - return E_FAIL; - } - - ret = SetIconFamilyData(This->icns_family, This->icns_type, handle); - DisposeHandle(handle); - - if (ret != noErr) - { - WARN("SetIconFamilyData failed for image with error %d\n", ret); - return E_FAIL; - } - - free(This->icns_image); - This->icns_image = NULL; - - return S_OK; -} - -static HRESULT CDECL IcnsEncoder_initialize(struct encoder *iface, IStream *stream) -{ - IcnsEncoder *This = impl_from_encoder(iface); - - This->icns_family = (IconFamilyHandle)NewHandle(0); - if (!This->icns_family) - { - WARN("error creating icns family\n"); - return E_FAIL; - } - - This->stream = stream; - - return S_OK; -} - -static HRESULT CDECL IcnsEncoder_commit_file(struct encoder *iface) -{ - IcnsEncoder *This = impl_from_encoder(iface); - size_t buffer_size; - HRESULT hr = S_OK; - ULONG byteswritten; - - buffer_size = GetHandleSize((Handle)This->icns_family); - hr = stream_write(This->stream, *This->icns_family, buffer_size, &byteswritten); - if (FAILED(hr) || byteswritten != buffer_size) - { - WARN("writing file failed, hr = 0x%08X\n", hr); - return E_FAIL; - } - - return S_OK; -} - -static const struct encoder_funcs IcnsEncoder_vtable = { - IcnsEncoder_initialize, - IcnsEncoder_get_supported_format, - IcnsEncoder_create_frame, - IcnsEncoder_write_lines, - IcnsEncoder_commit_frame, - IcnsEncoder_commit_file, - IcnsEncoder_destroy -}; - -HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result) -{ - IcnsEncoder *This; - - TRACE("\n"); - - This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(IcnsEncoder)); - if (!This) return E_OUTOFMEMORY; - - This->encoder.vtable = &IcnsEncoder_vtable; - This->stream = NULL; - This->icns_family = NULL; - This->icns_image = NULL; - - *result = &This->encoder; - info->flags = ENCODER_FLAGS_MULTI_FRAME|ENCODER_FLAGS_ICNS_SIZE; - info->container_format = GUID_WineContainerFormatIcns; - info->clsid = CLSID_WICIcnsEncoder; - info->encoder_options[0] = ENCODER_OPTION_END; - - return S_OK; -} - -#else /* !defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) || - MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 */ - -HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result) -{ - ERR("Trying to save ICNS picture, but ICNS support is not compiled in.\n"); - return E_FAIL; -} - -#endif diff --git a/dlls/windowscodecs/main.c b/dlls/windowscodecs/main.c index c5f25f95561..ec6e3605b4f 100644 --- a/dlls/windowscodecs/main.c +++ b/dlls/windowscodecs/main.c @@ -130,17 +130,3 @@ HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) return hr; } - -HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) -{ - HRESULT hr; - struct encoder *encoder; - struct encoder_info encoder_info; - - hr = get_unix_encoder(&CLSID_WICIcnsEncoder, &encoder_info, &encoder); - - if (SUCCEEDED(hr)) - hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv); - - return hr; -} diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index 5ab43353320..597296b7f9d 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -1466,11 +1466,6 @@ static GUID const * const tiff_encode_formats[] = { NULL }; -static GUID const * const icns_encode_formats[] = { - &GUID_WICPixelFormat32bppBGRA, - NULL -}; - static struct regsvr_encoder const encoder_list[] = { { &CLSID_WICBmpEncoder, "The Wine Project", @@ -1522,16 +1517,6 @@ static struct regsvr_encoder const encoder_list[] = { ".tif;.tiff", tiff_encode_formats }, - { &CLSID_WICIcnsEncoder, - "The Wine Project", - "ICNS Encoder", - "1.0.0.0", - &GUID_VendorWine, - &GUID_WineContainerFormatIcns, - "image/icns", - ".icns", - icns_encode_formats - }, { NULL } /* list terminator */ }; diff --git a/dlls/windowscodecs/unix_lib.c b/dlls/windowscodecs/unix_lib.c index 8d4dfc64da9..e43dc1b8d45 100644 --- a/dlls/windowscodecs/unix_lib.c +++ b/dlls/windowscodecs/unix_lib.c @@ -74,9 +74,6 @@ HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *in HRESULT CDECL encoder_create(const CLSID *encoder_clsid, struct encoder_info *info, struct encoder **result) { - if (IsEqualGUID(encoder_clsid, &CLSID_WICIcnsEncoder)) - return icns_encoder_create(info, result); - return E_NOTIMPL; } diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 78a01a983c0..7991f93db10 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -26,12 +26,8 @@ DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04); -DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c); - DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22); -DEFINE_GUID(GUID_WineContainerFormatIcns, 0xe4cd3e69,0x4436,0x4363,0x98,0x1d,0xcc,0xf0,0x5a,0x87,0x4c,0x73); - DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); extern IID IID_IMILBitmap; @@ -150,7 +146,6 @@ extern HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDE extern HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT DdsEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; diff --git a/dlls/windowscodecs/windowscodecs_wincodec.idl b/dlls/windowscodecs/windowscodecs_wincodec.idl index ed8154051ef..ca467226dff 100644 --- a/dlls/windowscodecs/windowscodecs_wincodec.idl +++ b/dlls/windowscodecs/windowscodecs_wincodec.idl @@ -118,13 +118,6 @@ coclass WICTiffDecoder { interface IWICBitmapDecoder; } ] coclass WICTiffEncoder { interface IWICBitmapEncoder; } -[ - helpstring("WIC ICNS Encoder"), - threading(both), - uuid(312fb6f1-b767-409d-8a6d-0fc154d4f05c) -] -coclass WICIcnsEncoder { interface IWICBitmapEncoder; } - [ helpstring("WIC DDS Decoder"), threading(both),