Rebase against c0cc126d579e078f2804112c14f0c18b38f68937

This commit is contained in:
Alistair Leslie-Hughes 2019-02-21 13:49:36 +11:00
parent d12fcebb0e
commit 778998c66e
11 changed files with 13 additions and 925 deletions

View File

@ -1,240 +0,0 @@
From a6148704ad3c09339872975b1f129c37c3d35aa3 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 20 Dec 2018 13:54:47 +1100
Subject: [PATCH] mf: Implement MFCreateSequencerSource
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46105
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/mf/main.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/mf/mf.spec | 2 +-
dlls/mf/tests/Makefile.in | 2 +-
dlls/mf/tests/mf.c | 18 ++++++
include/mfidl.idl | 1 +
5 files changed, 161 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/main.c b/dlls/mf/main.c
index 73cd6aa..1ef13b5 100644
--- a/dlls/mf/main.c
+++ b/dlls/mf/main.c
@@ -74,3 +74,143 @@ HRESULT WINAPI MFGetService(IUnknown *object, REFGUID service, REFIID riid, void
IMFGetService_Release(gs);
return hr;
}
+
+typedef struct seqsource
+{
+ IMFSequencerSource IMFSequencerSource_iface;
+ LONG ref;
+} seqsource;
+
+static inline seqsource *impl_from_IMFSequencerSource(IMFSequencerSource *iface)
+{
+ return CONTAINING_RECORD(iface, seqsource, IMFSequencerSource_iface);
+}
+
+static HRESULT WINAPI seqsource_QueryInterface(IMFSequencerSource *iface, REFIID riid, void **out)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out);
+
+ if ( IsEqualIID(riid, &IID_IMFSequencerSource) ||
+ IsEqualIID(riid, &IID_IUnknown))
+ {
+ *out = &This->IMFSequencerSource_iface;
+ }
+ else
+ {
+ FIXME("(%s, %p)\n", debugstr_guid(riid), out);
+ *out = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*out);
+ return S_OK;
+}
+
+static ULONG WINAPI seqsource_AddRef(IMFSequencerSource *iface)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%u\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI seqsource_Release(IMFSequencerSource *iface)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%u\n", This, ref);
+
+ if (!ref)
+ {
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+
+ return ref;
+}
+
+static HRESULT WINAPI seqsource_AppendTopology(IMFSequencerSource *iface, IMFTopology *topology, DWORD flags, MFSequencerElementId *element)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+
+ FIXME("%p, %p, %x, %p\n", This, topology, flags, element);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI seqsource_DeleteTopology(IMFSequencerSource *iface, MFSequencerElementId element)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+
+ FIXME("%p, %d\n", This, element);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI seqsource_GetPresentationContext(IMFSequencerSource *iface, IMFPresentationDescriptor *pd, MFSequencerElementId *id,
+ IMFTopology **topology)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+
+ FIXME("%p, %p, %p, %p\n", This, pd, id, topology);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI seqsource_UpdateTopology(IMFSequencerSource *iface, MFSequencerElementId id, IMFTopology *topology)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+
+ FIXME("%p, %d, %p\n", This, id, topology);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI seqsource_UpdateTopologyFlags(IMFSequencerSource *iface, MFSequencerElementId id, DWORD flags)
+{
+ seqsource *This = impl_from_IMFSequencerSource(iface);
+
+ FIXME("%p, %d, %x\n", This, id, flags);
+
+ return E_NOTIMPL;
+}
+
+static const IMFSequencerSourceVtbl seqsrc_vtbl =
+{
+ seqsource_QueryInterface,
+ seqsource_AddRef,
+ seqsource_Release,
+ seqsource_AppendTopology,
+ seqsource_DeleteTopology,
+ seqsource_GetPresentationContext,
+ seqsource_UpdateTopology,
+ seqsource_UpdateTopologyFlags
+};
+
+/***********************************************************************
+ * MFCreateSequencerSource (mf.@)
+ */
+HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **sequencer)
+{
+ seqsource *object;
+
+ TRACE("(%p, %p)\n", reserved, sequencer);
+
+ if (!sequencer)
+ return E_POINTER;
+
+ object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
+ if (!object)
+ return E_OUTOFMEMORY;
+
+ object->IMFSequencerSource_iface.lpVtbl = &seqsrc_vtbl;
+ object->ref = 1;
+
+ *sequencer = &object->IMFSequencerSource_iface;
+
+ return S_OK;
+}
diff --git a/dlls/mf/mf.spec b/dlls/mf/mf.spec
index deb9057..b46c905 100644
--- a/dlls/mf/mf.spec
+++ b/dlls/mf/mf.spec
@@ -54,7 +54,7 @@
@ stub MFCreateSampleGrabberSinkActivate
@ stub MFCreateSecureHttpSchemePlugin
@ stub MFCreateSequencerSegmentOffset
-@ stub MFCreateSequencerSource
+@ stdcall MFCreateSequencerSource(ptr ptr)
@ stub MFCreateSequencerSourceRemoteStream
@ stub MFCreateSimpleTypeHandler
@ stdcall MFCreateSourceResolver(ptr) mfplat.MFCreateSourceResolver
diff --git a/dlls/mf/tests/Makefile.in b/dlls/mf/tests/Makefile.in
index f989baa..f233cff 100644
--- a/dlls/mf/tests/Makefile.in
+++ b/dlls/mf/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = mf.dll
-IMPORTS = mf
+IMPORTS = mf mfplat
C_SRCS = \
mf.c
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 76e092a..ca10233 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -28,6 +28,7 @@
#include "initguid.h"
#include "mfidl.h"
+#include "mfapi.h"
#include "wine/test.h"
@@ -170,8 +171,25 @@ static void test_MFGetService(void)
ok(unk == (void *)0xdeadbeef, "Unexpected out object.\n");
}
+static void test_MFCreateSequencerSource(void)
+{
+ HRESULT hr;
+ IMFSequencerSource *seq;
+
+ hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = MFCreateSequencerSource(NULL, &seq);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ IMFSequencerSource_Release(seq);
+
+ MFShutdown();
+}
+
START_TEST(mf)
{
test_topology();
test_MFGetService();
+ test_MFCreateSequencerSource();
}
diff --git a/include/mfidl.idl b/include/mfidl.idl
index 2373e41..39dc394 100644
--- a/include/mfidl.idl
+++ b/include/mfidl.idl
@@ -307,6 +307,7 @@ interface IMFSequencerSource : IUnknown
cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);")
cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream);" )
+cpp_quote("HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **sequencer);" )
cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);")
cpp_quote("HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD cMediaTypes,")
cpp_quote(" IMFMediaType **types, IMFStreamDescriptor **descriptor);")
--
1.9.1

