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
2024
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
Download
wine-devel
August 2021
----- 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
[email protected]
78 participants
929 discussions
Start a n
N
ew thread
[PATCH v2 8/8] gdi32: Use NtGdiCreateDIBSection for CreateDIBSection.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/bitblt.c | 2 +- dlls/gdi32/bitmap.c | 2 +- dlls/gdi32/dib.c | 7 ++++--- dlls/gdi32/objects.c | 9 +++++++++ include/ntgdi.h | 3 +++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 7f66d2f66fe..497e8a59f24 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -877,7 +877,7 @@ BOOL WINAPI GdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDest, info.bmiHeader.biPlanes = 1; info.bmiHeader.biBitCount = 24; info.bmiHeader.biCompression = BI_RGB; - bmpWork = CreateDIBSection( 0, &info, DIB_RGB_COLORS, NULL, NULL, 0 ); + bmpWork = NtGdiCreateDIBSection( 0, NULL, 0, &info, DIB_RGB_COLORS, 0, 0, 0, NULL ); } else bmpWork = NtGdiCreateCompatibleBitmap( hdcDest, widthDest, heightDest ); oldWork = NtGdiSelectBitmap(hdcWork, bmpWork); diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index 472efdec295..db6a4c44c84 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -76,7 +76,7 @@ HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height ) memcpy( bi->bmiColors, dib.dsBitfields, sizeof(dib.dsBitfields) ); else if (dib.dsBmih.biBitCount <= 8) /* copy the color table */ NtGdiDoPalette( hdc, 0, 256, bi->bmiColors, NtGdiGetDIBColorTable, FALSE ); - return CreateDIBSection( hdc, bi, DIB_RGB_COLORS, NULL, NULL, 0 ); + return NtGdiCreateDIBSection( hdc, NULL, 0, bi, DIB_RGB_COLORS, 0, 0, 0, NULL ); default: return 0; diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index fa736223aae..68ca1c31664 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -1460,10 +1460,11 @@ HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWOR /*********************************************************************** - * CreateDIBSection (GDI32.@) + * NtGdiCreateDIBSection (win32u.@) */ -HBITMAP WINAPI DECLSPEC_HOTPATCH CreateDIBSection(HDC hdc, const BITMAPINFO *bmi, UINT usage, - void **bits, HANDLE section, DWORD offset) +HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, const BITMAPINFO *bmi, + UINT usage, UINT header_size, ULONG flags, + ULONG_PTR color_space, void **bits ) { char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *info = (BITMAPINFO *)buffer; diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 055994a1680..d1d9cdb1e35 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -753,6 +753,15 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, DWORD in 0, 0, 0, 0 ); } +/*********************************************************************** + * CreateDIBSection (GDI32.@) + */ +HBITMAP WINAPI DECLSPEC_HOTPATCH CreateDIBSection( HDC hdc, const BITMAPINFO *bmi, UINT usage, + void **bits, HANDLE section, DWORD offset ) +{ + return NtGdiCreateDIBSection( hdc, section, offset, bmi, usage, 0, 0, 0, bits ); +} + /*********************************************************************** * GetDIBits (win32u.@) */ diff --git a/include/ntgdi.h b/include/ntgdi.h index 72427a20295..f03b12a09ae 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -222,6 +222,9 @@ HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWO const void *bits, const BITMAPINFO *data, UINT coloruse, UINT max_info, UINT max_bits, ULONG flags, HANDLE xform ); +HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, const BITMAPINFO *bmi, + UINT usage, UINT header_size, ULONG flags, + ULONG_PTR color_space, void **bits ); HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc ); HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen ); HDC WINAPI NtGdiCreateMetafileDC( HDC hdc ); -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 7/8] gdi32: Use NtGdiCreateDIBitmapInternal for CreateDIBitmap.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/dib.c | 29 ++++++++++++----------------- dlls/gdi32/objects.c | 31 ++++++++++++++++++++++++++++++- include/ntgdi.h | 4 ++++ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 976e6060955..fa736223aae 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -1418,35 +1418,30 @@ done: /*********************************************************************** - * CreateDIBitmap (GDI32.@) + * NtGdiCreateDIBitmapInternal (win32u.@) * * Creates a DDB (device dependent bitmap) from a DIB. * The DDB will have the same color depth as the reference DC. */ -HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, - DWORD init, LPCVOID bits, const BITMAPINFO *data, - UINT coloruse ) +HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWORD init, + const void *bits, const BITMAPINFO *data, + UINT coloruse, UINT max_info, UINT max_bits, + ULONG flags, HANDLE xform ) { - BITMAPINFOHEADER info; HBITMAP handle; - LONG height; - if (!bitmapinfoheader_from_user_bitmapinfo( &info, header )) return 0; - if (info.biCompression == BI_JPEG || info.biCompression == BI_PNG) return 0; - if (coloruse > DIB_PAL_COLORS + 1) return 0; - if (info.biWidth < 0) return 0; + if (coloruse > DIB_PAL_COLORS + 1 || width < 0) return 0; /* Top-down DIBs have a negative height */ - height = abs( info.biHeight ); + height = abs( height ); - TRACE("hdc=%p, header=%p, init=%u, bits=%p, data=%p, coloruse=%u (bitmap: width=%d, height=%d, bpp=%u, compr=%u)\n", - hdc, header, init, bits, data, coloruse, info.biWidth, info.biHeight, - info.biBitCount, info.biCompression); + TRACE( "hdc=%p, init=%u, bits=%p, data=%p, coloruse=%u (bitmap: width=%d, height=%d)\n", + hdc, init, bits, data, coloruse, width, height ); if (hdc == NULL) - handle = CreateBitmap( info.biWidth, height, 1, 1, NULL ); + handle = NtGdiCreateBitmap( width, height, 1, 1, NULL ); else - handle = CreateCompatibleBitmap( hdc, info.biWidth, height ); + handle = NtGdiCreateCompatibleBitmap( hdc, width, height ); if (handle) { @@ -1454,7 +1449,7 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, { if (SetDIBits( hdc, handle, 0, height, bits, data, coloruse ) == 0) { - DeleteObject( handle ); + NtGdiDeleteObjectApp( handle ); handle = 0; } } diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 03985737b51..055994a1680 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -725,7 +725,36 @@ UINT WINAPI GetSystemPaletteEntries( HDC hdc, UINT start, UINT count, PALETTEENT } /*********************************************************************** - * GetDIBits (GDI32.@) + * CreateDIBitmap (GDI32.@) + */ +HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, DWORD init, + const void *bits, const BITMAPINFO *data, UINT coloruse ) +{ + int width, height; + + if (!header) return 0; + + if (header->biSize == sizeof(BITMAPCOREHEADER)) + { + const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)header; + width = core->bcWidth; + height = core->bcHeight; + } + else if (header->biSize >= sizeof(BITMAPINFOHEADER)) + { + if (header->biCompression == BI_JPEG || header->biCompression == BI_PNG) return 0; + width = header->biWidth; + height = header->biHeight; + } + else return 0; + + if (!width || !height) return GetStockObject( STOCK_LAST + 1 ); /* default 1x1 bitmap */ + return NtGdiCreateDIBitmapInternal( hdc, width, height, init, bits, data, coloruse, + 0, 0, 0, 0 ); +} + +/*********************************************************************** + * GetDIBits (win32u.@) */ INT WINAPI DECLSPEC_HOTPATCH GetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, void *bits, BITMAPINFO *info, UINT coloruse ) diff --git a/include/ntgdi.h b/include/ntgdi.h index fbe168a73bd..72427a20295 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -218,6 +218,10 @@ BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc ); HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, UINT bpp, const void *bits ); HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height ); +HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWORD init, + const void *bits, const BITMAPINFO *data, + UINT coloruse, UINT max_info, UINT max_bits, + ULONG flags, HANDLE xform ); HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc ); HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen ); HDC WINAPI NtGdiCreateMetafileDC( HDC hdc ); -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 6/8] gdi32: Use NtGdiGetDIBitsInternal for GetDIBits.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/dib.c | 17 ++++------------- dlls/gdi32/objects.c | 9 +++++++++ include/ntgdi.h | 3 +++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 5a8d29ae5bf..976e6060955 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -1190,22 +1190,13 @@ BITMAPINFO *copy_packed_dib( const BITMAPINFO *src_info, UINT usage ) } /****************************************************************************** - * GetDIBits [GDI32.@] + * NtGdiGetDIBitsInternal (win32u.@) * * Retrieves bits of bitmap and copies to buffer. - * - * RETURNS - * Success: Number of scan lines copied from bitmap - * Failure: 0 */ -INT WINAPI DECLSPEC_HOTPATCH GetDIBits( - HDC hdc, /* [in] Handle to device context */ - HBITMAP hbitmap, /* [in] Handle to bitmap */ - UINT startscan, /* [in] First scan line to set in dest bitmap */ - UINT lines, /* [in] Number of scan lines to copy */ - LPVOID bits, /* [out] Address of array for bitmap bits */ - BITMAPINFO * info, /* [out] Address of structure with bitmap data */ - UINT coloruse) /* [in] RGB or palette index */ +INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, + void *bits, BITMAPINFO *info, UINT coloruse, + UINT max_bits, UINT max_info ) { DC * dc; BITMAPOBJ * bmp; diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 58ac32ed576..03985737b51 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -724,6 +724,15 @@ UINT WINAPI GetSystemPaletteEntries( HDC hdc, UINT start, UINT count, PALETTEENT return 0; } +/*********************************************************************** + * GetDIBits (GDI32.@) + */ +INT WINAPI DECLSPEC_HOTPATCH GetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, + void *bits, BITMAPINFO *info, UINT coloruse ) +{ + return NtGdiGetDIBitsInternal( hdc, hbitmap, startscan, lines, bits, info, coloruse, 0, 0 ); +} + /*********************************************************************** * GetDIBColorTable (GDI32.@) */ diff --git a/include/ntgdi.h b/include/ntgdi.h index 63f65e04794..fbe168a73bd 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -273,6 +273,9 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first_char, UINT last_char, WC BOOL WINAPI NtGdiGetColorAdjustment( HDC hdc, COLORADJUSTMENT *ca ); BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result ); BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result ); +INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, + void *bits, BITMAPINFO *info, UINT coloruse, + UINT max_bits, UINT max_info ); INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap ); BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr ); DWORD WINAPI NtGdiGetFontData( HDC hdc, DWORD table, DWORD offset, void *buffer, DWORD length ); -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 5/8] gdi32: Use NtGdiGetAndSetDCDword for SetGraphicsMode.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/bitblt.c | 9 ++++----- dlls/gdi32/dc.c | 49 +++++++++++++++++++++------------------------ dlls/gdi32/gdidc.c | 9 +++++++++ include/ntgdi.h | 1 + 4 files changed, 37 insertions(+), 31 deletions(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index dcc2c932453..7f66d2f66fe 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -1019,7 +1019,7 @@ BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint, HDC hdcSrc, INT nXSrc, INT nYSrc, INT nWidth, INT nHeight, HBITMAP hbmMask, INT xMask, INT yMask) { - int oldgMode; + DWORD prev_mode; /* parallelogram coords */ POINT plg[3]; /* rect coords */ @@ -1030,8 +1030,7 @@ BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint, double det; /* save actual mode, set GM_ADVANCED */ - oldgMode = SetGraphicsMode(hdcDest,GM_ADVANCED); - if (oldgMode == 0) + if (!NtGdiGetAndSetDCDword( hdcDest, NtGdiSetGraphicsMode, GM_ADVANCED, &prev_mode )) return FALSE; memcpy(plg,lpPoint,sizeof(POINT)*3); @@ -1047,7 +1046,7 @@ BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint, if (fabs(det) < 1e-5) { - SetGraphicsMode(hdcDest,oldgMode); + NtGdiGetAndSetDCDword( hdcDest, NtGdiSetGraphicsMode, prev_mode, NULL ); return FALSE; } @@ -1084,7 +1083,7 @@ BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint, SRCCOPY); /* restore dest DC */ SetWorldTransform(hdcDest,&oldDestXf); - SetGraphicsMode(hdcDest,oldgMode); + NtGdiGetAndSetDCDword( hdcDest, NtGdiSetGraphicsMode, prev_mode, NULL ); return TRUE; } diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 7e9dff645b1..420754b555e 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -806,6 +806,24 @@ INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap ) } +static BOOL set_graphics_mode( DC *dc, int mode ) +{ + if (mode == dc->attr->graphics_mode) return TRUE; + if (mode <= 0 || mode > GM_LAST) return FALSE; + + /* One would think that setting the graphics mode to GM_COMPATIBLE + * would also reset the world transformation matrix to the unity + * matrix. However, in Windows, this is not the case. This doesn't + * make a lot of sense to me, but that's the way it is. + */ + dc->attr->graphics_mode = mode; + + /* font metrics depend on the graphics mode */ + NtGdiSelectFont(dc->hSelf, dc->hFont); + return TRUE; +} + + /*********************************************************************** * NtGdiGetAndSetDCDword (win32u.@) */ @@ -848,6 +866,11 @@ BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *pre if (value != CLR_INVALID) dc->attr->pen_color = value; break; + case NtGdiSetGraphicsMode: + if (prev_value) *prev_value = dc->attr->graphics_mode; + ret = set_graphics_mode( dc, value ); + break; + default: WARN( "unknown method %u\n", method ); ret = FALSE; @@ -859,32 +882,6 @@ BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *pre } -/*********************************************************************** - * SetGraphicsMode (GDI32.@) - */ -INT WINAPI SetGraphicsMode( HDC hdc, INT mode ) -{ - INT ret = 0; - DC *dc = get_dc_ptr( hdc ); - - /* One would think that setting the graphics mode to GM_COMPATIBLE - * would also reset the world transformation matrix to the unity - * matrix. However, in Windows, this is not the case. This doesn't - * make a lot of sense to me, but that's the way it is. - */ - if (!dc) return 0; - if ((mode > 0) && (mode <= GM_LAST)) - { - ret = dc->attr->graphics_mode; - dc->attr->graphics_mode = mode; - } - /* font metrics depend on the graphics mode */ - if (ret != mode) NtGdiSelectFont(dc->hSelf, dc->hFont); - release_dc_ptr( dc ); - return ret; -} - - /*********************************************************************** * NtGdiGetTransform (win32u.@) * diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index c3c7ad710f2..0be21c75d58 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -436,6 +436,15 @@ INT WINAPI GetGraphicsMode( HDC hdc ) return dc_attr ? dc_attr->graphics_mode : 0; } +/*********************************************************************** + * SetGraphicsMode (GDI32.@) + */ +INT WINAPI SetGraphicsMode( HDC hdc, INT mode ) +{ + DWORD ret; + return NtGdiGetAndSetDCDword( hdc, NtGdiSetGraphicsMode, mode, &ret ) ? ret : 0; +} + /*********************************************************************** * GetArcDirection (GDI32.@) */ diff --git a/include/ntgdi.h b/include/ntgdi.h index 25ac5ee505f..63f65e04794 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -111,6 +111,7 @@ enum NtGdiSetTextColor, NtGdiSetDCBrushColor, NtGdiSetDCPenColor, + NtGdiSetGraphicsMode, }; enum -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 4/8] gdi32: Use NtGdiCreateCompatibleBitmap for CreateCompatibleBitmap.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/bitblt.c | 8 ++++---- dlls/gdi32/bitmap.c | 30 ++++++++++++------------------ dlls/gdi32/objects.c | 13 +++++++++++++ include/ntgdi.h | 1 + 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 54c923236ee..dcc2c932453 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -789,7 +789,7 @@ BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest, /* make bitmap */ hDC1 = NtGdiCreateCompatibleDC( hdcDest ); - hBitmap1 = CreateCompatibleBitmap(hdcDest, nWidth, nHeight); + hBitmap1 = NtGdiCreateCompatibleBitmap( hdcDest, nWidth, nHeight ); hOldBitmap1 = NtGdiSelectBitmap(hDC1, hBitmap1); /* draw using bkgnd rop */ @@ -800,7 +800,7 @@ BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest, /* make bitmap */ hDC2 = NtGdiCreateCompatibleDC( hdcDest ); - hBitmap2 = CreateCompatibleBitmap(hdcDest, nWidth, nHeight); + hBitmap2 = NtGdiCreateCompatibleBitmap( hdcDest, nWidth, nHeight ); hOldBitmap2 = NtGdiSelectBitmap(hDC2, hBitmap2); /* draw using foregnd rop */ @@ -879,7 +879,7 @@ BOOL WINAPI GdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDest, info.bmiHeader.biCompression = BI_RGB; bmpWork = CreateDIBSection( 0, &info, DIB_RGB_COLORS, NULL, NULL, 0 ); } - else bmpWork = CreateCompatibleBitmap(hdcDest, widthDest, heightDest); + else bmpWork = NtGdiCreateCompatibleBitmap( hdcDest, widthDest, heightDest ); oldWork = NtGdiSelectBitmap(hdcWork, bmpWork); if(!StretchBlt(hdcWork, 0, 0, widthDest, heightDest, hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY)) { TRACE("Failed to stretch\n"); @@ -889,7 +889,7 @@ BOOL WINAPI GdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDest, /* Create mask */ hdcMask = NtGdiCreateCompatibleDC( hdcDest ); - bmpMask = CreateCompatibleBitmap(hdcMask, widthDest, heightDest); + bmpMask = NtGdiCreateCompatibleBitmap( hdcMask, widthDest, heightDest ); oldMask = NtGdiSelectBitmap(hdcMask, bmpMask); if(!BitBlt(hdcMask, 0, 0, widthDest, heightDest, hdcWork, 0, 0, SRCCOPY)) { TRACE("Failed to create mask\n"); diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index 8866ec0af8a..472efdec295 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -44,44 +44,38 @@ static const struct gdi_obj_funcs bitmap_funcs = /****************************************************************************** - * CreateCompatibleBitmap [GDI32.@] + * NtGdiCreateCompatibleBitmap (win32u.@) * * Creates a bitmap compatible with the DC. - * - * PARAMS - * hdc [I] Handle to device context - * width [I] Width of bitmap - * height [I] Height of bitmap - * - * RETURNS - * Success: Handle to bitmap - * Failure: 0 */ -HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height) +HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height ) { char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *bi = (BITMAPINFO *)buffer; DIBSECTION dib; - TRACE("(%p,%d,%d)\n", hdc, width, height); + TRACE( "(%p,%d,%d)\n", hdc, width, height ); + + if (!width || !height) return 0; if (GetObjectType( hdc ) != OBJ_MEMDC) - return CreateBitmap( width, height, - GetDeviceCaps(hdc, PLANES), GetDeviceCaps(hdc, BITSPIXEL), NULL ); + return NtGdiCreateBitmap( width, height, + NtGdiGetDeviceCaps( hdc, PLANES ), + NtGdiGetDeviceCaps( hdc, BITSPIXEL ), NULL ); - switch (GetObjectW( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(dib), &dib )) + switch (NtGdiExtGetObjectW( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(dib), &dib )) { case sizeof(BITMAP): /* A device-dependent bitmap is selected in the DC */ - return CreateBitmap( width, height, dib.dsBm.bmPlanes, dib.dsBm.bmBitsPixel, NULL ); + return NtGdiCreateBitmap( width, height, dib.dsBm.bmPlanes, dib.dsBm.bmBitsPixel, NULL ); case sizeof(DIBSECTION): /* A DIB section is selected in the DC */ bi->bmiHeader = dib.dsBmih; bi->bmiHeader.biWidth = width; bi->bmiHeader.biHeight = height; if (dib.dsBmih.biCompression == BI_BITFIELDS) /* copy the color masks */ - memcpy(bi->bmiColors, dib.dsBitfields, sizeof(dib.dsBitfields)); + memcpy( bi->bmiColors, dib.dsBitfields, sizeof(dib.dsBitfields) ); else if (dib.dsBmih.biBitCount <= 8) /* copy the color table */ - GetDIBColorTable(hdc, 0, 256, bi->bmiColors); + NtGdiDoPalette( hdc, 0, 256, bi->bmiColors, NtGdiGetDIBColorTable, FALSE ); return CreateDIBSection( hdc, bi, DIB_RGB_COLORS, NULL, NULL, 0 ); default: diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 70cf1d6a0a5..58ac32ed576 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -524,6 +524,19 @@ HBITMAP WINAPI CreateBitmap( INT width, INT height, UINT planes, return NtGdiCreateBitmap( width, height, planes, bpp, bits ); } +/****************************************************************************** + * CreateCompatibleBitmap (GDI32.@) + * + * Creates a bitmap compatible with the DC. + */ +HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height ) +{ + if (!width || !height) + return GetStockObject( STOCK_LAST + 1 ); /* default 1x1 bitmap */ + + return NtGdiCreateCompatibleBitmap( hdc, width, height ); +} + /****************************************************************************** * CreateDiscardableBitmap (GDI32.@) * diff --git a/include/ntgdi.h b/include/ntgdi.h index f8dd944a185..25ac5ee505f 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -216,6 +216,7 @@ INT WINAPI NtGdiCombineRgn( HRGN dest, HRGN src1, HRGN src2, INT mode ); BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc ); HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, UINT bpp, const void *bits ); +HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height ); HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc ); HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen ); HDC WINAPI NtGdiCreateMetafileDC( HDC hdc ); -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 3/8] gdi32: Use NtGdiExtCreatePen for ExtCreatePen.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/brush.c | 8 +------- dlls/gdi32/objects.c | 23 +++++++++++++++++++++++ dlls/gdi32/pen.c | 22 ++++++++++++---------- dlls/gdi32/tests/pen.c | 3 +-- include/ntgdi.h | 6 ++++-- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/dlls/gdi32/brush.c b/dlls/gdi32/brush.c index 1dcf4b2c844..7c43df0dfcf 100644 --- a/dlls/gdi32/brush.c +++ b/dlls/gdi32/brush.c @@ -90,8 +90,6 @@ done: BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern ) { - HGLOBAL hmem = 0; - pattern->info = NULL; pattern->bits.free = NULL; @@ -117,20 +115,16 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern ) brush->lbColor = 0; return copy_bitmap( pattern, (HBITMAP)brush->lbHatch ); - case BS_DIBPATTERN: - hmem = (HGLOBAL)brush->lbHatch; - if (!(brush->lbHatch = (ULONG_PTR)GlobalLock( hmem ))) return FALSE; - /* fall through */ case BS_DIBPATTERNPT: pattern->usage = brush->lbColor; pattern->info = copy_packed_dib( (BITMAPINFO *)brush->lbHatch, pattern->usage ); - if (hmem) GlobalUnlock( hmem ); if (!pattern->info) return FALSE; pattern->bits.ptr = (char *)pattern->info + get_dib_info_size( pattern->info, pattern->usage ); brush->lbStyle = BS_DIBPATTERN; brush->lbColor = 0; return TRUE; + case BS_DIBPATTERN: case BS_DIBPATTERN8X8: case BS_MONOPATTERN: case BS_INDEXED: diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index bdd4a03fe34..70cf1d6a0a5 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -398,6 +398,29 @@ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) return NtGdiCreatePen( style, width, color, NULL ); } +/*********************************************************************** + * ExtCreatePen (GDI32.@) + */ +HPEN WINAPI ExtCreatePen( DWORD style, DWORD width, const LOGBRUSH *brush, DWORD style_count, + const DWORD *style_bits ) +{ + ULONG brush_style = brush->lbStyle; + ULONG_PTR hatch = brush->lbHatch; + HPEN pen; + + if (brush_style == BS_DIBPATTERN) + { + if (!(hatch = (ULONG_PTR)GlobalLock( (HGLOBAL)hatch ))) return 0; + brush_style = BS_DIBPATTERNPT; + } + + pen = NtGdiExtCreatePen( style, width, brush_style, brush->lbColor, brush->lbHatch, hatch, + style_count, style_bits, /* FIXME */ 0, FALSE, NULL ); + + if (brush->lbStyle == BS_DIBPATTERN) GlobalUnlock( (HGLOBAL)brush->lbHatch ); + return pen; +} + /*********************************************************************** * CreateBrushIndirect (GDI32.@) */ diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index 3b3ab78ecd7..684cc8375d1 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -93,12 +93,12 @@ HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) } /*********************************************************************** - * ExtCreatePen (GDI32.@) + * NtGdiExtCreatePen (win32u.@) */ - -HPEN WINAPI ExtCreatePen( DWORD style, DWORD width, - const LOGBRUSH * brush, DWORD style_count, - const DWORD *style_bits ) +HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULONG color, + ULONG_PTR client_hatch, ULONG_PTR hatch, DWORD style_count, + const DWORD *style_bits, ULONG dib_size, BOOL old_style, + HBRUSH brush ) { PENOBJ *penPtr = NULL; HPEN hpen; @@ -110,7 +110,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width, switch (style & PS_STYLE_MASK) { case PS_NULL: - return CreatePen( PS_NULL, 0, brush->lbColor ); + return NtGdiCreatePen( PS_NULL, 0, color, NULL ); case PS_SOLID: case PS_DASH: @@ -154,18 +154,20 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width, if ((style & PS_TYPE_MASK) == PS_GEOMETRIC) { - if (brush->lbStyle == BS_NULL) return CreatePen( PS_NULL, 0, 0 ); + if (brush_style == BS_NULL) return NtGdiCreatePen( PS_NULL, 0, 0, NULL ); } else { if (width != 1) goto invalid; - if (brush->lbStyle != BS_SOLID) goto invalid; + if (brush_style != BS_SOLID) goto invalid; } if (!(penPtr = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(PENOBJ,logpen.elpStyleEntry[style_count])))) return 0; - logbrush = *brush; + logbrush.lbStyle = brush_style; + logbrush.lbColor = color; + logbrush.lbHatch = hatch; if (!store_brush_pattern( &logbrush, &penPtr->pattern )) goto invalid; if (logbrush.lbStyle == BS_DIBPATTERN) logbrush.lbStyle = BS_DIBPATTERNPT; @@ -173,7 +175,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width, penPtr->logpen.elpWidth = abs((int)width); penPtr->logpen.elpBrushStyle = logbrush.lbStyle; penPtr->logpen.elpColor = logbrush.lbColor; - penPtr->logpen.elpHatch = brush->lbHatch; + penPtr->logpen.elpHatch = client_hatch; penPtr->logpen.elpNumEntries = style_count; memcpy(penPtr->logpen.elpStyleEntry, style_bits, style_count * sizeof(DWORD)); diff --git a/dlls/gdi32/tests/pen.c b/dlls/gdi32/tests/pen.c index 530272ea79f..d1bfa7ee34f 100644 --- a/dlls/gdi32/tests/pen.c +++ b/dlls/gdi32/tests/pen.c @@ -646,8 +646,7 @@ static void test_brush_pens(void) ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %x\n", elp->elpPenStyle ); ok( elp->elpBrushStyle == BS_DIBPATTERNPT, "wrong brush style %x\n", elp->elpBrushStyle ); ok( elp->elpColor == 0, "wrong color %x\n", elp->elpColor ); - ok( elp->elpHatch == lb.lbHatch || broken(elp->elpHatch != lb.lbHatch), /* <= w2k */ - "wrong hatch %lx/%lx\n", elp->elpHatch, lb.lbHatch ); + ok( elp->elpHatch == lb.lbHatch, "wrong hatch %lx/%lx\n", elp->elpHatch, lb.lbHatch ); ok( elp->elpNumEntries == 0, "wrong entries %x\n", elp->elpNumEntries ); break; diff --git a/include/ntgdi.h b/include/ntgdi.h index 7fa2b09b2e0..f8dd944a185 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -242,8 +242,10 @@ BOOL WINAPI NtGdiDeleteObjectApp( HGDIOBJ obj ); LONG WINAPI NtGdiDoPalette( HGDIOBJ handle, WORD start, WORD count, void *entries, DWORD func, BOOL inbound ); INT WINAPI NtGdiEndPage( HDC hdc ); -HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, const LOGBRUSH *brush, - DWORD style_count, const DWORD *style_bits ); +HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULONG color, + ULONG_PTR client_hatch, ULONG_PTR hatch, DWORD style_count, + const DWORD *style_bits, ULONG dib_size, BOOL old_style, + HBRUSH brush ); HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA *data ); INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer ); INT WINAPI NtGdiExtSelectClipRgn( HDC hdc, HRGN region, INT mode ); -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 2/8] gdi32: Move EnumObjects to objects.c.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/gdiobj.c | 77 -------------------------------------------- dlls/gdi32/objects.c | 73 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 77 deletions(-) diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 67550d7f724..2937cdcf48f 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1085,83 +1085,6 @@ BOOL WINAPI NtGdiUnrealizeObject( HGDIOBJ obj ) } -/* Solid colors to enumerate */ -static const COLORREF solid_colors[] = -{ RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff), -RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00), -RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00), -RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff), -RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00), -RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80), -RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80), -RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0) -}; - - -/*********************************************************************** - * EnumObjects (GDI32.@) - */ -INT WINAPI EnumObjects( HDC hdc, INT nObjType, - GOBJENUMPROC lpEnumFunc, LPARAM lParam ) -{ - UINT i; - INT retval = 0; - LOGPEN pen; - LOGBRUSH brush; - - TRACE("%p %d %p %08lx\n", hdc, nObjType, lpEnumFunc, lParam ); - switch(nObjType) - { - case OBJ_PEN: - /* Enumerate solid pens */ - for (i = 0; i < ARRAY_SIZE( solid_colors ); i++) - { - pen.lopnStyle = PS_SOLID; - pen.lopnWidth.x = 1; - pen.lopnWidth.y = 0; - pen.lopnColor = solid_colors[i]; - retval = lpEnumFunc( &pen, lParam ); - TRACE("solid pen %08x, ret=%d\n", - solid_colors[i], retval); - if (!retval) break; - } - break; - - case OBJ_BRUSH: - /* Enumerate solid brushes */ - for (i = 0; i < ARRAY_SIZE( solid_colors ); i++) - { - brush.lbStyle = BS_SOLID; - brush.lbColor = solid_colors[i]; - brush.lbHatch = 0; - retval = lpEnumFunc( &brush, lParam ); - TRACE("solid brush %08x, ret=%d\n", - solid_colors[i], retval); - if (!retval) break; - } - - /* Now enumerate hatched brushes */ - if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) - { - brush.lbStyle = BS_HATCHED; - brush.lbColor = RGB(0,0,0); - brush.lbHatch = i; - retval = lpEnumFunc( &brush, lParam ); - TRACE("hatched brush %d, ret=%d\n", - i, retval); - if (!retval) break; - } - break; - - default: - /* FIXME: implement Win32 types */ - WARN("(%d): Invalid type\n", nObjType ); - break; - } - return retval; -} - - /*********************************************************************** * NtGdiFlush (win32u.@) */ diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 830d187c9a2..bdd4a03fe34 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -821,3 +821,76 @@ DWORD WINAPI GdiSetBatchLimit( DWORD limit ) { return 1; /* FIXME */ } + +/* Solid colors to enumerate */ +static const COLORREF solid_colors[] = +{ + RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff), + RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00), + RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00), + RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff), + RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00), + RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80), + RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80), + RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0) +}; + +/*********************************************************************** + * EnumObjects (GDI32.@) + */ +INT WINAPI EnumObjects( HDC hdc, INT type, GOBJENUMPROC enum_func, LPARAM param ) +{ + UINT i; + INT retval = 0; + LOGPEN pen; + LOGBRUSH brush; + + TRACE( "%p %d %p %08lx\n", hdc, type, enum_func, param ); + + switch(type) + { + case OBJ_PEN: + /* Enumerate solid pens */ + for (i = 0; i < ARRAY_SIZE(solid_colors); i++) + { + pen.lopnStyle = PS_SOLID; + pen.lopnWidth.x = 1; + pen.lopnWidth.y = 0; + pen.lopnColor = solid_colors[i]; + retval = enum_func( &pen, param ); + TRACE( "solid pen %08x, ret=%d\n", solid_colors[i], retval ); + if (!retval) break; + } + break; + + case OBJ_BRUSH: + /* Enumerate solid brushes */ + for (i = 0; i < ARRAY_SIZE(solid_colors); i++) + { + brush.lbStyle = BS_SOLID; + brush.lbColor = solid_colors[i]; + brush.lbHatch = 0; + retval = enum_func( &brush, param ); + TRACE( "solid brush %08x, ret=%d\n", solid_colors[i], retval ); + if (!retval) break; + } + + /* Now enumerate hatched brushes */ + for (i = HS_HORIZONTAL; retval && i <= HS_DIAGCROSS; i++) + { + brush.lbStyle = BS_HATCHED; + brush.lbColor = RGB(0,0,0); + brush.lbHatch = i; + retval = enum_func( &brush, param ); + TRACE( "hatched brush %d, ret=%d\n", i, retval ); + } + break; + + default: + /* FIXME: implement Win32 types */ + WARN( "(%d): Invalid type\n", type ); + break; + } + + return retval; +} -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH v2 1/8] gdi32: Move stub object functions to objects.c.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> --- dlls/gdi32/gdiobj.c | 35 ----------------------------------- dlls/gdi32/objects.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 2e99d6a830b..67550d7f724 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1162,23 +1162,6 @@ INT WINAPI EnumObjects( HDC hdc, INT nObjType, } -/*********************************************************************** - * SetObjectOwner (GDI32.@) - */ -void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner ) -{ - /* Nothing to do */ -} - -/*********************************************************************** - * GdiInitializeLanguagePack (GDI32.@) - */ -DWORD WINAPI GdiInitializeLanguagePack( DWORD arg ) -{ - FIXME("stub\n"); - return 0; -} - /*********************************************************************** * NtGdiFlush (win32u.@) */ @@ -1188,24 +1171,6 @@ BOOL WINAPI NtGdiFlush(void) } -/*********************************************************************** - * GdiGetBatchLimit (GDI32.@) - */ -DWORD WINAPI GdiGetBatchLimit(void) -{ - return 1; /* FIXME */ -} - - -/*********************************************************************** - * GdiSetBatchLimit (GDI32.@) - */ -DWORD WINAPI GdiSetBatchLimit( DWORD limit ) -{ - return 1; /* FIXME */ -} - - /******************************************************************* * NtGdiGetColorAdjustment (win32u.@) */ diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index e5aa641edf3..830d187c9a2 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -788,3 +788,36 @@ done: release_display_device_init_mutex( mutex ); return status; } + +/*********************************************************************** + * SetObjectOwner (GDI32.@) + */ +void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner ) +{ + /* Nothing to do */ +} + +/*********************************************************************** + * GdiInitializeLanguagePack (GDI32.@) + */ +DWORD WINAPI GdiInitializeLanguagePack( DWORD arg ) +{ + FIXME( "stub\n" ); + return 0; +} + +/*********************************************************************** + * GdiGetBatchLimit (GDI32.@) + */ +DWORD WINAPI GdiGetBatchLimit(void) +{ + return 1; /* FIXME */ +} + +/*********************************************************************** + * GdiSetBatchLimit (GDI32.@) + */ +DWORD WINAPI GdiSetBatchLimit( DWORD limit ) +{ + return 1; /* FIXME */ +} -- 2.23.0
2 years, 8 months
1
0
0
0
[PATCH] dbghelp: tidy up internals for array type
by Eric Pouech
mainly remove hackish storage of information with negative value and use a uniform min/count pair for all debug formats Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/dbghelp/dbghelp_private.h | 4 ++-- dlls/dbghelp/dwarf.c | 12 ++++++------ dlls/dbghelp/msc.c | 10 +++++++++- dlls/dbghelp/stabs.c | 2 +- dlls/dbghelp/type.c | 23 ++++------------------- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 2906a5df6c3..2b0365bc386 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -254,7 +254,7 @@ struct symt_array { struct symt symt; int start; - int end; /* end index if > 0, or -array_len (in bytes) if < 0 */ + DWORD count; struct symt* base_type; struct symt* index_type; }; @@ -812,7 +812,7 @@ extern BOOL symt_add_enum_element(struct module* module, struct symt_enum* enum_type, const char* name, int value) DECLSPEC_HIDDEN; extern struct symt_array* - symt_new_array(struct module* module, int min, int max, + symt_new_array(struct module* module, int min, DWORD count, struct symt* base, struct symt* index) DECLSPEC_HIDDEN; extern struct symt_function_signature* symt_new_function_signature(struct module* module, diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 375a0d6d728..93baf10ba44 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1266,7 +1266,7 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx, /* FIXME: int4 even on 64bit machines??? */ idx_type = ctx->symt_cache[sc_int4]; min.u.uvalue = 0; - max.u.uvalue = -1; + cnt.u.uvalue = 0; } else for (i = 0; i < vector_length(children); i++) { @@ -1277,10 +1277,10 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx, idx_type = dwarf2_lookup_type(ctx, child); if (!dwarf2_find_attribute(ctx, child, DW_AT_lower_bound, &min)) min.u.uvalue = 0; - if (!dwarf2_find_attribute(ctx, child, DW_AT_upper_bound, &max)) - max.u.uvalue = 0; - if (dwarf2_find_attribute(ctx, child, DW_AT_count, &cnt)) - max.u.uvalue = min.u.uvalue + cnt.u.uvalue; + if (dwarf2_find_attribute(ctx, child, DW_AT_upper_bound, &max)) + cnt.u.uvalue = max.u.uvalue + 1 - min.u.uvalue; + else if (!dwarf2_find_attribute(ctx, child, DW_AT_count, &cnt)) + cnt.u.uvalue = 0; break; default: FIXME("Unhandled Tag type 0x%lx at %s, for %s\n", @@ -1288,7 +1288,7 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx, break; } } - di->symt = &symt_new_array(ctx->module, min.u.uvalue, max.u.uvalue, ref_type, idx_type)->symt; + di->symt = &symt_new_array(ctx->module, min.u.uvalue, cnt.u.uvalue, ref_type, idx_type)->symt; return di->symt; } diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 18535b9d151..905e3b0eaf1 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -671,8 +671,16 @@ static struct symt* codeview_add_type_array(struct codeview_type_parse* ctp, { struct symt* elem = codeview_fetch_type(ctp, elemtype, FALSE); struct symt* index = codeview_fetch_type(ctp, indextype, FALSE); + DWORD64 elem_size; + DWORD count = 0; - return &symt_new_array(ctp->module, 0, -arr_len, elem, index)->symt; + if (symt_get_info(ctp->module, elem, TI_GET_LENGTH, &elem_size) && elem_size) + { + if (arr_len % (DWORD)elem_size) + FIXME("array size should be a multiple of element size %u %u\n", arr_len, (DWORD)elem_size); + count = arr_len / (unsigned)elem_size; + } + return &symt_new_array(ctp->module, 0, count, elem, index)->symt; } static BOOL codeview_add_type_enum_field_list(struct module* module, diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index f51ba962186..b011c123482 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -758,7 +758,7 @@ static inline int stabs_pts_read_array(struct ParseTypedefData* ptd, PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &base_dt) == -1); - *adt = &symt_new_array(ptd->module, lo, hi, base_dt, range_dt)->symt; + *adt = &symt_new_array(ptd->module, lo, hi - lo + 1, base_dt, range_dt)->symt; return 0; } diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 0fa3b669467..7ce85531162 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -350,7 +350,7 @@ BOOL symt_add_enum_element(struct module* module, struct symt_enum* enum_type, return TRUE; } -struct symt_array* symt_new_array(struct module* module, int min, int max, +struct symt_array* symt_new_array(struct module* module, int min, DWORD cnt, struct symt* base, struct symt* index) { struct symt_array* sym; @@ -359,7 +359,7 @@ struct symt_array* symt_new_array(struct module* module, int min, int max, { sym->symt.tag = SymTagArrayType; sym->start = min; - sym->end = max; + sym->count = cnt; sym->base_type = base; sym->index_type = index; symt_add_type(module, &sym->symt); @@ -367,21 +367,6 @@ struct symt_array* symt_new_array(struct module* module, int min, int max, return sym; } -static inline DWORD symt_array_count(struct module* module, const struct symt_array* array) -{ - if (array->end < 0) - { - DWORD64 elem_size; - /* One could want to also set the array->end field in array, but we won't do it - * as long as all the get_type() helpers use const objects - */ - if (symt_get_info(module, array->base_type, TI_GET_LENGTH, &elem_size) && elem_size) - return -array->end / (DWORD)elem_size; - return 0; - } - return array->end - array->start + 1; -} - struct symt_function_signature* symt_new_function_signature(struct module* module, struct symt* ret_type, enum CV_call_e call_conv) @@ -630,7 +615,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, switch (type->tag) { case SymTagArrayType: - X(DWORD) = symt_array_count(module, (const struct symt_array*)type); + X(DWORD) = ((const struct symt_array*)type)->count; break; case SymTagFunctionType: /* this seems to be wrong for (future) C++ methods, where 'this' parameter @@ -676,7 +661,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, if (!symt_get_info(module, ((const struct symt_array*)type)->base_type, TI_GET_LENGTH, pInfo)) return FALSE; - X(DWORD64) *= symt_array_count(module, (const struct symt_array*)type); + X(DWORD64) *= ((const struct symt_array*)type)->count; break; case SymTagPublicSymbol: X(DWORD64) = ((const struct symt_public*)type)->size;
2 years, 8 months
1
0
0
0
[PATCH v2 2/2] api-ms-win-core-processtopology-l1-1-0: Add dll.
by Guillaume Charifi
Signed-off-by: Guillaume Charifi <guillaume.charifi(a)sfr.fr> --- configure | 2 ++ configure.ac | 1 + dlls/api-ms-win-core-processtopology-l1-1-0/Makefile.in | 1 + .../api-ms-win-core-processtopology-l1-1-0.spec | 4 ++++ tools/make_specfiles | 1 + 5 files changed, 9 insertions(+) create mode 100644 dlls/api-ms-win-core-processtopology-l1-1-0/Makefile.in create mode 100644 dlls/api-ms-win-core-processtopology-l1-1-0/api-ms-win-core-processtopology-l1-1-0.spec diff --git a/configure b/configure index 5f8735b0d37..f6ff51c492f 100755 --- a/configure +++ b/configure @@ -1012,6 +1012,7 @@ enable_api_ms_win_core_processthreads_l1_1_0 enable_api_ms_win_core_processthreads_l1_1_1 enable_api_ms_win_core_processthreads_l1_1_2 enable_api_ms_win_core_processthreads_l1_1_3 +enable_api_ms_win_core_processtopology_l1_1_0 enable_api_ms_win_core_processtopology_obsolete_l1_1_0 enable_api_ms_win_core_profile_l1_1_0 enable_api_ms_win_core_psapi_ansi_l1_1_0 @@ -20133,6 +20134,7 @@ wine_fn_config_makefile dlls/api-ms-win-core-processthreads-l1-1-0 enable_api_ms wine_fn_config_makefile dlls/api-ms-win-core-processthreads-l1-1-1 enable_api_ms_win_core_processthreads_l1_1_1 wine_fn_config_makefile dlls/api-ms-win-core-processthreads-l1-1-2 enable_api_ms_win_core_processthreads_l1_1_2 wine_fn_config_makefile dlls/api-ms-win-core-processthreads-l1-1-3 enable_api_ms_win_core_processthreads_l1_1_3 +wine_fn_config_makefile dlls/api-ms-win-core-processtopology-l1-1-0 enable_api_ms_win_core_processtopology_l1_1_0 wine_fn_config_makefile dlls/api-ms-win-core-processtopology-obsolete-l1-1-0 enable_api_ms_win_core_processtopology_obsolete_l1_1_0 wine_fn_config_makefile dlls/api-ms-win-core-profile-l1-1-0 enable_api_ms_win_core_profile_l1_1_0 wine_fn_config_makefile dlls/api-ms-win-core-psapi-ansi-l1-1-0 enable_api_ms_win_core_psapi_ansi_l1_1_0 diff --git a/configure.ac b/configure.ac index 594794ed93c..516d19675be 100644 --- a/configure.ac +++ b/configure.ac @@ -2833,6 +2833,7 @@ WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-processthreads-l1-1-0) WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-processthreads-l1-1-1) WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-processthreads-l1-1-2) WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-processthreads-l1-1-3) +WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-processtopology-l1-1-0) WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-processtopology-obsolete-l1-1-0) WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-profile-l1-1-0) WINE_CONFIG_MAKEFILE(dlls/api-ms-win-core-psapi-ansi-l1-1-0) diff --git a/dlls/api-ms-win-core-processtopology-l1-1-0/Makefile.in b/dlls/api-ms-win-core-processtopology-l1-1-0/Makefile.in new file mode 100644 index 00000000000..c6a3d3257e4 --- /dev/null +++ b/dlls/api-ms-win-core-processtopology-l1-1-0/Makefile.in @@ -0,0 +1 @@ +MODULE = api-ms-win-core-processtopology-l1-1-0.dll diff --git a/dlls/api-ms-win-core-processtopology-l1-1-0/api-ms-win-core-processtopology-l1-1-0.spec b/dlls/api-ms-win-core-processtopology-l1-1-0/api-ms-win-core-processtopology-l1-1-0.spec new file mode 100644 index 00000000000..c843a07fcaa --- /dev/null +++ b/dlls/api-ms-win-core-processtopology-l1-1-0/api-ms-win-core-processtopology-l1-1-0.spec @@ -0,0 +1,4 @@ +@ stdcall GetProcessGroupAffinity(long ptr ptr) kernel32.GetProcessGroupAffinity +@ stdcall GetThreadGroupAffinity(long ptr) kernel32.GetThreadGroupAffinity +@ stdcall SetProcessGroupAffinity(long ptr ptr) kernelbase.SetProcessGroupAffinity +@ stdcall SetThreadGroupAffinity(long ptr ptr) kernel32.SetThreadGroupAffinity diff --git a/tools/make_specfiles b/tools/make_specfiles index 44abb58b0a8..a7ee7e7f4db 100755 --- a/tools/make_specfiles +++ b/tools/make_specfiles @@ -297,6 +297,7 @@ my @dll_groups = "api-ms-win-core-wow64-l1-1-0", "api-ms-win-core-wow64-l1-1-1", "api-ms-win-core-xstate-l2-1-0", + "api-ms-win-core-processtopology-l1-1-0", "api-ms-win-core-processtopology-obsolete-l1-1-0", "api-ms-win-core-util-l1-1-0", "api-ms-win-downlevel-kernel32-l2-1-0", -- 2.33.0
2 years, 8 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
93
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Results per page:
10
25
50
100
200