mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
windowscodecs-GIF_Encoder: Update patchset.
This commit is contained in:
parent
5216147032
commit
d165f2f23b
@ -2064,6 +2064,20 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
enable_wined3d_Silence_FIXMEs=1
|
||||
fi
|
||||
|
||||
if test "$enable_windowscodecs_IWICPalette_InitializeFromBitmap" -eq 1; then
|
||||
if test "$enable_gdiplus_Grayscale_PNG" -gt 1; then
|
||||
abort "Patchset gdiplus-Grayscale_PNG disabled, but windowscodecs-IWICPalette_InitializeFromBitmap depends on that."
|
||||
fi
|
||||
enable_gdiplus_Grayscale_PNG=1
|
||||
fi
|
||||
|
||||
if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
|
||||
if test "$enable_windowscodecs_Palette_Images" -gt 1; then
|
||||
abort "Patchset windowscodecs-Palette_Images disabled, but windowscodecs-GIF_Encoder depends on that."
|
||||
fi
|
||||
enable_windowscodecs_Palette_Images=1
|
||||
fi
|
||||
|
||||
if test "$enable_windowscodecs_Palette_Images" -eq 1; then
|
||||
if test "$enable_gdiplus_Grayscale_PNG" -gt 1; then
|
||||
abort "Patchset gdiplus-Grayscale_PNG disabled, but windowscodecs-Palette_Images depends on that."
|
||||
@ -2075,13 +2089,6 @@ if test "$enable_windowscodecs_Palette_Images" -eq 1; then
|
||||
enable_windowscodecs_32bppGrayFloat=1
|
||||
fi
|
||||
|
||||
if test "$enable_windowscodecs_IWICPalette_InitializeFromBitmap" -eq 1; then
|
||||
if test "$enable_gdiplus_Grayscale_PNG" -gt 1; then
|
||||
abort "Patchset gdiplus-Grayscale_PNG disabled, but windowscodecs-IWICPalette_InitializeFromBitmap depends on that."
|
||||
fi
|
||||
enable_gdiplus_Grayscale_PNG=1
|
||||
fi
|
||||
|
||||
if test "$enable_uxtheme_GTK_Theming" -eq 1; then
|
||||
if test "$enable_ntdll_DllRedirects" -gt 1; then
|
||||
abort "Patchset ntdll-DllRedirects disabled, but uxtheme-GTK_Theming depends on that."
|
||||
@ -7206,80 +7213,6 @@ if test "$enable_windowscodecs_32bppGrayFloat" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-GIF_Encoder
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c, dlls/windowscodecs/bmpencode.c, dlls/windowscodecs/clsfactory.c,
|
||||
# | dlls/windowscodecs/gifformat.c, dlls/windowscodecs/info.c, dlls/windowscodecs/jpegformat.c, dlls/windowscodecs/regsvr.c,
|
||||
# | dlls/windowscodecs/tiffformat.c, dlls/windowscodecs/wincodecs_private.h
|
||||
# |
|
||||
if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
|
||||
patch_apply windowscodecs-GIF_Encoder/0001-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0002-windowscodecs-Implement-IWICBitmapEncoderInfo-GetFil.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0003-windowscodecs-Implement-IWICBitmapFrameEncode-SetPal.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0004-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0005-windowscodecs-Avoid-crashing-if-no-IPropertyBag2-was.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0006-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0007-windowscodecs-Avoid-crashing-if-no-IPropertyBag2-was.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0008-windowscodecs-Add-initial-implementation-of-the-GIF-.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0009-gdiplus-Fix-a-typo-in-GIF-container-format-passed-to.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0010-windowscodecs-Initialize-empty-property-bag-in-GIF-e.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in BMP encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoderInfo::GetFileExtensions.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapFrameEncode::SetPalette in JPEG encoder,.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in JPEG encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid crashing if no IPropertyBag2 was passed to IWICBitmapEncoder::CreateNewFrame in JPEG encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in TIFF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid crashing if no IPropertyBag2 was passed to IWICBitmapEncoder::CreateNewFrame in TIFF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add initial implementation of the GIF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "gdiplus: Fix a typo in GIF container format passed to encode_image_wic().", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Initialize empty property bag in GIF encoder'\''s CreateNewFrame implementation.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-IMILBitmapSource
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#34764] Improve compatibility of IMILBitmapSource interface
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/windowscodecs/bitmap.c, dlls/windowscodecs/scaler.c, dlls/windowscodecs/wincodecs_private.h
|
||||
# |
|
||||
if test "$enable_windowscodecs_IMILBitmapSource" -eq 1; then
|
||||
patch_apply windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch
|
||||
patch_apply windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Improve compatibility of IMILBitmapSource interface.", 3 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add support for IMILBitmapScaler interface.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-IWICPalette_InitializeFromBitmap
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * gdiplus-Grayscale_PNG
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#39890] Implement IWICPalette::InitializeFromBitmap
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/gdiplus/gdiplus.spec, dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c, dlls/windowscodecs/palette.c,
|
||||
# | dlls/windowscodecs/tests/palette.c, include/gdiplusflat.h
|
||||
# |
|
||||
if test "$enable_windowscodecs_IWICPalette_InitializeFromBitmap" -eq 1; then
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0001-windowscodecs-tests-Add-some-tests-for-IWICPalette-I.patch
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0002-windowscodecs-Implement-IWICPalette-InitializeFromBi.patch
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0003-gdiplus-Implement-GdipInitializePalette.-v2.patch
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0004-gdiplus-tests-Add-some-tests-for-GdipInitializePalet.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add some tests for IWICPalette::InitializeFromBitmap.", 2 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICPalette::InitializeFromBitmap.", 5 },';
|
||||
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipInitializePalette.", 2 },';
|
||||
echo '+ { "Dmitry Timoshkov", "gdiplus/tests: Add some tests for GdipInitializePalette.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-Palette_Images
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
@ -7339,6 +7272,117 @@ if test "$enable_windowscodecs_Palette_Images" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-GIF_Encoder
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * gdiplus-Grayscale_PNG, windowscodecs-32bppGrayFloat, windowscodecs-Palette_Images
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c, dlls/windowscodecs/bmpencode.c, dlls/windowscodecs/clsfactory.c,
|
||||
# | dlls/windowscodecs/converter.c, dlls/windowscodecs/gifformat.c, dlls/windowscodecs/info.c,
|
||||
# | dlls/windowscodecs/jpegformat.c, dlls/windowscodecs/metadataquery.c, dlls/windowscodecs/pngformat.c,
|
||||
# | dlls/windowscodecs/regsvr.c, dlls/windowscodecs/tests/converter.c, dlls/windowscodecs/tiffformat.c,
|
||||
# | dlls/windowscodecs/wincodecs_private.h, dlls/windowscodecs/windowscodecs_wincodec.idl
|
||||
# |
|
||||
if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
|
||||
patch_apply windowscodecs-GIF_Encoder/0001-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0002-windowscodecs-Implement-IWICBitmapEncoderInfo-GetFil.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0003-windowscodecs-Implement-IWICBitmapFrameEncode-SetPal.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0004-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0005-windowscodecs-Avoid-crashing-if-no-IPropertyBag2-was.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0006-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0007-windowscodecs-Avoid-crashing-if-no-IPropertyBag2-was.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0008-windowscodecs-Add-initial-implementation-of-the-GIF-.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0009-gdiplus-Fix-a-typo-in-GIF-container-format-passed-to.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0010-windowscodecs-Initialize-empty-property-bag-in-GIF-e.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0011-windowscodecs-Add-registration-for-GUID_WICPixelForm.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0012-windowscodecs-Implement-IWICBitmapDecoder-GetMetadat.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0013-windowscodecs-Improve-stub-for-IWICMetadataQueryRead.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0014-windowscodecs-Fix-the-buffer-size-check-in-the-TIFF-.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0015-windowscodecs-Add-support-for-converting-to-8bppInde.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0016-windowscodecs-WICConvertBitmapSource-should-ask-IWIC.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0017-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0018-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0019-windowscodecs-Improve-stub-for-IWICBitmapDecoder-Get.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0020-windowscodecs-Add-registration-of-the-GIF-encoder.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0021-windowscodecs-Fix-IWICBitmapDecoder-CopyPalette-for-.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0022-windowscodecs-Better-follow-the-GIF-spec-and-don-t-s.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0023-windowscodecs-Fix-behaviour-of-format-converter-for-.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0024-windowscodecs-tests-Add-a-bunch-of-new-tests-for-ind.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0025-windowscodecs-tests-Add-some-tests-for-converting-24.patch
|
||||
patch_apply windowscodecs-GIF_Encoder/0026-windowscodecs-tests-Add-the-tests-for-GIF-encoder-an.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in BMP encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoderInfo::GetFileExtensions.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapFrameEncode::SetPalette in JPEG encoder,.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in JPEG encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid crashing if no IPropertyBag2 was passed to IWICBitmapEncoder::CreateNewFrame in JPEG encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in TIFF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid crashing if no IPropertyBag2 was passed to IWICBitmapEncoder::CreateNewFrame in TIFF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add initial implementation of the GIF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "gdiplus: Fix a typo in GIF container format passed to encode_image_wic().", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Initialize empty property bag in GIF encoder'\''s CreateNewFrame implementation.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add registration for GUID_WICPixelFormat32bppGrayFloat pixel format.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapDecoder::GetMetadataQueryReader in the TIFF decoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Improve stub for IWICMetadataQueryReader::GetMetadataByName.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Fix the buffer size check in the TIFF decoder'\''s IWICBitmapFrameDecode::CopyPixels implementation.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add support for converting to 8bppIndexed format to IWICFormatConverter.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: WICConvertBitmapSource should ask IWICFormatConverter::Initialize to use an optimized palette.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the JPEG encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the PNG encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Improve stub for IWICBitmapDecoder::GetMetadataQueryReader in the PNG decoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add registration of the GIF encoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Fix IWICBitmapDecoder::CopyPalette for a not initialized case in the GIF decoder.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Better follow the GIF spec and don'\''t specify the local color table size if there is no local palette.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Fix behaviour of format converter for indexed formats when NULL or empty palette has been provided.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add a bunch of new tests for indexed format conversions.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add some tests for converting 24bppBGR to 8bppIndexed format.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add the tests for GIF encoder and decoder.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-IMILBitmapSource
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#34764] Improve compatibility of IMILBitmapSource interface
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/windowscodecs/bitmap.c, dlls/windowscodecs/scaler.c, dlls/windowscodecs/wincodecs_private.h
|
||||
# |
|
||||
if test "$enable_windowscodecs_IMILBitmapSource" -eq 1; then
|
||||
patch_apply windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch
|
||||
patch_apply windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Improve compatibility of IMILBitmapSource interface.", 3 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add support for IMILBitmapScaler interface.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-IWICPalette_InitializeFromBitmap
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * gdiplus-Grayscale_PNG
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#39890] Implement IWICPalette::InitializeFromBitmap
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/gdiplus/gdiplus.spec, dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c, dlls/windowscodecs/palette.c,
|
||||
# | dlls/windowscodecs/tests/palette.c, include/gdiplusflat.h
|
||||
# |
|
||||
if test "$enable_windowscodecs_IWICPalette_InitializeFromBitmap" -eq 1; then
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0001-windowscodecs-tests-Add-some-tests-for-IWICPalette-I.patch
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0002-windowscodecs-Implement-IWICPalette-InitializeFromBi.patch
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0003-gdiplus-Implement-GdipInitializePalette.-v2.patch
|
||||
patch_apply windowscodecs-IWICPalette_InitializeFromBitmap/0004-gdiplus-tests-Add-some-tests-for-GdipInitializePalet.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add some tests for IWICPalette::InitializeFromBitmap.", 2 },';
|
||||
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICPalette::InitializeFromBitmap.", 5 },';
|
||||
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipInitializePalette.", 2 },';
|
||||
echo '+ { "Dmitry Timoshkov", "gdiplus/tests: Add some tests for GdipInitializePalette.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset windowscodecs-WICCreateBitmapFromSection
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -0,0 +1,53 @@
|
||||
From 6d21d949439cb6e519029aee6bc55693f4cafc6c Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 20 Oct 2016 19:02:39 +0800
|
||||
Subject: windowscodecs: Add registration for GUID_WICPixelFormat32bppGrayFloat
|
||||
pixel format.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/regsvr.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
|
||||
index 74637f5..4516d3f 100644
|
||||
--- a/dlls/windowscodecs/regsvr.c
|
||||
+++ b/dlls/windowscodecs/regsvr.c
|
||||
@@ -1748,6 +1748,8 @@ static BYTE const channel_mask_16bit2[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
|
||||
static BYTE const channel_mask_16bit3[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 };
|
||||
static BYTE const channel_mask_16bit4[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
|
||||
|
||||
+static BYTE const channel_mask_32bit[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
|
||||
+
|
||||
static BYTE const channel_mask_5bit[] = { 0x1f, 0x00 };
|
||||
static BYTE const channel_mask_5bit2[] = { 0xe0, 0x03 };
|
||||
static BYTE const channel_mask_5bit3[] = { 0x00, 0x7c };
|
||||
@@ -1764,6 +1766,8 @@ static BYTE const * const channel_masks_8bit[] = { channel_mask_8bit,
|
||||
static BYTE const * const channel_masks_16bit[] = { channel_mask_16bit,
|
||||
channel_mask_16bit2, channel_mask_16bit3, channel_mask_16bit4};
|
||||
|
||||
+static BYTE const * const channel_masks_32bit[] = { channel_mask_32bit };
|
||||
+
|
||||
static BYTE const * const channel_masks_BGRA5551[] = { channel_mask_5bit,
|
||||
channel_mask_5bit2, channel_mask_5bit3, channel_mask_5bit4 };
|
||||
|
||||
@@ -1958,6 +1962,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
|
||||
WICPixelFormatNumericRepresentationUnsignedInteger,
|
||||
1
|
||||
},
|
||||
+ { &GUID_WICPixelFormat32bppGrayFloat,
|
||||
+ "The Wine Project",
|
||||
+ "32bpp GrayFloat",
|
||||
+ NULL, /* no version */
|
||||
+ &GUID_VendorMicrosoft,
|
||||
+ 32, /* bitsperpixel */
|
||||
+ 1, /* channel count */
|
||||
+ channel_masks_32bit,
|
||||
+ WICPixelFormatNumericRepresentationFloat,
|
||||
+ 1
|
||||
+ },
|
||||
{ &GUID_WICPixelFormat48bppRGB,
|
||||
"The Wine Project",
|
||||
"48bpp RGB",
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 2297b261c195840bcff9a3db40b25fcaaa747a7b Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 20 Oct 2016 16:49:08 +0800
|
||||
Subject: windowscodecs: Implement IWICBitmapDecoder::GetMetadataQueryReader in
|
||||
the TIFF decoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/tiffformat.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
|
||||
index 037277b..19aa5d5 100644
|
||||
--- a/dlls/windowscodecs/tiffformat.c
|
||||
+++ b/dlls/windowscodecs/tiffformat.c
|
||||
@@ -699,8 +699,12 @@ static HRESULT WINAPI TiffDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||
static HRESULT WINAPI TiffDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
|
||||
IWICMetadataQueryReader **ppIMetadataQueryReader)
|
||||
{
|
||||
- FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
|
||||
- return E_NOTIMPL;
|
||||
+ TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
|
||||
+
|
||||
+ if (!ppIMetadataQueryReader) return E_INVALIDARG;
|
||||
+
|
||||
+ *ppIMetadataQueryReader = NULL;
|
||||
+ return WINCODEC_ERR_UNSUPPORTEDOPERATION;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TiffDecoder_GetPreview(IWICBitmapDecoder *iface,
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,26 @@
|
||||
From a535cf73bc68b02cfd5fb8d03e86a442f472db4b Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 20 Oct 2016 16:50:20 +0800
|
||||
Subject: windowscodecs: Improve stub for
|
||||
IWICMetadataQueryReader::GetMetadataByName.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/metadataquery.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c
|
||||
index 10bf295..24de2f8 100644
|
||||
--- a/dlls/windowscodecs/metadataquery.c
|
||||
+++ b/dlls/windowscodecs/metadataquery.c
|
||||
@@ -109,7 +109,7 @@ static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface,
|
||||
{
|
||||
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
|
||||
FIXME("(%p,%s,%p)\n", This, wine_dbgstr_w(wzName), pvarValue);
|
||||
- return E_NOTIMPL;
|
||||
+ return WINCODEC_ERR_PROPERTYNOTFOUND;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI mqr_GetEnumerator(IWICMetadataQueryReader *iface,
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,30 @@
|
||||
From d34044e4deedfccf2bb0d7756fbddfd3197116fd Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 20 Oct 2016 19:05:02 +0800
|
||||
Subject: windowscodecs: Fix the buffer size check in the TIFF decoder's
|
||||
IWICBitmapFrameDecode::CopyPixels implementation.
|
||||
|
||||
Otherwise IWICBitmapSource::CopyPixels() after IWICImagingFactory::CreateBitmapFromSource()
|
||||
fails for an 24bpp RGB/BGR source.
|
||||
|
||||
The check is copied from BMP decoder implementation.
|
||||
---
|
||||
dlls/windowscodecs/tiffformat.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
|
||||
index 19aa5d5..f4f4a49 100644
|
||||
--- a/dlls/windowscodecs/tiffformat.c
|
||||
+++ b/dlls/windowscodecs/tiffformat.c
|
||||
@@ -1106,7 +1106,7 @@ static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
|
||||
if (cbStride < bytesperrow)
|
||||
return E_INVALIDARG;
|
||||
|
||||
- if ((cbStride * prc->Height) > cbBufferSize)
|
||||
+ if ((cbStride * (prc->Height-1)) + ((prc->Width * This->decode_info.bpp) + 7)/8 > cbBufferSize)
|
||||
return E_INVALIDARG;
|
||||
|
||||
min_tile_x = prc->X / This->decode_info.tile_width;
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,247 @@
|
||||
From 663ca5c7923458a158ede7c01aa23805b5941ecc Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 20 Oct 2016 16:56:40 +0800
|
||||
Subject: windowscodecs: Add support for converting to 8bppIndexed format to
|
||||
IWICFormatConverter.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/converter.c | 160 ++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 143 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
|
||||
index 3704060..c6a2514 100644
|
||||
--- a/dlls/windowscodecs/converter.c
|
||||
+++ b/dlls/windowscodecs/converter.c
|
||||
@@ -76,7 +76,7 @@ typedef struct FormatConverter {
|
||||
const struct pixelformatinfo *dst_format, *src_format;
|
||||
WICBitmapDitherType dither;
|
||||
double alpha_threshold;
|
||||
- WICBitmapPaletteType palette_type;
|
||||
+ IWICPalette *palette;
|
||||
CRITICAL_SECTION lock; /* must be held when initialized */
|
||||
} FormatConverter;
|
||||
|
||||
@@ -1187,11 +1187,96 @@ static HRESULT copypixels_to_8bppGray(struct FormatConverter *This, const WICRec
|
||||
return hr;
|
||||
}
|
||||
|
||||
+static UINT rgb_to_palette_index(BYTE r, BYTE g, BYTE b, WICColor *colors, UINT count)
|
||||
+{
|
||||
+ UINT best_diff, best_index, i;
|
||||
+
|
||||
+ best_diff = ~0;
|
||||
+ best_index = 0;
|
||||
+
|
||||
+ for (i = 0; i < count; i++)
|
||||
+ {
|
||||
+ BYTE pal_r, pal_g, pal_b;
|
||||
+ DWORD diff_r, diff_g, diff_b, diff;
|
||||
+
|
||||
+ pal_r = colors[i] >> 16;
|
||||
+ pal_g = colors[i] >> 8;
|
||||
+ pal_b = colors[i];
|
||||
+
|
||||
+ diff_r = r - pal_r;
|
||||
+ diff_g = g - pal_g;
|
||||
+ diff_b = b - pal_b;
|
||||
+
|
||||
+ diff = diff_r * diff_r + diff_g * diff_g + diff_b * diff_b;
|
||||
+ if (diff == 0) return i;
|
||||
+
|
||||
+ if (diff < best_diff)
|
||||
+ {
|
||||
+ best_diff = diff;
|
||||
+ best_index = i;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return best_index;
|
||||
+}
|
||||
+
|
||||
+static HRESULT copypixels_to_8bppIndexed(struct FormatConverter *This, const WICRect *prc,
|
||||
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+ BYTE *srcdata;
|
||||
+ WICColor colors[256];
|
||||
+ UINT srcstride, srcdatasize, count;
|
||||
+
|
||||
+ if (source_format == format_8bppIndexed)
|
||||
+ {
|
||||
+ if (prc)
|
||||
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer);
|
||||
+
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+
|
||||
+ if (!This->palette) return WINCODEC_ERR_WRONGSTATE;
|
||||
+
|
||||
+ hr = IWICPalette_GetColors(This->palette, 256, colors, &count);
|
||||
+ if (hr != S_OK) return hr;
|
||||
+ if (!count) return WINCODEC_ERR_WRONGSTATE;
|
||||
+
|
||||
+ srcstride = 3 * prc->Width;
|
||||
+ srcdatasize = srcstride * prc->Height;
|
||||
+
|
||||
+ srcdata = HeapAlloc(GetProcessHeap(), 0, srcdatasize);
|
||||
+ if (!srcdata) return E_OUTOFMEMORY;
|
||||
+
|
||||
+ hr = copypixels_to_24bppBGR(This, prc, srcstride, srcdatasize, srcdata, source_format);
|
||||
+ if (SUCCEEDED(hr) && prc)
|
||||
+ {
|
||||
+ INT x, y;
|
||||
+ BYTE *src = srcdata, *dst = pbBuffer;
|
||||
+
|
||||
+ for (y = 0; y < prc->Height; y++)
|
||||
+ {
|
||||
+ BYTE *bgr = src;
|
||||
+
|
||||
+ for (x = 0; x < prc->Width; x++)
|
||||
+ {
|
||||
+ dst[x] = rgb_to_palette_index(bgr[2], bgr[1], bgr[0], colors, count);
|
||||
+ bgr += 3;
|
||||
+ }
|
||||
+ src += srcstride;
|
||||
+ dst += cbStride;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, srcdata);
|
||||
+ return hr;
|
||||
+}
|
||||
+
|
||||
static const struct pixelformatinfo supported_formats[] = {
|
||||
{format_1bppIndexed, &GUID_WICPixelFormat1bppIndexed, NULL},
|
||||
{format_2bppIndexed, &GUID_WICPixelFormat2bppIndexed, NULL},
|
||||
{format_4bppIndexed, &GUID_WICPixelFormat4bppIndexed, NULL},
|
||||
- {format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, NULL},
|
||||
+ {format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, copypixels_to_8bppIndexed},
|
||||
{format_BlackWhite, &GUID_WICPixelFormatBlackWhite, NULL},
|
||||
{format_2bppGray, &GUID_WICPixelFormat2bppGray, NULL},
|
||||
{format_4bppGray, &GUID_WICPixelFormat4bppGray, NULL},
|
||||
@@ -1268,6 +1353,7 @@ static ULONG WINAPI FormatConverter_Release(IWICFormatConverter *iface)
|
||||
This->lock.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->lock);
|
||||
if (This->source) IWICBitmapSource_Release(This->source);
|
||||
+ if (This->palette) IWICPalette_Release(This->palette);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
@@ -1316,10 +1402,16 @@ static HRESULT WINAPI FormatConverter_GetResolution(IWICFormatConverter *iface,
|
||||
}
|
||||
|
||||
static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface,
|
||||
- IWICPalette *pIPalette)
|
||||
+ IWICPalette *palette)
|
||||
{
|
||||
- FIXME("(%p,%p): stub\n", iface, pIPalette);
|
||||
- return E_NOTIMPL;
|
||||
+ FormatConverter *This = impl_from_IWICFormatConverter(iface);
|
||||
+
|
||||
+ TRACE("(%p,%p)\n", iface, palette);
|
||||
+
|
||||
+ if (!palette) return E_INVALIDARG;
|
||||
+ if (!This->palette) return WINCODEC_ERR_WRONGSTATE;
|
||||
+
|
||||
+ return IWICPalette_InitializeFromPalette(palette, This->palette);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface,
|
||||
@@ -1352,19 +1444,52 @@ static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface,
|
||||
}
|
||||
|
||||
static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
|
||||
- IWICBitmapSource *pISource, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither,
|
||||
- IWICPalette *pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate)
|
||||
+ IWICBitmapSource *source, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither,
|
||||
+ IWICPalette *palette, double alpha_threshold, WICBitmapPaletteType palette_type)
|
||||
{
|
||||
FormatConverter *This = impl_from_IWICFormatConverter(iface);
|
||||
const struct pixelformatinfo *srcinfo, *dstinfo;
|
||||
- static INT fixme=0;
|
||||
GUID srcFormat;
|
||||
- HRESULT res=S_OK;
|
||||
+ HRESULT res;
|
||||
+
|
||||
+ TRACE("(%p,%p,%s,%u,%p,%0.3f,%u)\n", iface, source, debugstr_guid(dstFormat),
|
||||
+ dither, palette, alpha_threshold, palette_type);
|
||||
+
|
||||
+ if (!palette)
|
||||
+ {
|
||||
+ res = PaletteImpl_Create(&palette);
|
||||
+ if (res != S_OK) return res;
|
||||
+
|
||||
+ switch (palette_type)
|
||||
+ {
|
||||
+ case WICBitmapPaletteTypeCustom:
|
||||
+ IWICPalette_Release(palette);
|
||||
+ palette = NULL;
|
||||
+ res = S_OK;
|
||||
+ break;
|
||||
+
|
||||
+ case WICBitmapPaletteTypeMedianCut:
|
||||
+ {
|
||||
+ UINT bpp;
|
||||
+ res = get_pixelformat_bpp(dstFormat, &bpp);
|
||||
+ if (res == S_OK && bpp <= 8)
|
||||
+ res = IWICPalette_InitializeFromBitmap(palette, source, 1 << bpp, FALSE);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- TRACE("(%p,%p,%s,%u,%p,%0.1f,%u)\n", iface, pISource, debugstr_guid(dstFormat),
|
||||
- dither, pIPalette, alphaThresholdPercent, paletteTranslate);
|
||||
+ default:
|
||||
+ res = IWICPalette_InitializePredefined(palette, palette_type, FALSE);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- if (pIPalette && !fixme++) FIXME("ignoring palette\n");
|
||||
+ if (res != S_OK)
|
||||
+ {
|
||||
+ IWICPalette_Release(palette);
|
||||
+ return res;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ IWICPalette_AddRef(palette);
|
||||
|
||||
EnterCriticalSection(&This->lock);
|
||||
|
||||
@@ -1374,7 +1499,7 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
|
||||
goto end;
|
||||
}
|
||||
|
||||
- res = IWICBitmapSource_GetPixelFormat(pISource, &srcFormat);
|
||||
+ res = IWICBitmapSource_GetPixelFormat(source, &srcFormat);
|
||||
if (FAILED(res)) goto end;
|
||||
|
||||
srcinfo = get_formatinfo(&srcFormat);
|
||||
@@ -1395,13 +1520,13 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
|
||||
|
||||
if (dstinfo->copy_function)
|
||||
{
|
||||
- IWICBitmapSource_AddRef(pISource);
|
||||
+ IWICBitmapSource_AddRef(source);
|
||||
This->src_format = srcinfo;
|
||||
This->dst_format = dstinfo;
|
||||
This->dither = dither;
|
||||
- This->alpha_threshold = alphaThresholdPercent;
|
||||
- This->palette_type = paletteTranslate;
|
||||
- This->source = pISource;
|
||||
+ This->alpha_threshold = alpha_threshold;
|
||||
+ This->palette = palette;
|
||||
+ This->source = source;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1480,6 +1605,7 @@ HRESULT FormatConverter_CreateInstance(REFIID iid, void** ppv)
|
||||
This->IWICFormatConverter_iface.lpVtbl = &FormatConverter_Vtbl;
|
||||
This->ref = 1;
|
||||
This->source = NULL;
|
||||
+ This->palette = NULL;
|
||||
InitializeCriticalSection(&This->lock);
|
||||
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FormatConverter.lock");
|
||||
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 8d2a6325a891a2fab8bf7c091cb8fb73468ae1ea Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 20 Oct 2016 16:57:51 +0800
|
||||
Subject: windowscodecs: WICConvertBitmapSource should ask
|
||||
IWICFormatConverter::Initialize to use an optimized palette.
|
||||
|
||||
This matches Windows' behaviour, and makes a simple test application that converts
|
||||
any WIC compatible RGB(A) source image to 8bppIndexed format (GIF for instance) work.
|
||||
---
|
||||
dlls/windowscodecs/info.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
|
||||
index 1a93491..c1e8a66 100644
|
||||
--- a/dlls/windowscodecs/info.c
|
||||
+++ b/dlls/windowscodecs/info.c
|
||||
@@ -2336,7 +2336,7 @@ HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitma
|
||||
|
||||
if (SUCCEEDED(res) && canconvert)
|
||||
res = IWICFormatConverter_Initialize(converter, pISrc, dstFormat, WICBitmapDitherTypeNone,
|
||||
- NULL, 0.0, WICBitmapPaletteTypeCustom);
|
||||
+ NULL, 0.0, WICBitmapPaletteTypeMedianCut);
|
||||
|
||||
if (FAILED(res) || !canconvert)
|
||||
{
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,35 @@
|
||||
From e2d172c5ac68abd6205c2cb63e2a58597e64ec8c Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Fri, 21 Oct 2016 14:32:25 +0800
|
||||
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the
|
||||
JPEG encoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/jpegformat.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
|
||||
index 45bb88f..2b1be0a 100644
|
||||
--- a/dlls/windowscodecs/jpegformat.c
|
||||
+++ b/dlls/windowscodecs/jpegformat.c
|
||||
@@ -416,10 +416,14 @@ static HRESULT WINAPI JpegDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JpegDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
|
||||
- IWICMetadataQueryReader **ppIMetadataQueryReader)
|
||||
+ IWICMetadataQueryReader **reader)
|
||||
{
|
||||
- FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
|
||||
- return E_NOTIMPL;
|
||||
+ FIXME("(%p,%p): stub\n", iface, reader);
|
||||
+
|
||||
+ if (!reader) return E_INVALIDARG;
|
||||
+
|
||||
+ *reader = NULL;
|
||||
+ return WINCODEC_ERR_UNSUPPORTEDOPERATION;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JpegDecoder_GetPreview(IWICBitmapDecoder *iface,
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,44 @@
|
||||
From b0dda2778cbd2c33b90f2f500013f48c6fdb0b58 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Fri, 21 Oct 2016 14:36:21 +0800
|
||||
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the PNG
|
||||
encoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/pngformat.c | 19 +++++++++++++++----
|
||||
1 file changed, 15 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
|
||||
index 1a409ae..94253d3 100644
|
||||
--- a/dlls/windowscodecs/pngformat.c
|
||||
+++ b/dlls/windowscodecs/pngformat.c
|
||||
@@ -1936,11 +1936,22 @@ static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
-static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
|
||||
- IWICBitmapEncoderInfo **ppIEncoderInfo)
|
||||
+static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info)
|
||||
{
|
||||
- FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo);
|
||||
- return E_NOTIMPL;
|
||||
+ IWICComponentInfo *comp_info;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ TRACE("%p,%p\n", iface, info);
|
||||
+
|
||||
+ if (!info) return E_INVALIDARG;
|
||||
+
|
||||
+ hr = CreateComponentInfo(&CLSID_WICPngEncoder, &comp_info);
|
||||
+ if (hr == S_OK)
|
||||
+ {
|
||||
+ hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info);
|
||||
+ IWICComponentInfo_Release(comp_info);
|
||||
+ }
|
||||
+ return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PngEncoder_SetColorContexts(IWICBitmapEncoder *iface,
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 3204ee4de19693fd9e451a62216b68fe51ea2ca5 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Fri, 21 Oct 2016 14:38:43 +0800
|
||||
Subject: windowscodecs: Improve stub for
|
||||
IWICBitmapDecoder::GetMetadataQueryReader in the PNG decoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/pngformat.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
|
||||
index 94253d3..41d9099 100644
|
||||
--- a/dlls/windowscodecs/pngformat.c
|
||||
+++ b/dlls/windowscodecs/pngformat.c
|
||||
@@ -853,10 +853,14 @@ static HRESULT WINAPI PngDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PngDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
|
||||
- IWICMetadataQueryReader **ppIMetadataQueryReader)
|
||||
+ IWICMetadataQueryReader **reader)
|
||||
{
|
||||
- FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
|
||||
- return E_NOTIMPL;
|
||||
+ FIXME("(%p,%p): stub\n", iface, reader);
|
||||
+
|
||||
+ if (!reader) return E_INVALIDARG;
|
||||
+
|
||||
+ *reader = NULL;
|
||||
+ return WINCODEC_ERR_UNSUPPORTEDOPERATION;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PngDecoder_GetPreview(IWICBitmapDecoder *iface,
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 82ead58d02badf4e84124277868942b089d9b7ba Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 27 Oct 2016 14:48:45 +0800
|
||||
Subject: windowscodecs: Add registration of the GIF encoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/windowscodecs_wincodec.idl | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/dlls/windowscodecs/windowscodecs_wincodec.idl b/dlls/windowscodecs/windowscodecs_wincodec.idl
|
||||
index fd7ff01..1681b1d 100644
|
||||
--- a/dlls/windowscodecs/windowscodecs_wincodec.idl
|
||||
+++ b/dlls/windowscodecs/windowscodecs_wincodec.idl
|
||||
@@ -70,6 +70,13 @@ coclass WICBmpEncoder { interface IWICBitmapEncoder; }
|
||||
coclass WICGifDecoder { interface IWICBitmapDecoder; }
|
||||
|
||||
[
|
||||
+ helpstring("WIC GIF Encoder"),
|
||||
+ threading(both),
|
||||
+ uuid(114f5598-0b22-40a0-86a1-c83ea495adbd)
|
||||
+]
|
||||
+coclass WICGifEncoder { interface IWICBitmapEncoder; }
|
||||
+
|
||||
+[
|
||||
helpstring("WIC ICO Decoder"),
|
||||
threading(both),
|
||||
uuid(c61bfcdf-2e0f-4aad-a8d7-e06bafebcdfe)
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,27 @@
|
||||
From fe01c9d286b55485fc241f42a617a3a75f2553c4 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 27 Oct 2016 14:50:03 +0800
|
||||
Subject: windowscodecs: Fix IWICBitmapDecoder::CopyPalette for a not
|
||||
initialized case in the GIF decoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/gifformat.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
|
||||
index 6052726..3dac59e 100644
|
||||
--- a/dlls/windowscodecs/gifformat.c
|
||||
+++ b/dlls/windowscodecs/gifformat.c
|
||||
@@ -1198,6 +1198,9 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
|
||||
|
||||
TRACE("(%p,%p)\n", iface, palette);
|
||||
|
||||
+ if (!This->gif)
|
||||
+ return WINCODEC_ERR_WRONGSTATE;
|
||||
+
|
||||
cm = This->gif->SColorMap;
|
||||
if (cm)
|
||||
{
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 855d2b2c5a978f441a2f2f1343fb53b03b3568c9 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 27 Oct 2016 14:52:43 +0800
|
||||
Subject: windowscodecs: Better follow the GIF spec and don't specify the local
|
||||
color table size if there is no local palette.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/gifformat.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
|
||||
index 3dac59e..9d0ae6b 100644
|
||||
--- a/dlls/windowscodecs/gifformat.c
|
||||
+++ b/dlls/windowscodecs/gifformat.c
|
||||
@@ -2070,9 +2070,11 @@ static HRESULT WINAPI GifFrameEncode_Commit(IWICBitmapFrameEncode *iface)
|
||||
imd.height = This->height;
|
||||
imd.packed = 0;
|
||||
if (This->colors)
|
||||
+ {
|
||||
imd.packed |= 0x80; /* local color table flag */
|
||||
+ imd.packed |= 0x07; /* local color table size */
|
||||
+ }
|
||||
/* FIXME: interlace flag */
|
||||
- imd.packed |= 0x07; /* local color table size */
|
||||
hr = IStream_Write(This->encoder->stream, &imd, sizeof(imd), NULL);
|
||||
if (hr == S_OK && This->colors)
|
||||
{
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,100 @@
|
||||
From 9ddafc9d2cd0fc899e513807a34ef4e875851fca Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 27 Oct 2016 14:55:03 +0800
|
||||
Subject: windowscodecs: Fix behaviour of format converter for indexed formats
|
||||
when NULL or empty palette has been provided.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/converter.c | 32 ++++++++++++++++++++++++--------
|
||||
1 file changed, 24 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
|
||||
index c6a2514..4ee980e 100644
|
||||
--- a/dlls/windowscodecs/converter.c
|
||||
+++ b/dlls/windowscodecs/converter.c
|
||||
@@ -1240,7 +1240,6 @@ static HRESULT copypixels_to_8bppIndexed(struct FormatConverter *This, const WIC
|
||||
|
||||
hr = IWICPalette_GetColors(This->palette, 256, colors, &count);
|
||||
if (hr != S_OK) return hr;
|
||||
- if (!count) return WINCODEC_ERR_WRONGSTATE;
|
||||
|
||||
srcstride = 3 * prc->Width;
|
||||
srcdatasize = srcstride * prc->Height;
|
||||
@@ -1409,7 +1408,18 @@ static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface,
|
||||
TRACE("(%p,%p)\n", iface, palette);
|
||||
|
||||
if (!palette) return E_INVALIDARG;
|
||||
- if (!This->palette) return WINCODEC_ERR_WRONGSTATE;
|
||||
+ if (!This->source) return WINCODEC_ERR_WRONGSTATE;
|
||||
+
|
||||
+ if (!This->palette)
|
||||
+ {
|
||||
+ HRESULT hr;
|
||||
+ UINT bpp;
|
||||
+
|
||||
+ hr = get_pixelformat_bpp(This->dst_format->guid, &bpp);
|
||||
+ if (hr != S_OK) return hr;
|
||||
+ if (bpp <= 8) return WINCODEC_ERR_WRONGSTATE;
|
||||
+ return IWICBitmapSource_CopyPalette(This->source, palette);
|
||||
+ }
|
||||
|
||||
return IWICPalette_InitializeFromPalette(palette, This->palette);
|
||||
}
|
||||
@@ -1440,7 +1450,7 @@ static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface,
|
||||
pbBuffer, This->src_format->format);
|
||||
}
|
||||
else
|
||||
- return WINCODEC_ERR_NOTINITIALIZED;
|
||||
+ return WINCODEC_ERR_WRONGSTATE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
|
||||
@@ -1457,6 +1467,10 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
|
||||
|
||||
if (!palette)
|
||||
{
|
||||
+ UINT bpp;
|
||||
+ res = get_pixelformat_bpp(dstFormat, &bpp);
|
||||
+ if (res != S_OK) return res;
|
||||
+
|
||||
res = PaletteImpl_Create(&palette);
|
||||
if (res != S_OK) return res;
|
||||
|
||||
@@ -1465,20 +1479,19 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
|
||||
case WICBitmapPaletteTypeCustom:
|
||||
IWICPalette_Release(palette);
|
||||
palette = NULL;
|
||||
- res = S_OK;
|
||||
+ if (bpp <= 8) return E_INVALIDARG;
|
||||
break;
|
||||
|
||||
case WICBitmapPaletteTypeMedianCut:
|
||||
{
|
||||
- UINT bpp;
|
||||
- res = get_pixelformat_bpp(dstFormat, &bpp);
|
||||
- if (res == S_OK && bpp <= 8)
|
||||
+ if (bpp <= 8)
|
||||
res = IWICPalette_InitializeFromBitmap(palette, source, 1 << bpp, FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
- res = IWICPalette_InitializePredefined(palette, palette_type, FALSE);
|
||||
+ if (bpp <= 8)
|
||||
+ res = IWICPalette_InitializePredefined(palette, palette_type, FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1538,6 +1551,9 @@ end:
|
||||
|
||||
LeaveCriticalSection(&This->lock);
|
||||
|
||||
+ if (res != S_OK && palette)
|
||||
+ IWICPalette_Release(palette);
|
||||
+
|
||||
return res;
|
||||
}
|
||||
|
||||
--
|
||||
2.9.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,190 @@
|
||||
From cf2301cafab21d7a67cf7a3b3a11db0ed17d0042 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 27 Oct 2016 15:13:24 +0800
|
||||
Subject: windowscodecs/tests: Add some tests for converting 24bppBGR to
|
||||
8bppIndexed format.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/tests/converter.c | 159 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 159 insertions(+)
|
||||
|
||||
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
|
||||
index e6d21ac..b8ed4d4 100644
|
||||
--- a/dlls/windowscodecs/tests/converter.c
|
||||
+++ b/dlls/windowscodecs/tests/converter.c
|
||||
@@ -1459,6 +1459,163 @@ static const struct setting png_interlace_settings[] = {
|
||||
{NULL}
|
||||
};
|
||||
|
||||
+static void test_converter_8bppIndexed(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+ BitmapTestSrc *src_obj;
|
||||
+ IWICFormatConverter *converter;
|
||||
+ IWICPalette *palette;
|
||||
+ UINT count, i;
|
||||
+ BYTE buf[32 * 2 * 3]; /* enough to hold 32x2 24bppBGR data */
|
||||
+
|
||||
+ CreateTestBitmap(&testdata_24bppBGR, &src_obj);
|
||||
+
|
||||
+ hr = IWICImagingFactory_CreatePalette(factory, &palette);
|
||||
+ ok(hr == S_OK, "CreatePalette error %#x\n", hr);
|
||||
+ count = 0xdeadbeef;
|
||||
+ hr = IWICPalette_GetColorCount(palette, &count);
|
||||
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
|
||||
+ ok(count == 0, "expected 0, got %u\n", count);
|
||||
+
|
||||
+ /* NULL palette + Custom type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone,
|
||||
+ NULL, 0.0, WICBitmapPaletteTypeCustom);
|
||||
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == 0xdeadbeef, "unexpected error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32 * 3, sizeof(buf), buf);
|
||||
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ /* NULL palette + Custom type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
|
||||
+ NULL, 0.0, WICBitmapPaletteTypeCustom);
|
||||
+ ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
|
||||
+ ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ /* empty palette + Custom type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
|
||||
+ palette, 0.0, WICBitmapPaletteTypeCustom);
|
||||
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
|
||||
+ count = 0xdeadbeef;
|
||||
+ hr = IWICPalette_GetColorCount(palette, &count);
|
||||
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
|
||||
+ ok(count == 0, "expected 0, got %u\n", count);
|
||||
+ memset(buf, 0xaa, sizeof(buf));
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
|
||||
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
|
||||
+ count = 0;
|
||||
+ for (i = 0; i < 32 * 2; i++)
|
||||
+ if (buf[i] != 0) count++;
|
||||
+ ok(count == 0, "expected 0\n");
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ /* NULL palette + Predefined type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
|
||||
+ NULL, 0.0, WICBitmapPaletteTypeFixedGray16);
|
||||
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
|
||||
+ count = 0xdeadbeef;
|
||||
+ hr = IWICPalette_GetColorCount(palette, &count);
|
||||
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
|
||||
+ ok(count == 16, "expected 16, got %u\n", count);
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
|
||||
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
|
||||
+ count = 0;
|
||||
+ for (i = 0; i < 32 * 2; i++)
|
||||
+ if (buf[i] != 0) count++;
|
||||
+ ok(count != 0, "expected != 0\n");
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ /* not empty palette + Predefined type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
|
||||
+ palette, 0.0, WICBitmapPaletteTypeFixedHalftone64);
|
||||
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
|
||||
+ count = 0xdeadbeef;
|
||||
+ hr = IWICPalette_GetColorCount(palette, &count);
|
||||
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
|
||||
+ ok(count == 16, "expected 16, got %u\n", count);
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
|
||||
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
|
||||
+ count = 0;
|
||||
+ for (i = 0; i < 32 * 2; i++)
|
||||
+ if (buf[i] != 0) count++;
|
||||
+ ok(count != 0, "expected != 0\n");
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ /* not empty palette + MedianCut type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
|
||||
+ palette, 0.0, WICBitmapPaletteTypeMedianCut);
|
||||
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
|
||||
+ count = 0xdeadbeef;
|
||||
+ hr = IWICPalette_GetColorCount(palette, &count);
|
||||
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
|
||||
+ ok(count == 16, "expected 16, got %u\n", count);
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
|
||||
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
|
||||
+ count = 0;
|
||||
+ for (i = 0; i < 32 * 2; i++)
|
||||
+ if (buf[i] != 0) count++;
|
||||
+ ok(count != 0, "expected != 0\n");
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ /* NULL palette + MedianCut type*/
|
||||
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
|
||||
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
|
||||
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
|
||||
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
|
||||
+ NULL, 0.0, WICBitmapPaletteTypeMedianCut);
|
||||
+ ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#x\n", hr);
|
||||
+ if (hr == S_OK)
|
||||
+ {
|
||||
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
|
||||
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
|
||||
+ count = 0xdeadbeef;
|
||||
+ hr = IWICPalette_GetColorCount(palette, &count);
|
||||
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
|
||||
+ ok(count == 8, "expected 8, got %u\n", count);
|
||||
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
|
||||
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
|
||||
+ count = 0;
|
||||
+ for (i = 0; i < 32 * 2; i++)
|
||||
+ if (buf[i] != 0) count++;
|
||||
+ ok(count != 0, "expected != 0\n");
|
||||
+ }
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+
|
||||
+ IWICPalette_Release(palette);
|
||||
+ DeleteTestBitmap(src_obj);
|
||||
+}
|
||||
+
|
||||
START_TEST(converter)
|
||||
{
|
||||
HRESULT hr;
|
||||
@@ -1469,6 +1626,8 @@ START_TEST(converter)
|
||||
&IID_IWICImagingFactory, (void **)&factory);
|
||||
ok(hr == S_OK, "failed to create factory: %#x\n", hr);
|
||||
|
||||
+ test_converter_8bppIndexed();
|
||||
+
|
||||
test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 1bppIndexed", TRUE);
|
||||
test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 2bppIndexed", TRUE);
|
||||
test_conversion(&testdata_24bppRGB, &testdata_4bppIndexed, "24bppRGB -> 4bppIndexed", TRUE);
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,129 @@
|
||||
From e90eb83510bd3edbdc8ca8984cb9d0643b652fa1 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 27 Oct 2016 15:17:19 +0800
|
||||
Subject: windowscodecs/tests: Add the tests for GIF encoder and decoder.
|
||||
|
||||
---
|
||||
dlls/windowscodecs/tests/converter.c | 59 +++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 54 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
|
||||
index b8ed4d4..430c0ed 100644
|
||||
--- a/dlls/windowscodecs/tests/converter.c
|
||||
+++ b/dlls/windowscodecs/tests/converter.c
|
||||
@@ -1047,6 +1047,40 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
|
||||
ok(0, "unknown PNG pixel format %s\n", wine_dbgstr_guid(format));
|
||||
}
|
||||
|
||||
+static void check_gif_format(IStream *stream, const WICPixelFormatGUID *format)
|
||||
+{
|
||||
+#include "pshpack1.h"
|
||||
+ struct logical_screen_descriptor
|
||||
+ {
|
||||
+ char signature[6];
|
||||
+ USHORT width;
|
||||
+ USHORT height;
|
||||
+ BYTE packed;
|
||||
+ /* global_color_table_flag : 1;
|
||||
+ * color_resolution : 3;
|
||||
+ * sort_flag : 1;
|
||||
+ * global_color_table_size : 3;
|
||||
+ */
|
||||
+ BYTE background_color_index;
|
||||
+ BYTE pixel_aspect_ratio;
|
||||
+ } lsd;
|
||||
+#include "poppack.h"
|
||||
+ UINT color_resolution;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ memset(&lsd, 0, sizeof(lsd));
|
||||
+ hr = IStream_Read(stream, &lsd, sizeof(lsd), NULL);
|
||||
+ ok(hr == S_OK, "IStream_Read error %#x\n", hr);
|
||||
+
|
||||
+ ok(!memcmp(lsd.signature, "GIF89a", 6), "wrong GIF signature %.6s\n", lsd.signature);
|
||||
+
|
||||
+ ok(lsd.width == 32, "wrong width %u\n", lsd.width);
|
||||
+ ok(lsd.height == 2, "wrong height %u\n", lsd.height);
|
||||
+ color_resolution = 1 << (((lsd.packed >> 4) & 0x07) + 1);
|
||||
+ ok(color_resolution == 256, "wrong color resolution %u\n", color_resolution);
|
||||
+ ok(lsd.pixel_aspect_ratio == 0, "wrong pixel_aspect_ratio %u\n", lsd.pixel_aspect_ratio);
|
||||
+}
|
||||
+
|
||||
static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WICPixelFormatGUID *format)
|
||||
{
|
||||
HRESULT hr;
|
||||
@@ -1062,6 +1096,8 @@ static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WIC
|
||||
check_bmp_format(stream, format);
|
||||
else if (IsEqualGUID(encoder, &CLSID_WICTiffEncoder))
|
||||
check_tiff_format(stream, format);
|
||||
+ else if (IsEqualGUID(encoder, &CLSID_WICGifEncoder))
|
||||
+ check_gif_format(stream, format);
|
||||
else
|
||||
ok(0, "unknown encoder %s\n", wine_dbgstr_guid(encoder));
|
||||
|
||||
@@ -1094,7 +1130,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
||||
|
||||
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IWICBitmapEncoder, (void**)&encoder);
|
||||
- ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
|
||||
+ ok(SUCCEEDED(hr), "CoCreateInstance(%s) failed, hr=%x\n", wine_dbgstr_guid(clsid_encoder), hr);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hglobal = GlobalAlloc(GMEM_MOVEABLE, 0);
|
||||
@@ -1119,7 +1155,10 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
||||
if (palette)
|
||||
{
|
||||
hr = IWICBitmapEncoder_SetPalette(encoder, palette);
|
||||
- ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "wrong error %#x\n", hr);
|
||||
+ if (IsEqualGUID(clsid_encoder, &CLSID_WICGifEncoder))
|
||||
+ ok(hr == S_OK, "SetPalette failed, hr=%#x\n", hr);
|
||||
+ else
|
||||
+ ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "wrong error %#x\n", hr);
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
@@ -1248,13 +1287,19 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
||||
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
|
||||
|
||||
hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
|
||||
- ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
|
||||
+ if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
|
||||
+ ok(hr == WINCODEC_ERR_WRONGSTATE, "wrong error %#x\n", hr);
|
||||
+ else
|
||||
+ ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
|
||||
|
||||
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
|
||||
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
|
||||
|
||||
hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
|
||||
- ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
|
||||
+ if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
|
||||
+ ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING) /* XP */, "CopyPalette failed, hr=%#x\n", hr);
|
||||
+ else
|
||||
+ ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
|
||||
|
||||
hr = S_OK;
|
||||
i=0;
|
||||
@@ -1313,7 +1358,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
||||
}
|
||||
}
|
||||
else if (IsEqualGUID(clsid_decoder, &CLSID_WICBmpDecoder) ||
|
||||
- IsEqualGUID(clsid_decoder, &CLSID_WICTiffDecoder))
|
||||
+ IsEqualGUID(clsid_decoder, &CLSID_WICTiffDecoder) ||
|
||||
+ IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
|
||||
{
|
||||
if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormatBlackWhite) ||
|
||||
IsEqualGUID(&pixelformat, &GUID_WICPixelFormat8bppIndexed))
|
||||
@@ -1663,6 +1709,9 @@ START_TEST(converter)
|
||||
test_invalid_conversion();
|
||||
test_default_converter();
|
||||
|
||||
+ test_encoder(&testdata_8bppIndexed, &CLSID_WICGifEncoder,
|
||||
+ &testdata_8bppIndexed, &CLSID_WICGifDecoder, "GIF encoder 8bppIndexed");
|
||||
+
|
||||
test_encoder(&testdata_BlackWhite, &CLSID_WICPngEncoder,
|
||||
&testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
|
||||
test_encoder(&testdata_1bppIndexed, &CLSID_WICPngEncoder,
|
||||
--
|
||||
2.9.0
|
||||
|
@ -1 +1,2 @@
|
||||
Fixes: Add initial implementation of GIF encoder to windowscodecs
|
||||
Depends: windowscodecs-Palette_Images
|
||||
|
Loading…
x
Reference in New Issue
Block a user