View File

@ -1 +0,0 @@
Fixes: [46105] mf: Implement MFCreateSequencerSource

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "0c738d900a8daccf2c5460972033766d34d59aed"
echo "c0cc126d579e078f2804112c14f0c18b38f68937"
}
# Show version information
@ -175,7 +175,6 @@ patch_enable_all ()
enable_libs_Debug_Channel="$1"
enable_libs_Unicode_Collation="$1"
enable_mciavi32_fullscreen_support="$1"
enable_mf_MFCreateSequencerSource="$1"
enable_mmsystem_dll16_MIDIHDR_Refcount="$1"
enable_mountmgr_DosDevices="$1"
enable_mscoree_CorValidateImage="$1"
@ -313,7 +312,6 @@ patch_enable_all ()
enable_user32_Refresh_MDI_Menus="$1"
enable_user32_ScrollWindowEx="$1"
enable_user32_ShowWindow="$1"
enable_user32_minimized_windows="$1"
enable_user32_msgbox_Support_WM_COPY_mesg="$1"
enable_uxtheme_CloseThemeClass="$1"
enable_uxtheme_GTK_Theming="$1"
@ -679,9 +677,6 @@ patch_enable ()
mciavi32-fullscreen_support)
enable_mciavi32_fullscreen_support="$2"
;;
mf-MFCreateSequencerSource)
enable_mf_MFCreateSequencerSource="$2"
;;
mmsystem.dll16-MIDIHDR_Refcount)
enable_mmsystem_dll16_MIDIHDR_Refcount="$2"
;;
@ -1093,9 +1088,6 @@ patch_enable ()
user32-ShowWindow)
enable_user32_ShowWindow="$2"
;;
user32-minimized_windows)
enable_user32_minimized_windows="$2"
;;
user32-msgbox-Support-WM_COPY-mesg)
enable_user32_msgbox_Support_WM_COPY_mesg="$2"
;;
@ -4032,21 +4024,6 @@ if test "$enable_mciavi32_fullscreen_support" -eq 1; then
) >> "$patchlist"
fi
# Patchset mf-MFCreateSequencerSource
# |
# | This patchset fixes the following Wine bugs:
# | * [#46105] mf: Implement MFCreateSequencerSource
# |
# | Modified files:
# | * dlls/mf/main.c, dlls/mf/mf.spec, dlls/mf/tests/Makefile.in, dlls/mf/tests/mf.c, include/mfidl.idl
# |
if test "$enable_mf_MFCreateSequencerSource" -eq 1; then
patch_apply mf-MFCreateSequencerSource/0001-mf-Implement-MFCreateSequencerSource.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "mf: Implement MFCreateSequencerSource.", 1 },';
) >> "$patchlist"
fi
# Patchset mmsystem.dll16-MIDIHDR_Refcount
# |
# | This patchset fixes the following Wine bugs:
@ -6424,21 +6401,6 @@ if test "$enable_user32_ShowWindow" -eq 1; then
) >> "$patchlist"
fi
# Patchset user32-minimized_windows
# |
# | This patchset fixes the following Wine bugs:
# | * [#7287] Redundant "tabs" appear with tabbed MDI (test with LTSpice)
# |
# | Modified files:
# | * dlls/user32/winpos.c
# |
if test "$enable_user32_minimized_windows" -eq 1; then
patch_apply user32-minimized_windows/0015-user32-Move-iconic-windows-as-their-border-instead-o.patch
(
printf '%s\n' '+ { "Zebediah Figura", "user32: Move iconic windows as their border instead of their icon.", 1 },';
) >> "$patchlist"
fi
# Patchset user32-msgbox-Support-WM_COPY-mesg
# |
# | This patchset fixes the following Wine bugs:
@ -6601,11 +6563,6 @@ fi
# | dlls/windowscodecs/tests/tiffformat.c, dlls/windowscodecs/tiffformat.c, include/wincodec.idl
# |
if test "$enable_windowscodecs_TIFF_Support" -eq 1; then
patch_apply windowscodecs-TIFF_Support/0001-windowscodecs-tests-Add-a-test-for-8bpp-indexed-TIFF.patch
patch_apply windowscodecs-TIFF_Support/0002-windowscodecs-tests-Make-the-test-for-8bpp-indexed-T.patch
patch_apply windowscodecs-TIFF_Support/0003-windowscodecs-Fix-the-SupportsTransparency-flag-valu.patch
patch_apply windowscodecs-TIFF_Support/0004-windowscodecs-Fail-earlier-in-TIFF-decoder-s-Initial.patch
patch_apply windowscodecs-TIFF_Support/0005-windowscodecs-Avoid-redundant-checks-when-reading-a-.patch
patch_apply windowscodecs-TIFF_Support/0006-windowscodecs-Add-support-for-16bppGray-and-32bppGra.patch
patch_apply windowscodecs-TIFF_Support/0007-windowscodecs-Add-support-for-3bps-RGB-format-to-TIF.patch
patch_apply windowscodecs-TIFF_Support/0008-windowscodecs-Add-support-for-12bpp-RGB-format-to-TI.patch
@ -6618,11 +6575,6 @@ if test "$enable_windowscodecs_TIFF_Support" -eq 1; then
patch_apply windowscodecs-TIFF_Support/0016-gdiplus-Add-support-for-more-image-color-formats.patch
patch_apply windowscodecs-TIFF_Support/0017-gdiplus-tests-Add-some-tests-for-loading-TIFF-images.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add a test for 8bpp indexed TIFF format.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Make the test for 8bpp indexed TIFF format run under XP.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Fix the SupportsTransparency flag value for various pixel formats.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Fail earlier in TIFF decoder'\''s Initialize method for unsupported pixel formats.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Avoid redundant checks when reading a TIFF tile.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for 16bppGray and 32bppGrayFloat formats to TIFF decoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for 3bps RGB format to TIFF decoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for 12bpp RGB format to TIFF decoder.", 1 },';

