winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2015
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
775 discussions
Start a n
N
ew thread
Austin English : include/winternl.h: Use ntdef.h where possible.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 33e9798f721587fc08232734d6743ea0afb4afdf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=33e9798f721587fc08232734d…
Author: Austin English <austinenglish(a)gmail.com> Date: Thu Mar 12 15:48:02 2015 -0500 include/winternl.h: Use ntdef.h where possible. --- include/winternl.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/winternl.h b/include/winternl.h index 6dc8c74..f88001f 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -21,6 +21,7 @@ #ifndef __WINE_WINTERNL_H #define __WINE_WINTERNL_H +#include <ntdef.h> #include <windef.h> #ifdef __cplusplus @@ -813,11 +814,6 @@ typedef enum _SYSTEM_INFORMATION_CLASS { SystemInformationClassMax } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS; -typedef enum _TIMER_TYPE { - NotificationTimer, - SynchronizationTimer -} TIMER_TYPE; - typedef enum _THREADINFOCLASS { ThreadBasicInformation, ThreadTimes, @@ -1762,11 +1758,6 @@ typedef VOID (CALLBACK *PRTL_OVERLAPPED_COMPLETION_ROUTINE)(DWORD,DWORD,LPVOID); typedef VOID (CALLBACK *PTIMER_APC_ROUTINE) ( PVOID, ULONG, LONG ); -typedef enum _EVENT_TYPE { - NotificationEvent, - SynchronizationEvent -} EVENT_TYPE, *PEVENT_TYPE; - typedef enum _EVENT_INFORMATION_CLASS { EventBasicInformation } EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS;
1
0
0
0
Sebastian Lackner : slc: Implement SLGetWindowsInformationDWORD.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 731007886034dfd46dba3a006cd0c7790d091dd3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=731007886034dfd46dba3a006…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Mon Dec 22 20:27:07 2014 +0100 slc: Implement SLGetWindowsInformationDWORD. --- dlls/slc/slc.c | 24 ++++++++++++++++++++++-- dlls/slc/tests/slc.c | 6 ------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dlls/slc/slc.c b/dlls/slc/slc.c index 1b02c9b..a0d8999 100644 --- a/dlls/slc/slc.c +++ b/dlls/slc/slc.c @@ -19,8 +19,11 @@ #include <stdarg.h> +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" +#include "winternl.h" #include "wine/debug.h" #include "slpublic.h" @@ -37,9 +40,26 @@ HRESULT WINAPI SLGetWindowsInformation(LPCWSTR name, SLDATATYPE *type, UINT *val HRESULT WINAPI SLGetWindowsInformationDWORD(LPCWSTR lpszValueName, LPDWORD pdwValue) { - FIXME("(%s) stub\n", debugstr_w(lpszValueName) ); + UNICODE_STRING nameW; + NTSTATUS status; + ULONG type, len; - return SL_E_RIGHT_NOT_GRANTED; + TRACE("(%s)\n", debugstr_w(lpszValueName) ); + + if (!lpszValueName || !pdwValue) + return E_INVALIDARG; + if (!lpszValueName[0]) + return SL_E_RIGHT_NOT_GRANTED; + + RtlInitUnicodeString( &nameW, lpszValueName ); + status = NtQueryLicenseValue( &nameW, &type, pdwValue, sizeof(DWORD), &len ); + + if (status == STATUS_OBJECT_NAME_NOT_FOUND) + return SL_E_VALUE_NOT_FOUND; + if ((!status || status == STATUS_BUFFER_TOO_SMALL) && (type != REG_DWORD)) + return SL_E_DATATYPE_MISMATCHED; + + return status ? E_FAIL : S_OK; } /*********************************************************************** diff --git a/dlls/slc/tests/slc.c b/dlls/slc/tests/slc.c index 723cd4c..b9296b2 100644 --- a/dlls/slc/tests/slc.c +++ b/dlls/slc/tests/slc.c @@ -40,16 +40,13 @@ static void test_SLGetWindowsInformationDWORD(void) HRESULT res; res = SLGetWindowsInformationDWORD(NonexistentLicenseValueW, NULL); - todo_wine ok(res == E_INVALIDARG, "expected E_INVALIDARG, got %08x\n", res); res = SLGetWindowsInformationDWORD(NULL, &value); - todo_wine ok(res == E_INVALIDARG, "expected E_INVALIDARG, got %08x\n", res); value = 0xdeadbeef; res = SLGetWindowsInformationDWORD(NonexistentLicenseValueW, &value); - todo_wine ok(res == SL_E_VALUE_NOT_FOUND, "expected SL_E_VALUE_NOT_FOUND, got %08x\n", res); ok(value == 0xdeadbeef, "expected value = 0xdeadbeef, got %u\n", value); @@ -61,15 +58,12 @@ static void test_SLGetWindowsInformationDWORD(void) value = 0xdeadbeef; res = SLGetWindowsInformationDWORD(KernelMUILanguageAllowedW, &value); - todo_wine ok(res == SL_E_DATATYPE_MISMATCHED, "expected SL_E_DATATYPE_MISMATCHED, got %08x\n", res); ok(value == 0xdeadbeef, "expected value = 0xdeadbeef, got %u\n", value); value = 0xdeadbeef; res = SLGetWindowsInformationDWORD(KernelMUINumberAllowedW, &value); - todo_wine ok(res == S_OK, "expected S_OK, got %u\n", res); - todo_wine ok(value != 0xdeadbeef, "expected value != 0xdeadbeef\n"); }
1
0
0
0
Sebastian Lackner : ntdll: Implement [Nt|Zw]QueryLicenseValue.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 2daca626d4ba4f0ba5a28ee02bf5c94ecce7282a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2daca626d4ba4f0ba5a28ee02…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Mon Dec 22 20:01:29 2014 +0100 ntdll: Implement [Nt|Zw]QueryLicenseValue. --- dlls/ntdll/ntdll.spec | 2 ++ dlls/ntdll/reg.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/tests/reg.c | 2 +- include/winternl.h | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 9355d04..c3307b2 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -255,6 +255,7 @@ @ stub NtQueryIntervalProfile @ stdcall NtQueryIoCompletion(long long ptr long ptr) @ stdcall NtQueryKey (long long ptr long ptr) +@ stdcall NtQueryLicenseValue(ptr ptr ptr long ptr) @ stdcall NtQueryMultipleValueKey(long ptr long ptr long ptr) @ stdcall NtQueryMutant(long long ptr long ptr) @ stdcall NtQueryObject(long long long long long) @@ -1134,6 +1135,7 @@ @ stub ZwQueryIntervalProfile @ stdcall ZwQueryIoCompletion(long long ptr long ptr) NtQueryIoCompletion @ stdcall ZwQueryKey(long long ptr long ptr) NtQueryKey +@ stdcall ZwQueryLicenseValue(ptr ptr ptr long ptr) NtQueryLicenseValue @ stdcall ZwQueryMultipleValueKey(long ptr long ptr long ptr) NtQueryMultipleValueKey @ stdcall ZwQueryMutant(long long ptr long ptr) NtQueryMutant @ stdcall ZwQueryObject(long long long long long) NtQueryObject diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index cdca88a..a104c2e 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -1401,3 +1401,67 @@ NTSTATUS WINAPI RtlWriteRegistryValue( ULONG RelativeTo, PCWSTR path, PCWSTR nam return status; } + +/************************************************************************* + * NtQueryLicenseValue [NTDLL.@] + * + * NOTES + * On Windows all license properties are stored in a single key, but + * unless there is some app which explicitly depends on that, there is + * no good reason to reproduce that. + */ +NTSTATUS WINAPI NtQueryLicenseValue( const UNICODE_STRING *name, ULONG *result_type, + PVOID data, ULONG length, ULONG *result_len ) +{ + static const WCHAR LicenseInformationW[] = {'M','a','c','h','i','n','e','\\', + 'S','o','f','t','w','a','r','e','\\', + 'W','i','n','e','\\','L','i','c','e','n','s','e', + 'I','n','f','o','r','m','a','t','i','o','n',0}; + KEY_VALUE_PARTIAL_INFORMATION *info; + NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND; + DWORD info_length, count; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING keyW; + HANDLE hkey; + + if (!name || !name->Buffer || !name->Length || !result_len) + return STATUS_INVALID_PARAMETER; + + info_length = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data) + length; + info = RtlAllocateHeap( GetProcessHeap(), 0, info_length ); + if (!info) return STATUS_NO_MEMORY; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &keyW; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + RtlInitUnicodeString( &keyW, LicenseInformationW ); + + /* @@ Wine registry key: HKLM\Software\Wine\LicenseInformation */ + if (!NtOpenKey( &hkey, KEY_READ, &attr )) + { + status = NtQueryValueKey( hkey, name, KeyValuePartialInformation, + info, info_length, &count ); + if (!status || status == STATUS_BUFFER_OVERFLOW) + { + if (result_type) + *result_type = info->Type; + + *result_len = info->DataLength; + + if (status == STATUS_BUFFER_OVERFLOW) + status = STATUS_BUFFER_TOO_SMALL; + else + memcpy( data, info->Data, info->DataLength ); + } + NtClose( hkey ); + } + + if (status == STATUS_OBJECT_NAME_NOT_FOUND) + FIXME( "License key %s not found\n", debugstr_w(name->Buffer) ); + + RtlFreeHeap( GetProcessHeap(), 0, info ); + return status; +} diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index 4628f16..691a6b7 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -661,7 +661,7 @@ static void test_NtQueryLicenseKey(void) if (!pNtQueryLicenseValue) { - skip("NtQueryLicenseValue not found, skipping tests\n"); + win_skip("NtQueryLicenseValue not found, skipping tests\n"); return; } diff --git a/include/winternl.h b/include/winternl.h index 3992309..6dc8c74 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2189,6 +2189,7 @@ NTSYSAPI NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER); NTSYSAPI NTSTATUS WINAPI NtQueryTimer(HANDLE,TIMER_INFORMATION_CLASS,PVOID,ULONG,PULONG); NTSYSAPI NTSTATUS WINAPI NtQueryTimerResolution(PULONG,PULONG,PULONG); NTSYSAPI NTSTATUS WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *); +NTSYSAPI NTSTATUS WINAPI NtQueryLicenseValue(const UNICODE_STRING *,ULONG *,PVOID,ULONG,ULONG *); NTSYSAPI NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,SIZE_T,SIZE_T*); NTSYSAPI NTSTATUS WINAPI NtQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS); NTSYSAPI NTSTATUS WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
1
0
0
0
Sebastian Lackner : wine.inf: Add some LicenseInformation registry values.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: dc0f544d6718589a6725d68d69132f897f45cdf1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dc0f544d6718589a6725d68d6…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Mar 11 02:14:54 2015 +0100 wine.inf: Add some LicenseInformation registry values. On Windows all the license information key/value pairs are stored in a single registry blob. The format is not properly documented, and unless we have some apps which expect it, there should be no need to spend too much time to figure out the internal details. --- loader/wine.inf.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index a4548f2..3c401b1 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -47,7 +47,8 @@ AddReg=\ Services, \ SessionMgr,\ Tapi,\ - Timezones + Timezones,\ + LicenseInformation [DefaultInstall.NT] RegisterDlls=RegisterDllsSection @@ -71,7 +72,8 @@ AddReg=\ SessionMgr,\ Tapi,\ Timezones,\ - VersionInfo + VersionInfo,\ + LicenseInformation [DefaultInstall.ntamd64] RegisterDlls=RegisterDllsSection @@ -97,7 +99,8 @@ AddReg=\ SessionMgr,\ Tapi,\ Timezones,\ - VersionInfo.ntamd64 + VersionInfo.ntamd64,\ + LicenseInformation [Wow64Install] RegisterDlls=RegisterDllsSection @@ -111,7 +114,8 @@ AddReg=\ MCI,\ Misc,\ Tapi,\ - VersionInfo.ntamd64 + VersionInfo.ntamd64,\ + LicenseInformation [DefaultInstall.Services] AddService=BITS,0,BITSService @@ -3140,3 +3144,17 @@ HKLM,Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Time Zones,"Symbol HKLM,Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Time Zones,"SymbolicLinkValue",0x60000,"\Registry\Machine\Software\Microsoft\Windows NT\CurrentVersion\Time Zones" HKLM,Software\Wow6432Node\Policies,"SymbolicLinkValue",0x60000,"\Registry\Machine\Software\Policies" HKLM,Software\Wow6432Node\Registered Applications,"SymbolicLinkValue",0x60000,"\Registry\Machine\Software\Registered Applications" + +[LicenseInformation] +; based on information from
http://www.geoffchappell.com/notes/windows/license/install.htm
+HKLM,Software\Wine\LicenseInformation,"Kernel-MUI-Language-Allowed",,"EMPTY" +HKLM,Software\Wine\LicenseInformation,"Kernel-MUI-Language-Disallowed",,"EMPTY" +HKLM,Software\Wine\LicenseInformation,"Kernel-MUI-Number-Allowed",0x10001,1000 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-FreeCell-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-Hearts-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-Minesweeper-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-PurblePlace-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-Shanghai-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-Solitaire-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-InBoxGames-SpiderSolitaire-EnableGame",0x10001,0x00000001 +HKLM,Software\Wine\LicenseInformation,"Shell-PremiumInBoxGames-Chess-EnableGame",0x10001,0x00000001
1
0
0
0
Jacek Caban : user32: Allow making window visible by WM_SETREDRAW message.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: da72de967b4fab1a823229f525e5739aed76516d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=da72de967b4fab1a823229f52…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Mar 5 14:20:51 2015 +0100 user32: Allow making window visible by WM_SETREDRAW message. --- dlls/user32/win.c | 7 ++----- dlls/user32/win.h | 1 - dlls/user32/winpos.c | 3 --- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 0516193..8ff3ebd 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -774,10 +774,7 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) if (ok && ((style.styleOld ^ style.styleNew) & WS_VISIBLE)) { - /* Some apps try to make their window visible through WM_SETREDRAW. - * Only do that if the window was never explicitly hidden, - * because Steam messes with WM_SETREDRAW after hiding its windows. */ - made_visible = !(win->flags & WIN_HIDDEN) && (style.styleNew & WS_VISIBLE); + made_visible = (style.styleNew & WS_VISIBLE) != 0; invalidate_dce( win, NULL ); } WIN_ReleasePtr( win ); @@ -2499,7 +2496,7 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B if ((offset == GWL_STYLE && ((style.styleOld ^ style.styleNew) & WS_VISIBLE)) || (offset == GWL_EXSTYLE && ((style.styleOld ^ style.styleNew) & WS_EX_LAYERED))) { - made_visible = !(wndPtr->flags & WIN_HIDDEN) && (wndPtr->dwStyle & WS_VISIBLE); + made_visible = (wndPtr->dwStyle & WS_VISIBLE) != 0; invalidate_dce( wndPtr, NULL ); } WIN_ReleasePtr( wndPtr ); diff --git a/dlls/user32/win.h b/dlls/user32/win.h index a19ebe9..a182778 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -76,7 +76,6 @@ typedef struct tagWND #define WIN_ISUNICODE 0x0010 /* Window is Unicode */ #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */ #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */ -#define WIN_HIDDEN 0x0080 /* hidden by an explicit SWP_HIDEWINDOW (as opposed to WM_SETREDRAW) */ /* Window functions */ extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index 12d3ffa..f92a3dc 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -1923,9 +1923,6 @@ static BOOL fixup_flags( WINDOWPOS *winpos ) parent = GetAncestor( winpos->hwnd, GA_PARENT ); if (!IsWindowVisible( parent )) winpos->flags |= SWP_NOREDRAW; - if (winpos->flags & SWP_HIDEWINDOW) wndPtr->flags |= WIN_HIDDEN; - else if (winpos->flags & SWP_SHOWWINDOW) wndPtr->flags &= ~WIN_HIDDEN; - if (wndPtr->dwStyle & WS_VISIBLE) winpos->flags &= ~SWP_SHOWWINDOW; else {
1
0
0
0
Piotr Caban : gdiplus: Add pixel format test for transparent non-animated gif.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 3ece08ff4d3ee3f1ed2067ad53b77e8bc00f81e1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3ece08ff4d3ee3f1ed2067ad5…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Mar 12 10:19:05 2015 +0100 gdiplus: Add pixel format test for transparent non-animated gif. --- dlls/gdiplus/tests/image.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index cc8ae2d..91f70b5 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -1335,6 +1335,12 @@ static const unsigned char gifimage[35] = { 0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44, 0x01,0x00,0x3b }; +/* 1x1 pixel transparent gif */ +static const unsigned char transparentgif[] = { +0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00,0xf0,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x21,0xf9,0x04,0x01,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00, +0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,0x01,0x00,0x3b +}; /* 1x1 pixel bmp */ static const unsigned char bmpimage[66] = { 0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00, @@ -2621,6 +2627,30 @@ static void test_multiframegif(void) GdipDisposeImage((GpImage*)bmp); IStream_Release(stream); + /* Test with a non-animated transparent gif */ + hglob = GlobalAlloc (0, sizeof(transparentgif)); + data = GlobalLock (hglob); + memcpy(data, transparentgif, sizeof(transparentgif)); + GlobalUnlock(hglob); + + hres = CreateStreamOnHGlobal(hglob, TRUE, &stream); + ok(hres == S_OK, "Failed to create a stream\n"); + + stat = GdipCreateBitmapFromStream(stream, &bmp); + IStream_Release(stream); + ok(stat == Ok, "Failed to create a Bitmap\n"); + + stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format); + expect(Ok, stat); + expect(PixelFormat8bppIndexed, pixel_format); + + count = 12345; + stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count); + expect(Ok, stat); + expect(1, count); + + GdipDisposeImage((GpImage*)bmp); + /* Test frame dispose methods */ hglob = GlobalAlloc (0, sizeof(gifanimation2)); data = GlobalLock (hglob);
1
0
0
0
Piotr Caban : windowscodecs: Show that WIC doesn' t do GIF frames composition.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 02d4c6b5acf58900811d5ffc6e38f4d0616a7142 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=02d4c6b5acf58900811d5ffc6…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Mar 12 10:18:51 2015 +0100 windowscodecs: Show that WIC doesn't do GIF frames composition. --- dlls/windowscodecs/tests/gifformat.c | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/dlls/windowscodecs/tests/gifformat.c b/dlls/windowscodecs/tests/gifformat.c index 863a91f..5b4cd8bc 100644 --- a/dlls/windowscodecs/tests/gifformat.c +++ b/dlls/windowscodecs/tests/gifformat.c @@ -57,6 +57,27 @@ static const char gif_local_palette[] = { 0x02,0x02,0x44,0x01,0x00,0x3b }; +/* Generated with ImageMagick: + * convert -delay 100 -size 2x2 xc:red \ + * -dispose none -page +0+0 -size 2x1 xc:white \ + * test.gif + */ +static const char gif_frame_sizes[] = { + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x02, 0x00, + 0x02, 0x00, 0xf1, 0x00, 0x00, 0xff, 0x00, 0x00, + 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, + 0x00, 0x21, 0xf9, 0x04, 0x00, 0x64, 0x00, 0x00, + 0x00, 0x21, 0xff, 0x0b, 0x4e, 0x45, 0x54, 0x53, + 0x43, 0x41, 0x50, 0x45, 0x32, 0x2e, 0x30, 0x03, + 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x03, + 0x44, 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x04, + 0x64, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x01, 0x00, 0x80, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x0a, + 0x00, 0x3b +}; + static IWICImagingFactory *factory; static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size) @@ -332,6 +353,55 @@ static void test_local_gif_palette(void) IWICBitmapDecoder_Release(decoder); } +static void test_gif_frame_sizes(void) +{ + static const BYTE frame0[] = {0, 1, 0xfe, 0xfe, 2, 3, 0xfe, 0xfe}; + static const BYTE frame1[] = {0, 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; + + IWICBitmapDecoder *decoder; + IWICBitmapFrameDecode *frame; + UINT width, height; + BYTE buf[8]; + HRESULT hr; + + decoder = create_decoder(gif_frame_sizes, sizeof(gif_frame_sizes)); + ok(decoder != 0, "Failed to load GIF image data\n"); + + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); + ok(hr == S_OK, "GetFrame error %#x\n", hr); + + hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height); + ok(hr == S_OK, "GetSize error %x\n", hr); + ok(width == 2, "width = %d\n", width); + ok(height == 2, "height = %d\n", height); + + memset(buf, 0xfe, sizeof(buf)); + hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %x\n", hr); + ok(!memcmp(buf, frame0, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); + + IWICBitmapFrameDecode_Release(frame); + + hr = IWICBitmapDecoder_GetFrame(decoder, 1, &frame); + ok(hr == S_OK, "GetFrame error %#x\n", hr); + + hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height); + ok(hr == S_OK, "GetSize error %x\n", hr); + ok(width == 2, "width = %d\n", width); + ok(height == 1, "height = %d\n", height); + + memset(buf, 0xfe, sizeof(buf)); + hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %x\n", hr); + ok(!memcmp(buf, frame1, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); + + IWICBitmapFrameDecode_Release(frame); + + IWICBitmapDecoder_Release(decoder); +} + START_TEST(gifformat) { HRESULT hr; @@ -345,6 +415,7 @@ START_TEST(gifformat) test_global_gif_palette(); test_global_gif_palette_2frames(); test_local_gif_palette(); + test_gif_frame_sizes(); IWICImagingFactory_Release(factory); CoUninitialize(); @@ -356,6 +427,7 @@ START_TEST(gifformat) test_global_gif_palette(); test_global_gif_palette_2frames(); test_local_gif_palette(); + test_gif_frame_sizes(); IWICImagingFactory_Release(factory); }
1
0
0
0
Piotr Caban : gdiplus/tests: Add gif frames composition tests.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: a3822f973e0d1f71f69ce89492e30c7cc6155cca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a3822f973e0d1f71f69ce8949…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Mar 12 10:17:46 2015 +0100 gdiplus/tests: Add gif frames composition tests. --- dlls/gdiplus/tests/image.c | 95 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index f33cb90..cc8ae2d 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -2423,6 +2423,51 @@ static const unsigned char gifanimation[72] = { 0x00,0x00,0x02,0x02,0x44,0x01,0x00,0x3b }; +/* Generated with ImageMagick: + * convert -transparent black -delay 100 -size 8x2 xc:black \ + * -dispose none -page +0+0 -size 2x2 xc:red \ + * -dispose background -page +2+0 -size 2x2 xc:blue \ + * -dispose previous -page +4+0 -size 2x2 xc:green \ + * -dispose undefined -page +6+0 -size 2x2 xc:gray \ + * test.gif + */ +static const unsigned char gifanimation2[] = { + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x08, 0x00, + 0x02, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x21, 0xf9, 0x04, 0x01, 0x64, + 0x00, 0x00, 0x00, 0x21, 0xff, 0x0b, 0x4e, 0x45, + 0x54, 0x53, 0x43, 0x41, 0x50, 0x45, 0x32, 0x2e, + 0x30, 0x03, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, + 0x02, 0x04, 0x84, 0x8f, 0x09, 0x05, 0x00, 0x21, + 0xf9, 0x04, 0x04, 0x64, 0x00, 0x00, 0x00, 0x2c, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x81, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x02, 0x03, 0x44, + 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x08, 0x64, + 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x81, 0x00, 0x00, 0xff, + 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, + 0xff, 0x02, 0x03, 0x44, 0x34, 0x05, 0x00, 0x21, + 0xf9, 0x04, 0x0c, 0x64, 0x00, 0x00, 0x00, 0x2c, + 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x81, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x00, 0x02, 0x03, 0x44, + 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x00, 0x64, + 0x00, 0x00, 0x00, 0x2c, 0x06, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x80, 0x7e, 0x7e, 0x7e, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x84, 0x51, 0x00, + 0x3b +}; + +static ARGB gifanimation2_pixels[5][4] = { + {0, 0, 0, 0}, + {0xffff0000, 0, 0, 0}, + {0xffff0000, 0xff0000ff, 0, 0}, + {0xffff0000, 0, 0xff008000, 0}, + {0xffff0000, 0, 0, 0xff7e7e7e} +}; + static void test_multiframegif(void) { LPSTREAM stream; @@ -2435,7 +2480,7 @@ static void test_multiframegif(void) UINT count; GUID dimension; PixelFormat pixel_format; - INT palette_size; + INT palette_size, i, j; /* Test frame functions with an animated GIF */ hglob = GlobalAlloc (0, sizeof(gifanimation)); @@ -2575,6 +2620,54 @@ static void test_multiframegif(void) GdipDisposeImage((GpImage*)bmp); IStream_Release(stream); + + /* Test frame dispose methods */ + hglob = GlobalAlloc (0, sizeof(gifanimation2)); + data = GlobalLock (hglob); + memcpy(data, gifanimation2, sizeof(gifanimation2)); + GlobalUnlock(hglob); + + hres = CreateStreamOnHGlobal(hglob, TRUE, &stream); + ok(hres == S_OK, "Failed to create a stream\n"); + + stat = GdipCreateBitmapFromStream(stream, &bmp); + ok(stat == Ok, "Failed to create a Bitmap\n"); + IStream_Release(stream); + + stat = GdipImageGetFrameDimensionsList((GpImage*)bmp, &dimension, 1); + expect(Ok, stat); + expect_guid(&FrameDimensionTime, &dimension, __LINE__, FALSE); + + stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count); + expect(Ok, stat); + expect(5, count); + + stat = GdipBitmapGetPixel(bmp, 0, 0, &color); + expect(Ok, stat); + expect(0, color); + + stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 3); + stat = GdipBitmapGetPixel(bmp, 2, 0, &color); + expect(Ok, stat); + ok(color==0 || broken(color==0xff0000ff), "color = %x\n", color); + if(color != 0) { + win_skip("broken animated gif support\n"); + GdipDisposeImage((GpImage*)bmp); + return; + } + + for(i=0; i<6; i++) { + stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, i%5); + expect(Ok, stat); + + for(j=0; j<4; j++) { + stat = GdipBitmapGetPixel(bmp, j*2, 0, &color); + expect(Ok, stat); + ok(gifanimation2_pixels[i%5][j] == color, "at %d,%d got %x, expected %x\n", i, j, color, gifanimation2_pixels[i%5][j]); + } + } + + GdipDisposeImage((GpImage*)bmp); } static void test_rotateflip(void)
1
0
0
0
Piotr Caban : gdiplus: Fix animated gif frames composition.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 821932dab90969c1c09a6b5021f9e43f7be1b26b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=821932dab90969c1c09a6b502…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Mar 12 10:17:40 2015 +0100 gdiplus: Fix animated gif frames composition. --- dlls/gdiplus/gdiplus_private.h | 5 ++ dlls/gdiplus/image.c | 184 +++++++++++++++++++++++++++++++++++------ 2 files changed, 166 insertions(+), 23 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 0d62eef..065f5ed 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -42,6 +42,11 @@ #define VERSION_MAGIC 0xdbc01001 #define TENSION_CONST (0.3) +#define GIF_DISPOSE_UNSPECIFIED 0 +#define GIF_DISPOSE_DO_NOT_DISPOSE 1 +#define GIF_DISPOSE_RESTORE_TO_BKGND 2 +#define GIF_DISPOSE_RESTORE_TO_PREV 3 + COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN; HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN; extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 409a3c6..4bce334 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -3238,14 +3238,13 @@ static PropertyItem *get_gif_transparent_idx(IWICMetadataReader *reader) return index; } -static LONG get_gif_frame_delay(IWICBitmapFrameDecode *frame) +static LONG get_gif_frame_property(IWICBitmapFrameDecode *frame, const GUID *format, const WCHAR *property) { - static const WCHAR delayW[] = { 'D','e','l','a','y',0 }; HRESULT hr; IWICMetadataBlockReader *block_reader; IWICMetadataReader *reader; UINT block_count, i; - PropertyItem *delay; + PropertyItem *prop; LONG value = 0; hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICMetadataBlockReader, (void **)&block_reader); @@ -3259,13 +3258,15 @@ static LONG get_gif_frame_delay(IWICBitmapFrameDecode *frame) hr = IWICMetadataBlockReader_GetReaderByIndex(block_reader, i, &reader); if (hr == S_OK) { - delay = get_property(reader, &GUID_MetadataFormatGCE, delayW); - if (delay) + prop = get_property(reader, format, property); + if (prop) { - if (delay->type == PropertyTagTypeShort && delay->length == 2) - value = *(SHORT *)delay->value; + if (prop->type == PropertyTagTypeByte && prop->length == 1) + value = *(BYTE *)prop->value; + else if (prop->type == PropertyTagTypeShort && prop->length == 2) + value = *(SHORT *)prop->value; - GdipFree(delay); + GdipFree(prop); } IWICMetadataReader_Release(reader); } @@ -3279,6 +3280,7 @@ static LONG get_gif_frame_delay(IWICBitmapFrameDecode *frame) static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UINT active_frame) { + static const WCHAR delayW[] = { 'D','e','l','a','y',0 }; HRESULT hr; IWICBitmapFrameDecode *frame; IWICMetadataBlockReader *block_reader; @@ -3307,7 +3309,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI hr = IWICBitmapDecoder_GetFrame(decoder, i, &frame); if (hr == S_OK) { - value[i] = get_gif_frame_delay(frame); + value[i] = get_gif_frame_property(frame, &GUID_MetadataFormatGCE, delayW); IWICBitmapFrameDecode_Release(frame); } else value[i] = 0; @@ -3603,23 +3605,159 @@ static GpStatus select_frame_wic(GpImage *image, UINT active_frame) return Ok; } -static GpStatus select_frame_gif(GpImage *image, UINT active_frame) +static HRESULT get_gif_frame_rect(IWICBitmapFrameDecode *frame, + UINT *left, UINT *top, UINT *width, UINT *height) { - GpImage *new_image; - GpStatus status; + static const WCHAR leftW[] = {'L','e','f','t',0}; + static const WCHAR topW[] = {'T','o','p',0}; - status = decode_frame_wic(image->decoder, TRUE, active_frame, gif_metadata_reader, &new_image); - if(status != Ok) - return status; + *left = get_gif_frame_property(frame, &GUID_MetadataFormatIMD, leftW); + *top = get_gif_frame_property(frame, &GUID_MetadataFormatIMD, topW); - memcpy(&new_image->format, &image->format, sizeof(GUID)); - free_image_data(image); - if (image->type == ImageTypeBitmap) - *(GpBitmap *)image = *(GpBitmap *)new_image; - else if (image->type == ImageTypeMetafile) - *(GpMetafile *)image = *(GpMetafile *)new_image; - new_image->type = ~0; - GdipFree(new_image); + return IWICBitmapFrameDecode_GetSize(frame, width, height); +} + +static HRESULT blit_gif_frame(GpBitmap *bitmap, IWICBitmapFrameDecode *frame, BOOL first_frame) +{ + UINT i, j, left, top, width, height; + IWICBitmapSource *source; + BYTE *new_bits; + HRESULT hr; + + hr = get_gif_frame_rect(frame, &left, &top, &width, &height); + if(FAILED(hr)) + return hr; + + hr = WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA, (IWICBitmapSource*)frame, &source); + if(FAILED(hr)) + return hr; + + new_bits = GdipAlloc(width*height*4); + if(!new_bits) + return E_OUTOFMEMORY; + + hr = IWICBitmapSource_CopyPixels(source, NULL, width*4, width*height*4, new_bits); + IWICBitmapSource_Release(source); + if(FAILED(hr)) { + GdipFree(new_bits); + return hr; + } + + for(i=0; i<height && i+top<bitmap->height; i++) { + for(j=0; j<width && j+left<bitmap->width; j++) { + DWORD *src = (DWORD*)(new_bits+i*width*4+j*4); + DWORD *dst = (DWORD*)(bitmap->bits+(i+top)*bitmap->stride+(j+left)*4); + + if(first_frame || *src>>24 != 0) + *dst = *src; + } + } + GdipFree(new_bits); + return hr; +} + +static DWORD get_gif_background_color(GpBitmap *bitmap) +{ + BYTE bgcolor_idx = 0; + UINT i; + + for(i=0; i<bitmap->prop_count; i++) { + if(bitmap->prop_item[i].id == PropertyTagIndexBackground) { + bgcolor_idx = *(BYTE*)bitmap->prop_item[i].value; + break; + } + } + + for(i=0; i<bitmap->prop_count; i++) { + if(bitmap->prop_item[i].id == PropertyTagIndexTransparent) { + BYTE transparent_idx; + transparent_idx = *(BYTE*)bitmap->prop_item[i].value; + + if(transparent_idx == bgcolor_idx) + return 0; + } + } + + for(i=0; i<bitmap->prop_count; i++) { + if(bitmap->prop_item[i].id == PropertyTagGlobalPalette) { + if(bitmap->prop_item[i].length/3 > bgcolor_idx) { + BYTE *color = ((BYTE*)bitmap->prop_item[i].value)+bgcolor_idx*3; + return color[2] + (color[1]<<8) + (color[0]<<16) + (0xff<<24); + } + break; + } + } + + FIXME("can't get gif background color\n"); + return 0xffffffff; +} + +static GpStatus select_frame_gif(GpImage* image, UINT active_frame) +{ + static const WCHAR disposalW[] = {'D','i','s','p','o','s','a','l',0}; + + GpBitmap *bitmap = (GpBitmap*)image; + IWICBitmapFrameDecode *frame; + int cur_frame=0, disposal; + BOOL bgcolor_set = FALSE; + DWORD bgcolor = 0; + HRESULT hr; + + if(active_frame > image->current_frame) { + hr = IWICBitmapDecoder_GetFrame(bitmap->image.decoder, image->current_frame, &frame); + if(FAILED(hr)) + return hresult_to_status(hr); + disposal = get_gif_frame_property(frame, &GUID_MetadataFormatGCE, disposalW); + IWICBitmapFrameDecode_Release(frame); + + if(disposal == GIF_DISPOSE_RESTORE_TO_BKGND) + cur_frame = image->current_frame; + else if(disposal != GIF_DISPOSE_RESTORE_TO_PREV) + cur_frame = image->current_frame+1; + } + + while(cur_frame != active_frame) { + hr = IWICBitmapDecoder_GetFrame(bitmap->image.decoder, cur_frame, &frame); + if(FAILED(hr)) + return hresult_to_status(hr); + disposal = get_gif_frame_property(frame, &GUID_MetadataFormatGCE, disposalW); + + if(disposal==GIF_DISPOSE_UNSPECIFIED || disposal==GIF_DISPOSE_DO_NOT_DISPOSE) { + hr = blit_gif_frame(bitmap, frame, cur_frame==0); + if(FAILED(hr)) + return hresult_to_status(hr); + }else if(disposal == GIF_DISPOSE_RESTORE_TO_BKGND) { + UINT left, top, width, height, i, j; + + if(!bgcolor_set) { + bgcolor = get_gif_background_color(bitmap); + bgcolor_set = TRUE; + } + + hr = get_gif_frame_rect(frame, &left, &top, &width, &height); + if(FAILED(hr)) + return hresult_to_status(hr); + for(i=top; i<top+height && i<bitmap->height; i++) { + DWORD *bits = (DWORD*)(bitmap->bits+i*bitmap->stride); + for(j=left; j<left+width && j<bitmap->width; j++) + bits[j] = bgcolor; + } + } + + IWICBitmapFrameDecode_Release(frame); + cur_frame++; + } + + hr = IWICBitmapDecoder_GetFrame(bitmap->image.decoder, active_frame, &frame); + if(FAILED(hr)) + return hresult_to_status(hr); + + hr = blit_gif_frame(bitmap, frame, cur_frame==0); + IWICBitmapFrameDecode_Release(frame); + if(FAILED(hr)) + return hresult_to_status(hr); + + image->current_frame = active_frame; return Ok; }
1
0
0
0
Piotr Caban : gdiplus: Convert animated gif to PixelFormat32bppARGB on load.
by Alexandre Julliard
13 Mar '15
13 Mar '15
Module: wine Branch: master Commit: 799362a0b7afa59d8238ed1536d791088f6cee9f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=799362a0b7afa59d8238ed153…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Mar 12 10:17:34 2015 +0100 gdiplus: Convert animated gif to PixelFormat32bppARGB on load. --- dlls/gdiplus/image.c | 55 ++++++++++++++++++++++++++++++++-------------- dlls/gdiplus/tests/image.c | 16 ++++++++++++++ 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 36502d7..409a3c6 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -3421,7 +3421,7 @@ static GpStatus initialize_decoder_wic(IStream *stream, REFGUID container, IWICB typedef void (*metadata_reader_func)(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UINT frame); -static GpStatus decode_frame_wic(IWICBitmapDecoder *decoder, +static GpStatus decode_frame_wic(IWICBitmapDecoder *decoder, BOOL force_conversion, UINT active_frame, metadata_reader_func metadata_reader, GpImage **image) { GpStatus status=Ok; @@ -3449,25 +3449,25 @@ static GpStatus decode_frame_wic(IWICBitmapDecoder *decoder, if (SUCCEEDED(hr)) { - IWICBitmapSource *bmp_source; - IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICBitmapSource, (void **)&bmp_source); - - for (i=0; pixel_formats[i].wic_format; i++) + if (!force_conversion) { - if (IsEqualGUID(&wic_format, pixel_formats[i].wic_format)) + for (i=0; pixel_formats[i].wic_format; i++) { - source = bmp_source; - gdip_format = pixel_formats[i].gdip_format; - palette_type = pixel_formats[i].palette_type; - break; + if (IsEqualGUID(&wic_format, pixel_formats[i].wic_format)) + { + source = (IWICBitmapSource*)frame; + IWICBitmapSource_AddRef(source); + gdip_format = pixel_formats[i].gdip_format; + palette_type = pixel_formats[i].palette_type; + break; + } } } if (!source) { /* unknown format; fall back on 32bppARGB */ - hr = WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA, bmp_source, &source); + hr = WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA, (IWICBitmapSource*)frame, &source); gdip_format = PixelFormat32bppARGB; - IWICBitmapSource_Release(bmp_source); } TRACE("%s => %#x\n", wine_dbgstr_guid(&wic_format), gdip_format); } @@ -3578,7 +3578,7 @@ static GpStatus decode_image_wic(IStream *stream, REFGUID container, if(status != Ok) return status; - status = decode_frame_wic(decoder, 0, metadata_reader, image); + status = decode_frame_wic(decoder, FALSE, 0, metadata_reader, image); IWICBitmapDecoder_Release(decoder); return status; } @@ -3588,7 +3588,7 @@ static GpStatus select_frame_wic(GpImage *image, UINT active_frame) GpImage *new_image; GpStatus status; - status = decode_frame_wic(image->decoder, active_frame, NULL, &new_image); + status = decode_frame_wic(image->decoder, FALSE, active_frame, NULL, &new_image); if(status != Ok) return status; @@ -3608,7 +3608,7 @@ static GpStatus select_frame_gif(GpImage *image, UINT active_frame) GpImage *new_image; GpStatus status; - status = decode_frame_wic(image->decoder, active_frame, gif_metadata_reader, &new_image); + status = decode_frame_wic(image->decoder, TRUE, active_frame, gif_metadata_reader, &new_image); if(status != Ok) return status; @@ -3658,7 +3658,30 @@ static GpStatus decode_image_png(IStream* stream, GpImage **image) static GpStatus decode_image_gif(IStream* stream, GpImage **image) { - return decode_image_wic(stream, &GUID_ContainerFormatGif, gif_metadata_reader, image); + IWICBitmapDecoder *decoder; + UINT frame_count; + GpStatus status; + HRESULT hr; + + status = initialize_decoder_wic(stream, &GUID_ContainerFormatGif, &decoder); + if(status != Ok) + return status; + + hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); + if(FAILED(hr)) + return hresult_to_status(hr); + + status = decode_frame_wic(decoder, frame_count>1 ? TRUE : FALSE, + 0, gif_metadata_reader, image); + IWICBitmapDecoder_Release(decoder); + if(status != Ok) + return status; + + if(frame_count > 1) { + GdipFree((*image)->palette); + (*image)->palette = NULL; + } + return Ok; } static GpStatus decode_image_tiff(IStream* stream, GpImage **image) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index fe80bd6..f33cb90 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -2434,6 +2434,8 @@ static void test_multiframegif(void) ARGB color; UINT count; GUID dimension; + PixelFormat pixel_format; + INT palette_size; /* Test frame functions with an animated GIF */ hglob = GlobalAlloc (0, sizeof(gifanimation)); @@ -2452,6 +2454,16 @@ static void test_multiframegif(void) return; } + stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format); + expect(Ok, stat); + expect(PixelFormat32bppARGB, pixel_format); + + stat = GdipGetImagePaletteSize((GpImage*)bmp, &palette_size); + expect(Ok, stat); + ok(palette_size == sizeof(ColorPalette) || + broken(palette_size == sizeof(ColorPalette)+sizeof(ARGB[3])), + "palette_size = %d\n", palette_size); + /* Bitmap starts at frame 0 */ color = 0xdeadbeef; stat = GdipBitmapGetPixel(bmp, 0, 0, &color); @@ -2543,6 +2555,10 @@ static void test_multiframegif(void) return; } + stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format); + expect(Ok, stat); + expect(PixelFormat8bppIndexed, pixel_format); + /* Check metadata */ stat = GdipImageGetFrameDimensionsCount((GpImage*)bmp,&count); expect(Ok, stat);
1
0
0
0
← Newer
1
...
42
43
44
45
46
47
48
...
78
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Results per page:
10
25
50
100
200