View File

@ -1,119 +0,0 @@
From a62a7fbe80572fdc7be431766da60273a30f0ec9 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 20 Dec 2018 11:15:58 -0600
Subject: [PATCH 15/15] user32: Move iconic windows as their border instead of
their icon.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/user32/winpos.c | 50 +++++++++++---------------------------------
1 file changed, 12 insertions(+), 38 deletions(-)
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index a36ee178f6..4640dff906 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2709,12 +2709,10 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
HWND parent;
LONG hittest = (LONG)(wParam & 0x0f);
WPARAM syscommand = wParam & 0xfff0;
- HCURSOR hDragCursor = 0, hOldCursor = 0;
MINMAXINFO minmax;
POINT capturePoint, pt;
LONG style = GetWindowLongW( hwnd, GWL_STYLE );
BOOL thickframe = HAS_THICKFRAME( style );
- BOOL iconic = style & WS_MINIMIZE;
BOOL moved = FALSE;
DWORD dwPoint = GetMessagePos ();
BOOL DragFullWindows = TRUE;
@@ -2794,13 +2792,6 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
/* Retrieve a default cache DC (without using the window style) */
hdc = GetDCEx( parent, 0, DCX_CACHE );
- if( iconic ) /* create a cursor for dragging */
- {
- hDragCursor = (HCURSOR)GetClassLongPtrW( hwnd, GCLP_HICON);
- if( !hDragCursor ) hDragCursor = (HCURSOR)SendMessageW( hwnd, WM_QUERYDRAGICON, 0, 0L);
- if( !hDragCursor ) iconic = FALSE;
- }
-
/* we only allow disabling the full window drag for child windows */
if (parent) SystemParametersInfoW( SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0 );
@@ -2870,20 +2861,14 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
if( !moved )
{
moved = TRUE;
-
- if( iconic ) /* ok, no system popup tracking */
- {
- hOldCursor = SetCursor(hDragCursor);
- ShowCursor( TRUE );
- }
- else if(!DragFullWindows)
+ if (!DragFullWindows)
draw_moving_frame( parent, hdc, &sizingRect, thickframe );
}
if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y );
else
{
- if(!iconic && !DragFullWindows) draw_moving_frame( parent, hdc, &sizingRect, thickframe );
+ if (!DragFullWindows) draw_moving_frame( parent, hdc, &sizingRect, thickframe );
if (hittest == HTCAPTION) OffsetRect( &sizingRect, dx, dy );
if (ON_LEFT_BORDER(hittest)) sizingRect.left += dx;
else if (ON_RIGHT_BORDER(hittest)) sizingRect.right += dx;
@@ -2903,32 +2888,21 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
else
SendMessageW( hwnd, WM_MOVING, 0, (LPARAM)&sizingRect );
- if (!iconic)
+ if (!DragFullWindows)
+ draw_moving_frame( parent, hdc, &sizingRect, thickframe );
+ else
{
- if(!DragFullWindows)
- draw_moving_frame( parent, hdc, &sizingRect, thickframe );
- else
- {
- RECT rect = sizingRect;
- MapWindowPoints( 0, parent, (POINT *)&rect, 2 );
- SetWindowPos( hwnd, 0, rect.left, rect.top,
- rect.right - rect.left, rect.bottom - rect.top,
- ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
- }
+ RECT rect = sizingRect;
+ MapWindowPoints( 0, parent, (POINT *)&rect, 2 );
+ SetWindowPos( hwnd, 0, rect.left, rect.top,
+ rect.right - rect.left, rect.bottom - rect.top,
+ (hittest == HTCAPTION) ? SWP_NOSIZE : 0 );
}
}
}
}
- if( iconic )
- {
- if( moved ) /* restore cursors, show icon title later on */
- {
- ShowCursor( FALSE );
- SetCursor( hOldCursor );
- }
- }
- else if (moved && !DragFullWindows)
+ if (moved && !DragFullWindows)
{
draw_moving_frame( parent, hdc, &sizingRect, thickframe );
}
@@ -2952,7 +2926,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
{
/* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
- if(!DragFullWindows || iconic)
+ if (!DragFullWindows)
SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
sizingRect.right - sizingRect.left,
sizingRect.bottom - sizingRect.top,
--
2.19.2

View File

@ -1,2 +0,0 @@
Fixes: [7287] Redundant "tabs" appear with tabbed MDI (test with LTSpice)
# Switch from Win95-style "iconic" windows to later "minimized" windows.

View File

@ -1,255 +0,0 @@
From ed6651ff72258e25be02809cfacbcfe342b59567 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Mon, 28 Nov 2016 21:17:59 +0800
Subject: [PATCH] windowscodecs/tests: Add a test for 8bpp indexed TIFF format.
---
dlls/windowscodecs/tests/tiffformat.c | 180 +++++++++++++++++++++++++++++-----
1 file changed, 157 insertions(+), 23 deletions(-)
diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c
index 36de69e..b04b5a9 100644
--- a/dlls/windowscodecs/tests/tiffformat.c
+++ b/dlls/windowscodecs/tests/tiffformat.c
@@ -145,6 +145,49 @@ static const struct tiff_8bpp_alpha
{ 0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88 }
};
+static const struct tiff_8bpp_data
+{
+ USHORT byte_order;
+ USHORT version;
+ ULONG dir_offset;
+ USHORT number_of_entries;
+ struct IFD_entry entry[14];
+ ULONG next_IFD;
+ struct IFD_rational res;
+ short palette_data[3][256];
+ BYTE pixel_data[4];
+} tiff_8bpp_data =
+{
+#ifdef WORDS_BIGENDIAN
+ 'M' | 'M' << 8,
+#else
+ 'I' | 'I' << 8,
+#endif
+ 42,
+ FIELD_OFFSET(struct tiff_8bpp_data, number_of_entries),
+ 14,
+ {
+ { 0xff, IFD_SHORT, 1, 0 }, /* SUBFILETYPE */
+ { 0x100, IFD_LONG, 1, 4 }, /* IMAGEWIDTH */
+ { 0x101, IFD_LONG, 1, 1 }, /* IMAGELENGTH */
+ { 0x102, IFD_LONG, 1, 8 }, /* BITSPERSAMPLE */
+ { 0x103, IFD_SHORT, 1, 1 }, /* COMPRESSION: XP doesn't accept IFD_LONG here */
+ { 0x106, IFD_SHORT, 1, 3 }, /* PHOTOMETRIC */
+ { 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_8bpp_data, pixel_data) }, /* STRIPOFFSETS */
+ { 0x115, IFD_SHORT, 1, 1 }, /* SAMPLESPERPIXEL */
+ { 0x116, IFD_LONG, 1, 1 }, /* ROWSPERSTRIP */
+ { 0x117, IFD_LONG, 1, 1 }, /* STRIPBYTECOUNT */
+ { 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_data, res) },
+ { 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_data, res) },
+ { 0x128, IFD_SHORT, 1, 2 }, /* RESOLUTIONUNIT */
+ { 0x140, IFD_SHORT, 256*3, FIELD_OFFSET(struct tiff_8bpp_data, palette_data) } /* COLORMAP */
+ },
+ 0,
+ { 96, 1 },
+ { { 0 } },
+ { 0,1,2,3 }
+};
+
static const struct tiff_resolution_test_data
{
struct IFD_rational resx;
@@ -244,29 +287,41 @@ static IStream *create_stream(const void *data, int data_size)
return stream;
}
-static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size)
+static HRESULT create_decoder(const void *image_data, UINT image_size, IWICBitmapDecoder **decoder)
{
+ HGLOBAL hmem;
+ BYTE *data;
HRESULT hr;
IStream *stream;
- IWICBitmapDecoder *decoder = NULL;
- GUID guid;
+ GUID format;
+ LONG refcount;
- stream = create_stream(image_data, image_size);
+ *decoder = NULL;
- hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
- ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
- if (FAILED(hr)) return NULL;
+ hmem = GlobalAlloc(0, image_size);
+ data = GlobalLock(hmem);
+ memcpy(data, image_data, image_size);
+ GlobalUnlock(hmem);
- hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guid);
- ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
- ok(IsEqualGUID(&guid, &GUID_ContainerFormatTiff), "container format is not TIFF\n");
+ hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
+ ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
- IStream_Release(stream);
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, decoder);
+ if (hr == S_OK)
+ {
+ hr = IWICBitmapDecoder_GetContainerFormat(*decoder, &format);
+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_ContainerFormatTiff),
+ "wrong container format %s\n", wine_dbgstr_guid(&format));
- return decoder;
+ refcount = IStream_Release(stream);
+ ok(refcount > 0, "expected stream refcount > 0\n");
+ }
+
+ return hr;
}
-static void test_tiff_palette(void)
+static void test_tiff_1bpp_palette(void)
{
HRESULT hr;
IWICBitmapDecoder *decoder;
@@ -274,9 +329,9 @@ static void test_tiff_palette(void)
IWICPalette *palette;
GUID format;
- decoder = create_decoder(&tiff_1bpp_data, sizeof(tiff_1bpp_data));
- ok(decoder != 0, "Failed to load TIFF image data\n");
- if (!decoder) return;
+ hr = create_decoder(&tiff_1bpp_data, sizeof(tiff_1bpp_data), &decoder);
+ ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
+ if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
@@ -408,9 +463,9 @@ static void test_tiff_8bpp_alpha(void)
static const BYTE expected_data[16] = { 0x11,0x11,0x11,0x22,0x33,0x33,0x33,0x44,
0x55,0x55,0x55,0x66,0x77,0x77,0x77,0x88 };
- decoder = create_decoder(&tiff_8bpp_alpha, sizeof(tiff_8bpp_alpha));
- ok(decoder != 0, "Failed to load TIFF image data\n");
- if (!decoder) return;
+ hr = create_decoder(&tiff_8bpp_alpha, sizeof(tiff_8bpp_alpha), &decoder);
+ ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
+ if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
@@ -457,6 +512,84 @@ static void test_tiff_8bpp_alpha(void)
IWICBitmapFrameDecode_Release(frame);
}
+static void generate_tiff_palette(void *buf, unsigned count)
+{
+ unsigned short *r, *g, *b;
+ unsigned i;
+
+ r = buf;
+ g = r + count;
+ b = g + count;
+
+ r[0] = 0x11 * 257;
+ g[0] = 0x22 * 257;
+ b[0] = 0x33 * 257;
+ r[1] = 0x44 * 257;
+ g[1] = 0x55 * 257;
+ b[1] = 0x66 * 257;
+ r[2] = 0x77 * 257;
+ g[2] = 0x88 * 257;
+ b[2] = 0x99 * 257;
+ r[3] = 0xa1 * 257;
+ g[3] = 0xb5 * 257;
+ b[3] = 0xff * 257;
+
+ for (i = 4; i < count; i++)
+ {
+ r[i] = i * 257;
+ g[i] = (i | 0x40) * 257;
+ b[i] = (i | 0x80) * 257;
+ }
+}
+
+static void test_tiff_8bpp_palette(void)
+{
+ char buf[sizeof(tiff_8bpp_data)];
+ HRESULT hr;
+ IWICBitmapDecoder *decoder;
+ IWICBitmapFrameDecode *frame;
+ IWICPalette *palette;
+ GUID format;
+ UINT count, ret;
+ WICColor color[256];
+
+ memcpy(buf, &tiff_8bpp_data, sizeof(tiff_8bpp_data));
+ generate_tiff_palette(buf + FIELD_OFFSET(struct tiff_8bpp_data, palette_data), 256);
+
+ hr = create_decoder(buf, sizeof(buf), &decoder);
+ ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
+ if (hr != S_OK) return;
+
+ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
+ ok(hr == S_OK, "GetFrame error %#x\n", hr);
+
+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
+ ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
+ "expected GUID_WICPixelFormat8bppIndexed, got %s\n", wine_dbgstr_guid(&format));
+
+ hr = IWICImagingFactory_CreatePalette(factory, &palette);
+ ok(hr == S_OK, "CreatePalette error %#x\n", hr);
+ hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 256, "expected 256, got %u\n", count);
+
+ hr = IWICPalette_GetColors(palette, 256, color, &ret);
+ ok(hr == S_OK, "GetColors error %#x\n", hr);
+ ok(ret == count, "expected %u, got %u\n", count, ret);
+ ok(color[0] == 0xff112233, "got %#x\n", color[0]);
+ ok(color[1] == 0xff445566, "got %#x\n", color[1]);
+ ok(color[2] == 0xff778899, "got %#x\n", color[2]);
+ ok(color[3] == 0xffa1b5ff, "got %#x\n", color[3]);
+
+ IWICPalette_Release(palette);
+ IWICBitmapFrameDecode_Release(frame);
+ IWICBitmapDecoder_Release(decoder);
+}
+
static void test_tiff_resolution(void)
{
HRESULT hr;
@@ -472,9 +605,9 @@ static void test_tiff_resolution(void)
tiff_resolution_image_data.resy = test_data->resy;
tiff_resolution_image_data.entry[12].value = test_data->resolution_unit;
- decoder = create_decoder(&tiff_resolution_image_data, sizeof(tiff_resolution_image_data));
- ok(decoder != 0, "%d: Failed to load TIFF image data\n", i);
- if (!decoder) continue;
+ hr = create_decoder(&tiff_resolution_image_data, sizeof(tiff_resolution_image_data), &decoder);
+ ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
+ if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "%d: GetFrame error %#x\n", i, hr);
@@ -520,7 +653,8 @@ START_TEST(tiffformat)
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
if (FAILED(hr)) return;
- test_tiff_palette();
+ test_tiff_1bpp_palette();
+ test_tiff_8bpp_palette();
test_QueryCapability();
test_tiff_8bpp_alpha();
test_tiff_resolution();
--
1.9.1

View File

@ -1,33 +0,0 @@
From 2ce792b674a71ef69b83421269cac9c3a6b1a621 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 9 Dec 2016 12:10:29 +0800
Subject: windowscodecs/tests: Make the test for 8bpp indexed TIFF format run
under XP.
---
dlls/windowscodecs/tests/tiffformat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c
index 3291b48..a742627 100644
--- a/dlls/windowscodecs/tests/tiffformat.c
+++ b/dlls/windowscodecs/tests/tiffformat.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Dmitry Timoshkov
+ * Copyright 2012,2016 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -160,7 +160,7 @@ static const struct tiff_8bpp_data
{ 0xff, IFD_SHORT, 1, 0 }, /* SUBFILETYPE */
{ 0x100, IFD_LONG, 1, 4 }, /* IMAGEWIDTH */
{ 0x101, IFD_LONG, 1, 1 }, /* IMAGELENGTH */
- { 0x102, IFD_LONG, 1, 8 }, /* BITSPERSAMPLE */
+ { 0x102, IFD_SHORT, 1, 8 }, /* BITSPERSAMPLE: XP doesn't accept IFD_LONG here */
{ 0x103, IFD_SHORT, 1, 1 }, /* COMPRESSION: XP doesn't accept IFD_LONG here */
{ 0x106, IFD_SHORT, 1, 3 }, /* PHOTOMETRIC */
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_8bpp_data, pixel_data) }, /* STRIPOFFSETS */
--
2.9.0

View File

@ -1,62 +0,0 @@
From cd8ae040a9f84ac17905714a527713f7ed80dd7f Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 9 Dec 2016 12:12:31 +0800
Subject: windowscodecs: Fix the SupportsTransparency flag value for various
pixel formats.
---
dlls/windowscodecs/regsvr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index 4516d3f..ca9ca94 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1784,7 +1784,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
1, /* channel count */
channel_masks_1bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormat2bppIndexed,
"The Wine Project",
@@ -1795,7 +1795,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
1, /* channel count */
channel_masks_2bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormat4bppIndexed,
"The Wine Project",
@@ -1806,7 +1806,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
1, /* channel count */
channel_masks_4bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormat8bppIndexed,
"The Wine Project",
@@ -1817,7 +1817,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
1, /* channel count */
channel_masks_8bit,
WICPixelFormatNumericRepresentationIndexed,
- 1
+ 0
},
{ &GUID_WICPixelFormatBlackWhite,
"The Wine Project",
@@ -1971,7 +1971,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
1, /* channel count */
channel_masks_32bit,
WICPixelFormatNumericRepresentationFloat,
- 1
+ 0
},
{ &GUID_WICPixelFormat48bppRGB,
"The Wine Project",
--
2.9.0

View File

@ -1,47 +0,0 @@
From 31f25db57624b0c9eb71e65499621180f7eb8336 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 9 Dec 2016 12:14:37 +0800
Subject: windowscodecs: Fail earlier in TIFF decoder's Initialize method for
unsupported pixel formats.
---
dlls/windowscodecs/tiffformat.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 12e03f2..89ebb4d 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -631,6 +631,7 @@ static HRESULT WINAPI TiffDecoder_Initialize(IWICBitmapDecoder *iface, IStream *
{
TiffDecoder *This = impl_from_IWICBitmapDecoder(iface);
TIFF *tiff;
+ tiff_decode_info decode_info;
HRESULT hr=S_OK;
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions);
@@ -644,13 +645,20 @@ static HRESULT WINAPI TiffDecoder_Initialize(IWICBitmapDecoder *iface, IStream *
}
tiff = tiff_open_stream(pIStream, "r");
-
if (!tiff)
{
hr = E_FAIL;
goto exit;
}
+ /* make sure that TIFF format is supported */
+ hr = tiff_get_decode_info(tiff, &decode_info);
+ if (hr != S_OK)
+ {
+ pTIFFClose(tiff);
+ goto exit;
+ }
+
This->tiff = tiff;
This->stream = pIStream;
IStream_AddRef(pIStream);
--
2.9.0

View File

@ -1,103 +0,0 @@
From 12dcbc874f228a3e3ff1f3ef4f2918487430ad45 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 9 Dec 2016 12:19:55 +0800
Subject: windowscodecs: Avoid redundant checks when reading a TIFF tile.
---
dlls/windowscodecs/tiffformat.c | 40 ++++++++++++++--------------------------
1 file changed, 14 insertions(+), 26 deletions(-)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 89ebb4d..c72fadf 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -974,34 +974,25 @@ static HRESULT WINAPI TiffFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT tile_y)
{
- HRESULT hr=S_OK;
tsize_t ret;
int swap_bytes;
swap_bytes = pTIFFIsByteSwapped(This->parent->tiff);
ret = pTIFFSetDirectory(This->parent->tiff, This->index);
-
if (ret == -1)
- hr = E_FAIL;
+ return E_FAIL;
- if (hr == S_OK)
- {
- if (This->decode_info.tiled)
- {
- ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y * This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size);
- }
- else
- {
- ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y, This->cached_tile, This->decode_info.tile_size);
- }
+ if (This->decode_info.tiled)
+ ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y * This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size);
+ else
+ ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y, This->cached_tile, This->decode_info.tile_size);
- if (ret == -1)
- hr = E_FAIL;
- }
+ if (ret == -1)
+ return E_FAIL;
/* 8bpp grayscale with extra alpha */
- if (hr == S_OK && This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32)
+ if (This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32)
{
BYTE *src;
DWORD *dst, count = This->decode_info.tile_width * This->decode_info.tile_height;
@@ -1016,7 +1007,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
}
}
- if (hr == S_OK && This->decode_info.reverse_bgr)
+ if (This->decode_info.reverse_bgr)
{
if (This->decode_info.bps == 8)
{
@@ -1027,7 +1018,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
}
}
- if (hr == S_OK && swap_bytes && This->decode_info.bps > 8)
+ if (swap_bytes && This->decode_info.bps > 8)
{
UINT row, i, samples_per_row;
BYTE *sample, temp;
@@ -1055,7 +1046,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
}
}
- if (hr == S_OK && This->decode_info.invert_grayscale)
+ if (This->decode_info.invert_grayscale)
{
BYTE *byte, *end;
@@ -1071,13 +1062,10 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
*byte = ~(*byte);
}
- if (hr == S_OK)
- {
- This->cached_tile_x = tile_x;
- This->cached_tile_y = tile_y;
- }
+ This->cached_tile_x = tile_x;
+ This->cached_tile_y = tile_y;
- return hr;
+ return S_OK;
}
static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
--
2.9.0

View File

@ -1,14 +1,14 @@
From 8baa01305598f32635ea565768e42fd2a362a912 Mon Sep 17 00:00:00 2001
From 0c1d97ca80e77a06c85796360d56987b2d51ad0d Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 9 Dec 2016 13:02:07 +0800
Subject: [PATCH] windowscodecs: Add some tests for various TIFF color formats.
---
dlls/windowscodecs/tests/tiffformat.c | 439 +++++++++++++++++++++++++++++++++-
1 file changed, 438 insertions(+), 1 deletion(-)
dlls/windowscodecs/tests/tiffformat.c | 437 ++++++++++++++++++++++++++++++++++
1 file changed, 437 insertions(+)
diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c
index cfb16be..ac6a471 100644
index 2f9a0ca..8cdc004 100644
--- a/dlls/windowscodecs/tests/tiffformat.c
+++ b/dlls/windowscodecs/tests/tiffformat.c
@@ -361,6 +361,61 @@ static HRESULT create_decoder(const void *image_data, UINT image_size, IWICBitma
@ -73,17 +73,15 @@ index cfb16be..ac6a471 100644
static void test_tiff_1bpp_palette(void)
{
HRESULT hr;
@@ -694,7 +749,8 @@ static void test_tiff_24bpp(void)
BYTE data[3];
static const BYTE expected_data[] = { 0x33,0x22,0x11 };
- decoder = create_decoder(&tiff_24bpp_data, sizeof(tiff_24bpp_data));
+ hr = create_decoder(&tiff_24bpp_data, sizeof(tiff_24bpp_data), &decoder);
+ ok(hr == S_OK, "got %#x\n", hr);
ok(decoder != NULL, "Failed to load TIFF image data\n");
@@ -697,6 +752,7 @@ static void test_tiff_24bpp(void)
hr = create_decoder(&tiff_24bpp_data, sizeof(tiff_24bpp_data), &decoder);
ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
if (hr != S_OK) return;
+ ok(decoder != NULL, "Failed to load TIFF image data\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
@@ -744,6 +800,386 @@ todo_wine_if(stride > 3)
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
@@ -743,6 +799,386 @@ static void test_tiff_24bpp(void)
IWICBitmapDecoder_Release(decoder);
}
@ -470,7 +468,7 @@ index cfb16be..ac6a471 100644
START_TEST(tiffformat)
{
HRESULT hr;
@@ -755,6 +1191,7 @@ START_TEST(tiffformat)
@@ -754,6 +1190,7 @@ START_TEST(tiffformat)
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
if (FAILED(hr)) return;