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
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
July 2016
----- 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
680 discussions
Start a n
N
ew thread
Huw Davies : gdi32: Convert a few uses of get_dc_ptr() to get_physdev_dc() .
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: 0f2a776a59006a15fb84a2a51237d3484f136966 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0f2a776a59006a15fb84a2a51…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:36 2016 +0100 gdi32: Convert a few uses of get_dc_ptr() to get_physdev_dc(). In these cases we have the PHYSDEV meaning we own the DC already. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/bitblt.c | 11 ++--------- dlls/gdi32/enhmfdrv/dc.c | 13 ++++--------- dlls/gdi32/freetype.c | 4 +--- dlls/gdi32/path.c | 6 ++---- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index ebed7af..3a8f0f4 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -250,7 +250,7 @@ void get_mono_dc_colors( DC *dc, BITMAPINFO *info, int count ) BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) { - DC *dc_src, *dc_dst = get_nulldrv_dc( dst_dev ); + DC *dc_src = get_physdev_dc( src_dev ), *dc_dst = get_nulldrv_dc( dst_dev ); char src_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; char dst_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *src_info = (BITMAPINFO *)src_buffer; @@ -258,13 +258,9 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, DWORD err; struct gdi_image_bits bits; - if (!(dc_src = get_dc_ptr( src_dev->hdc ))) return FALSE; src_dev = GET_DC_PHYSDEV( dc_src, pGetImage ); if (src_dev->funcs->pGetImage( src_dev, src_info, &bits, src )) - { - release_dc_ptr( dc_src ); return FALSE; - } dst_dev = GET_DC_PHYSDEV( dc_dst, pPutImage ); copy_bitmapinfo( dst_info, src_info ); @@ -305,7 +301,6 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, } if (bits.free) bits.free( &bits ); - release_dc_ptr( dc_src ); return !err; } @@ -313,7 +308,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION func ) { - DC *dc_src, *dc_dst = get_nulldrv_dc( dst_dev ); + DC *dc_src = get_physdev_dc( src_dev ), *dc_dst = get_nulldrv_dc( dst_dev ); char src_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; char dst_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *src_info = (BITMAPINFO *)src_buffer; @@ -321,7 +316,6 @@ BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, DWORD err; struct gdi_image_bits bits; - if (!(dc_src = get_dc_ptr( src_dev->hdc ))) return FALSE; src_dev = GET_DC_PHYSDEV( dc_src, pGetImage ); err = src_dev->funcs->pGetImage( src_dev, src_info, &bits, src ); if (err) goto done; @@ -345,7 +339,6 @@ BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, if (bits.free) bits.free( &bits ); done: - release_dc_ptr( dc_src ); if (err) SetLastError( err ); return !err; } diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 00f4d65..64c6136 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -52,7 +52,7 @@ BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level ) { PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRestoreDC ); EMFDRV_PDEVICE* physDev = get_emf_physdev( dev ); - DC *dc = get_dc_ptr( dev->hdc ); + DC *dc = get_physdev_dc( dev ); EMRRESTOREDC emr; BOOL ret; @@ -63,7 +63,6 @@ BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level ) emr.iRelative = level; else emr.iRelative = level - dc->saveLevel - 1; - release_dc_ptr( dc ); physDev->restoring++; ret = next->funcs->pRestoreDC( next, level ); @@ -433,7 +432,7 @@ BOOL EMFDRV_BeginPath( PHYSDEV dev ) EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); PHYSDEV next = GET_NEXT_PHYSDEV( dev, pBeginPath ); EMRBEGINPATH emr; - DC *dc; + DC *dc = get_physdev_dc( dev ); emr.emr.iType = EMR_BEGINPATH; emr.emr.nSize = sizeof(emr); @@ -442,10 +441,8 @@ BOOL EMFDRV_BeginPath( PHYSDEV dev ) if (physDev->path) return TRUE; /* already open */ if (!next->funcs->pBeginPath( next )) return FALSE; - dc = get_dc_ptr( dev->hdc ); push_dc_driver( &dc->physDev, &physDev->pathdev, &emfpath_driver ); physDev->path = TRUE; - release_dc_ptr( dc ); return TRUE; } @@ -519,10 +516,9 @@ static BOOL emfpathdrv_AbortPath( PHYSDEV dev ) { PHYSDEV emfdev = get_emfdev( dev ); PHYSDEV next = GET_NEXT_PHYSDEV( dev, pAbortPath ); - DC *dc = get_dc_ptr( dev->hdc ); + DC *dc = get_physdev_dc( dev ); emfpath_driver.pDeleteDC( pop_dc_driver( dc, &emfpath_driver )); - release_dc_ptr( dc ); emfdev->funcs->pAbortPath( emfdev ); return next->funcs->pAbortPath( next ); } @@ -641,10 +637,9 @@ static BOOL emfpathdrv_EndPath( PHYSDEV dev ) { PHYSDEV emfdev = get_emfdev( dev ); PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEndPath ); - DC *dc = get_dc_ptr( dev->hdc ); + DC *dc = get_physdev_dc( dev ); emfpath_driver.pDeleteDC( pop_dc_driver( dc, &emfpath_driver )); - release_dc_ptr( dc ); emfdev->funcs->pEndPath( emfdev ); return next->funcs->pEndPath( next ); } diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index f8b4235..5ddfc6a 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -5322,14 +5322,13 @@ static HFONT freetype_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) CHARSETINFO csi; FMAT2 dcmat; FontSubst *psub = NULL; - DC *dc = get_dc_ptr( dev->hdc ); + DC *dc = get_physdev_dc( dev ); const SYSTEM_LINKS *font_link; if (!hfont) /* notification that the font has been changed by another driver */ { release_font( physdev->font ); physdev->font = NULL; - release_dc_ptr( dc ); return 0; } @@ -5779,7 +5778,6 @@ done: physdev->font = ret; } LeaveCriticalSection( &freetype_cs ); - release_dc_ptr( dc ); return ret ? hfont : 0; } diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 4ae9ba2..51334b2 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -767,10 +767,9 @@ static BOOL pathdrv_BeginPath( PHYSDEV dev ) */ static BOOL pathdrv_AbortPath( PHYSDEV dev ) { - DC *dc = get_dc_ptr( dev->hdc ); + DC *dc = get_physdev_dc( dev ); path_driver.pDeleteDC( pop_dc_driver( dc, &path_driver )); - release_dc_ptr( dc ); return TRUE; } @@ -781,12 +780,11 @@ static BOOL pathdrv_AbortPath( PHYSDEV dev ) static BOOL pathdrv_EndPath( PHYSDEV dev ) { struct path_physdev *physdev = get_path_physdev( dev ); - DC *dc = get_dc_ptr( dev->hdc ); + DC *dc = get_physdev_dc( dev ); dc->path = physdev->path; pop_dc_driver( dc, &path_driver ); HeapFree( GetProcessHeap(), 0, physdev ); - release_dc_ptr( dc ); return TRUE; }
1
0
0
0
Huw Davies : gdi32: Access several more properties directly from the DC.
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: 199ca9258a966b0fe4e164a91f327004223645dc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=199ca9258a966b0fe4e164a91…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:35 2016 +0100 gdi32: Access several more properties directly from the DC. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/bitblt.c | 6 +++--- dlls/gdi32/dib.c | 4 ++-- dlls/gdi32/enhmfdrv/graphics.c | 35 ++++++++++++++++++++--------------- dlls/gdi32/font.c | 18 ++++++++++-------- dlls/gdi32/painting.c | 9 ++++++--- 5 files changed, 41 insertions(+), 31 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=199ca9258a966b0fe4e16…
1
0
0
0
Huw Davies : gdi32: Where possible directly access the DC instead of using GetCurrentObject() .
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: aa4934783fb213c781e7ea4e5d54782ec5e570e6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=aa4934783fb213c781e7ea4e5…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:34 2016 +0100 gdi32: Where possible directly access the DC instead of using GetCurrentObject(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/dc.c | 6 +++--- dlls/gdi32/driver.c | 4 ++-- dlls/gdi32/enhmfdrv/objects.c | 6 ++++-- dlls/gdi32/font.c | 2 +- dlls/gdi32/palette.c | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 3b6c2ea..92a98df 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -354,8 +354,8 @@ void DC_UpdateXforms( DC *dc ) if (memcmp(&oldworld2vport, &dc->xformWorld2Vport, sizeof(oldworld2vport)) && !GdiIsMetaFileDC(dc->hSelf)) { - SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT)); - SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_PEN)); + SelectObject(dc->hSelf, dc->hFont); + SelectObject(dc->hSelf, dc->hPen); } } @@ -1038,7 +1038,7 @@ INT WINAPI SetGraphicsMode( HDC hdc, INT mode ) dc->GraphicsMode = mode; } /* font metrics depend on the graphics mode */ - if (ret != mode) SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT)); + if (ret != mode) SelectObject(dc->hSelf, dc->hFont); release_dc_ptr( dc ); return ret; } diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index d052e04..18e109e 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -390,9 +390,9 @@ static INT nulldrv_GetTextFace( PHYSDEV dev, INT size, LPWSTR name ) { INT ret = 0; LOGFONTW font; - HFONT hfont = GetCurrentObject( dev->hdc, OBJ_FONT ); + DC *dc = get_nulldrv_dc( dev ); - if (GetObjectW( hfont, sizeof(font), &font )) + if (GetObjectW( dc->hFont, sizeof(font), &font )) { ret = strlenW( font.lfFaceName ) + 1; if (name) diff --git a/dlls/gdi32/enhmfdrv/objects.c b/dlls/gdi32/enhmfdrv/objects.c index a8f6fb5..9bf79e4 100644 --- a/dlls/gdi32/enhmfdrv/objects.c +++ b/dlls/gdi32/enhmfdrv/objects.c @@ -463,10 +463,11 @@ found: COLORREF EMFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMRSELECTOBJECT emr; DWORD index; - if (GetCurrentObject( dev->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return color; + if (dc->hBrush != GetStockObject( DC_BRUSH )) return color; if (physDev->dc_brush) DeleteObject( physDev->dc_brush ); if (!(physDev->dc_brush = CreateSolidBrush( color ))) return CLR_INVALID; @@ -484,11 +485,12 @@ COLORREF EMFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) COLORREF EMFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMRSELECTOBJECT emr; DWORD index; LOGPEN logpen = { PS_SOLID, { 0, 0 }, color }; - if (GetCurrentObject( dev->hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return color; + if (dc->hPen != GetStockObject( DC_PEN )) return color; if (physDev->dc_pen) DeleteObject( physDev->dc_pen ); if (!(physDev->dc_pen = CreatePenIndirect( &logpen ))) return CLR_INVALID; diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index afeebb8..0dad024 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2269,7 +2269,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, } GetTextMetricsW(hdc, &tm); - GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf); + GetObjectW(dc->hFont, sizeof(lf), &lf); if(!(tm.tmPitchAndFamily & TMPF_VECTOR)) /* Non-scalable fonts shouldn't be rotated */ lf.lfEscapement = 0; diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c index be84b71..a8135d5 100644 --- a/dlls/gdi32/palette.c +++ b/dlls/gdi32/palette.c @@ -503,6 +503,7 @@ UINT WINAPI GetNearestPaletteIndex( COLORREF nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color ) { unsigned char spec_type; + DC *dc = get_nulldrv_dc( dev ); if (!(GetDeviceCaps( dev->hdc, RASTERCAPS ) & RC_PALETTE)) return color; @@ -512,7 +513,7 @@ COLORREF nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color ) /* we need logical palette for PALETTERGB and PALETTEINDEX colorrefs */ UINT index; PALETTEENTRY entry; - HPALETTE hpal = GetCurrentObject( dev->hdc, OBJ_PAL ); + HPALETTE hpal = dc->hPalette; if (!hpal) hpal = GetStockObject( DEFAULT_PALETTE ); if (spec_type == 2) /* PALETTERGB */
1
0
0
0
Huw Davies : gdi32: Move the release until after the final dc access.
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: d4d65e2df9c465f02a06ca91c847dd575c0df6ea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d4d65e2df9c465f02a06ca91c…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:33 2016 +0100 gdi32: Move the release until after the final dc access. Also only reselect the font if the graphics mode changes. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/dc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 59a3d9b..3b6c2ea 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -1037,9 +1037,9 @@ INT WINAPI SetGraphicsMode( HDC hdc, INT mode ) ret = dc->GraphicsMode; dc->GraphicsMode = mode; } - release_dc_ptr( dc ); /* font metrics depend on the graphics mode */ - if (ret) SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT)); + if (ret != mode) SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT)); + release_dc_ptr( dc ); return ret; }
1
0
0
0
Huw Davies : gdi32: Add an internal version of DPtoLP that takes a DC pointer.
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: e1130cbb99fb21f9884cd969b0121dd3ccb827b3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e1130cbb99fb21f9884cd969b…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:32 2016 +0100 gdi32: Add an internal version of DPtoLP that takes a DC pointer. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/clipping.c | 2 +- dlls/gdi32/dc.c | 2 +- dlls/gdi32/font.c | 22 +++++++++++----------- dlls/gdi32/gdi_private.h | 1 + dlls/gdi32/mapping.c | 26 ++++++++++++++++++++------ dlls/gdi32/path.c | 2 +- 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c index 4e965b9..d5553ee 100644 --- a/dlls/gdi32/clipping.c +++ b/dlls/gdi32/clipping.c @@ -438,7 +438,7 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect ) rect->left = rect->right - 1; rect->right = tmp - 1; } - DPtoLP( hdc, (LPPOINT)rect, 2 ); + dp_to_lp( dc, (LPPOINT)rect, 2 ); release_dc_ptr( dc ); TRACE("%p => %d %s\n", hdc, ret, wine_dbgstr_rect( rect )); return ret; diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index f8bf3f8..59a3d9b 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -1484,7 +1484,7 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags) rect->bottom = min( rect->bottom, dc->vis_rect.bottom - dc->vis_rect.top ); ret = DCB_SET; } - DPtoLP( hdc, (POINT *)rect, 2 ); + dp_to_lp( dc, (POINT *)rect, 2 ); } else ret = 0; diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 02efc8a..afeebb8 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -1901,7 +1901,7 @@ static RECT get_total_extents( HDC hdc, INT x, INT y, UINT flags, UINT aa_flags, } /* helper for nulldrv_ExtTextOut */ -static void draw_glyph( HDC hdc, INT origin_x, INT origin_y, const GLYPHMETRICS *metrics, +static void draw_glyph( DC *dc, INT origin_x, INT origin_y, const GLYPHMETRICS *metrics, const struct gdi_image_bits *image, const RECT *clip ) { static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; @@ -1941,8 +1941,8 @@ static void draw_glyph( HDC hdc, INT origin_x, INT origin_y, const GLYPHMETRICS } } assert( count <= max_count ); - DPtoLP( hdc, pts, count ); - for (i = 0; i < count; i += 2) Polyline( hdc, pts + i, 2 ); + dp_to_lp( dc, pts, count ); + for (i = 0; i < count; i += 2) Polyline( dc->hSelf, pts + i, 2 ); HeapFree( GetProcessHeap(), 0, pts ); } @@ -1966,7 +1966,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect if (brush) { orig = SelectObject( dev->hdc, brush ); - DPtoLP( dev->hdc, (POINT *)&rc, 2 ); + dp_to_lp( dc, (POINT *)&rc, 2 ); PatBlt( dev->hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY ); SelectObject( dev->hdc, orig ); DeleteObject( brush ); @@ -2063,7 +2063,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect err = get_glyph_bitmap( dev->hdc, str[i], flags, GGO_BITMAP, &metrics, &image ); if (err) continue; - if (image.ptr) draw_glyph( dev->hdc, x, y, &metrics, &image, (flags & ETO_CLIPPED) ? rect : NULL ); + if (image.ptr) draw_glyph( dc, x, y, &metrics, &image, (flags & ETO_CLIPPED) ? rect : NULL ); if (image.free) image.free( &image ); if (dx) @@ -2424,7 +2424,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, { pt.x = x + width.x; pt.y = y + width.y; - DPtoLP(hdc, &pt, 1); + dp_to_lp(dc, &pt, 1); MoveToEx(hdc, pt.x, pt.y, NULL); } break; @@ -2441,7 +2441,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, { pt.x = x; pt.y = y; - DPtoLP(hdc, &pt, 1); + dp_to_lp(dc, &pt, 1); MoveToEx(hdc, pt.x, pt.y, NULL); } break; @@ -2494,8 +2494,6 @@ done: if(reordered_str != str) HeapFree(GetProcessHeap(), 0, reordered_str); - release_dc_ptr( dc ); - if (ret && (lf.lfUnderline || lf.lfStrikeOut)) { int underlinePos, strikeoutPos; @@ -2541,7 +2539,7 @@ done: pts[3].y = pts[0].y + underlineWidth * cosEsc; pts[4].x = pts[0].x; pts[4].y = pts[0].y; - DPtoLP(hdc, pts, 5); + dp_to_lp(dc, pts, 5); Polygon(hdc, pts, 5); } @@ -2557,7 +2555,7 @@ done: pts[3].y = pts[0].y + strikeoutWidth * cosEsc; pts[4].x = pts[0].x; pts[4].y = pts[0].y; - DPtoLP(hdc, pts, 5); + dp_to_lp(dc, pts, 5); Polygon(hdc, pts, 5); } @@ -2566,6 +2564,8 @@ done: DeleteObject(hbrush); } + release_dc_ptr( dc ); + return ret; } diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 3df3a2c..e4633d1 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -304,6 +304,7 @@ extern void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN; extern void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN; /* mapping.c */ +extern BOOL dp_to_lp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN; extern void lp_to_dp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN; /* metafile.c */ diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c index 496643e..28b12bc 100644 --- a/dlls/gdi32/mapping.c +++ b/dlls/gdi32/mapping.c @@ -306,13 +306,12 @@ BOOL nulldrv_SetWorldTransform( PHYSDEV dev, const XFORM *xform ) } /*********************************************************************** - * DPtoLP (GDI32.@) + * dp_to_lp + * + * Internal version of DPtoLP that takes a DC *. */ -BOOL WINAPI DPtoLP( HDC hdc, LPPOINT points, INT count ) +BOOL dp_to_lp( DC *dc, POINT *points, INT count ) { - DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->vport2WorldValid) { while (count--) @@ -328,10 +327,25 @@ BOOL WINAPI DPtoLP( HDC hdc, LPPOINT points, INT count ) points++; } } - release_dc_ptr( dc ); return (count < 0); } +/*********************************************************************** + * DPtoLP (GDI32.@) + */ +BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count ) +{ + DC * dc = get_dc_ptr( hdc ); + BOOL ret; + + if (!dc) return FALSE; + + ret = dp_to_lp( dc, points, count ); + + release_dc_ptr( dc ); + return ret; +} + /*********************************************************************** * lp_to_dp diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index f6b6552..4ae9ba2 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -670,7 +670,7 @@ INT WINAPI GetPath(HDC hdc, LPPOINT pPoints, LPBYTE pTypes, INT nSize) memcpy(pTypes, dc->path->flags, sizeof(BYTE)*dc->path->count); /* Convert the points to logical coordinates */ - if(!DPtoLP(hdc, pPoints, dc->path->count)) + if(!dp_to_lp(dc, pPoints, dc->path->count)) { /* FIXME: Is this the correct value? */ SetLastError(ERROR_CAN_NOT_COMPLETE);
1
0
0
0
Huw Davies : gdi32: Remove an unnecessary call to get_dc_ptr().
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: 637c99f675083984af401217b820017a38cafdc3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=637c99f675083984af401217b…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:31 2016 +0100 gdi32: Remove an unnecessary call to get_dc_ptr(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/path.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index c204fde..f6b6552 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -798,12 +798,9 @@ static BOOL pathdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device, LPCWSTR output, const DEVMODEW *devmode ) { struct path_physdev *physdev = HeapAlloc( GetProcessHeap(), 0, sizeof(*physdev) ); - DC *dc; if (!physdev) return FALSE; - dc = get_dc_ptr( (*dev)->hdc ); push_dc_driver( dev, &physdev->dev, &path_driver ); - release_dc_ptr( dc ); return TRUE; }
1
0
0
0
Huw Davies : gdi32: Access a few more properties directly from the DC in the path driver.
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: e767a607909377752af355117b9403c25fa4a471 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e767a607909377752af355117…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:30 2016 +0100 gdi32: Access a few more properties directly from the DC in the path driver. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/path.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 015a059..c204fde 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -702,7 +702,7 @@ HRGN WINAPI PathToRegion(HDC hdc) dc->path = NULL; if (path) { - ret = path_to_region( path, GetPolyFillMode( hdc )); + ret = path_to_region( path, dc->polyFillMode ); free_gdi_path( path ); } } @@ -873,10 +873,12 @@ BOOL PATH_RestorePath( DC *dst, DC *src ) static BOOL pathdrv_MoveTo( PHYSDEV dev, INT x, INT y ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); + physdev->path->newStroke = TRUE; physdev->path->pos.x = x; physdev->path->pos.y = y; - LPtoDP( physdev->dev.hdc, &physdev->path->pos, 1 ); + lp_to_dp( dc, &physdev->path->pos, 1 ); return TRUE; } @@ -1137,7 +1139,7 @@ static BOOL PATH_Arc( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, } /* In GM_COMPATIBLE, don't include bottom and right edges */ - if (GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) + if (dc->GraphicsMode == GM_COMPATIBLE) { corners[1].x--; corners[1].y--; @@ -1225,8 +1227,9 @@ static BOOL pathdrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT eSt static BOOL pathdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC *dc = get_physdev_dc( dev ); return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), 0 ); + dc->ArcDirection, 0 ); } @@ -1236,8 +1239,9 @@ static BOOL pathdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, static BOOL pathdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC *dc = get_physdev_dc( dev ); return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), -1 ); + dc->ArcDirection, -1 ); } @@ -1247,8 +1251,9 @@ static BOOL pathdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom static BOOL pathdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC *dc = get_physdev_dc( dev ); return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), 1 ); + dc->ArcDirection, 1 ); } @@ -1258,8 +1263,9 @@ static BOOL pathdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom static BOOL pathdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC *dc = get_physdev_dc( dev ); return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), 2 ); + dc->ArcDirection, 2 ); } @@ -1311,7 +1317,7 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, case PT_MOVETO: path->newStroke = TRUE; path->pos = pts[i]; - LPtoDP( dev->hdc, &path->pos, 1 ); + lp_to_dp( dc, &path->pos, 1 ); lastmove = path->count; break; case PT_LINETO: @@ -2022,7 +2028,7 @@ BOOL nulldrv_BeginPath( PHYSDEV dev ) physdev = get_path_physdev( find_dc_driver( dc, &path_driver )); physdev->path = path; path->pos = dc->cur_pos; - LPtoDP( dev->hdc, &path->pos, 1 ); + lp_to_dp( dc, &path->pos, 1 ); if (dc->path) free_gdi_path( dc->path ); dc->path = NULL; return TRUE;
1
0
0
0
Huw Davies : gdi32: Pass a DC pointer to PATH_CheckCorners().
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: 377010dcfce629d52472261e0c3c18252f638abe URL:
http://source.winehq.org/git/wine.git/?a=commit;h=377010dcfce629d52472261e0…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:29 2016 +0100 gdi32: Pass a DC pointer to PATH_CheckCorners(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/path.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 24a9436..015a059 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -362,7 +362,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode ) * * Helper function for RoundRect() and Rectangle() */ -static BOOL PATH_CheckCorners( HDC hdc, POINT corners[], INT x1, INT y1, INT x2, INT y2 ) +static BOOL PATH_CheckCorners( DC *dc, POINT corners[], INT x1, INT y1, INT x2, INT y2 ) { INT temp; @@ -371,7 +371,7 @@ static BOOL PATH_CheckCorners( HDC hdc, POINT corners[], INT x1, INT y1, INT x2, corners[0].y=y1; corners[1].x=x2; corners[1].y=y2; - LPtoDP( hdc, corners, 2 ); + lp_to_dp( dc, corners, 2 ); /* Make sure first corner is top left and second corner is bottom right */ if(corners[0].x>corners[1].x) @@ -388,7 +388,7 @@ static BOOL PATH_CheckCorners( HDC hdc, POINT corners[], INT x1, INT y1, INT x2, } /* In GM_COMPATIBLE, don't include bottom and right edges */ - if (GetGraphicsMode( hdc ) == GM_COMPATIBLE) + if (dc->GraphicsMode == GM_COMPATIBLE) { if (corners[0].x == corners[1].x) return FALSE; if (corners[0].y == corners[1].y) return FALSE; @@ -902,10 +902,11 @@ static BOOL pathdrv_LineTo( PHYSDEV dev, INT x, INT y ) static BOOL pathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); POINT corners[2], points[4]; BYTE *type; - if (!PATH_CheckCorners( dev->hdc, corners, x1, y1, x2, y2 )) return TRUE; + if (!PATH_CheckCorners( dc, corners, x1, y1, x2, y2 )) return TRUE; points[0].x = corners[1].x; points[0].y = corners[0].y; @@ -913,7 +914,7 @@ static BOOL pathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) points[2].x = corners[0].x; points[2].y = corners[1].y; points[3] = corners[1]; - if (GetArcDirection( dev->hdc ) == AD_CLOCKWISE) reverse_points( points, 4 ); + if (dc->ArcDirection == AD_CLOCKWISE) reverse_points( points, 4 ); if (!(type = add_points( physdev->path, points, 4, PT_LINETO ))) return FALSE; type[0] = PT_MOVETO; @@ -929,18 +930,19 @@ static BOOL pathdrv_RoundRect( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, INT { const double factor = 0.55428475; /* 4 / 3 * (sqrt(2) - 1) */ struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); POINT corners[2], ellipse[2], points[16]; BYTE *type; double width, height; if (!ell_width || !ell_height) return pathdrv_Rectangle( dev, x1, y1, x2, y2 ); - if (!PATH_CheckCorners( dev->hdc, corners, x1, y1, x2, y2 )) return TRUE; + if (!PATH_CheckCorners( dc, corners, x1, y1, x2, y2 )) return TRUE; ellipse[0].x = ellipse[0].y = 0; ellipse[1].x = ell_width; ellipse[1].y = ell_height; - LPtoDP( dev->hdc, (POINT *)&ellipse, 2 ); + lp_to_dp( dc, (POINT *)&ellipse, 2 ); ell_width = min( abs( ellipse[1].x - ellipse[0].x ), corners[1].x - corners[0].x ); ell_height = min( abs( ellipse[1].y - ellipse[0].y ), corners[1].y - corners[0].y ); width = ell_width / 2.0; @@ -987,7 +989,7 @@ static BOOL pathdrv_RoundRect( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, INT points[15].x = corners[1].x; points[15].y = corners[1].y - GDI_ROUND( height ); - if (GetArcDirection( dev->hdc ) == AD_CLOCKWISE) reverse_points( points, 16 ); + if (dc->ArcDirection == AD_CLOCKWISE) reverse_points( points, 16 ); if (!(type = add_points( physdev->path, points, 16, PT_BEZIERTO ))) return FALSE; type[0] = PT_MOVETO; type[4] = type[8] = type[12] = PT_LINETO; @@ -1003,11 +1005,12 @@ static BOOL pathdrv_Ellipse( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) { const double factor = 0.55428475; /* 4 / 3 * (sqrt(2) - 1) */ struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); POINT corners[2], points[13]; BYTE *type; double width, height; - if (!PATH_CheckCorners( dev->hdc, corners, x1, y1, x2, y2 )) return TRUE; + if (!PATH_CheckCorners( dc, corners, x1, y1, x2, y2 )) return TRUE; width = (corners[1].x - corners[0].x) / 2.0; height = (corners[1].y - corners[0].y) / 2.0; @@ -1044,7 +1047,7 @@ static BOOL pathdrv_Ellipse( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) points[12].x = corners[1].x; points[12].y = corners[1].y - GDI_ROUND( height ); - if (GetArcDirection( dev->hdc ) == AD_CLOCKWISE) reverse_points( points, 13 ); + if (dc->ArcDirection == AD_CLOCKWISE) reverse_points( points, 13 ); if (!(type = add_points( physdev->path, points, 13, PT_BEZIERTO ))) return FALSE; type[0] = PT_MOVETO; close_figure( physdev->path );
1
0
0
0
Huw Davies : gdi32: Pass a DC pointer to the point adding routines.
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: f1aaf0efb0344bc7f8d75606dcc02109e38e4443 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f1aaf0efb0344bc7f8d75606d…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:28 2016 +0100 gdi32: Pass a DC pointer to the point adding routines. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/path.c | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index a5d01bc..24a9436 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -162,9 +162,8 @@ static struct gdi_path *copy_gdi_path( const struct gdi_path *src_path ) /* Performs a world-to-viewport transformation on the specified point (which * is in floating point format). */ -static inline void INTERNAL_LPTODP_FLOAT( HDC hdc, FLOAT_POINT *point, int count ) +static inline void INTERNAL_LPTODP_FLOAT( DC *dc, FLOAT_POINT *point, int count ) { - DC *dc = get_dc_ptr( hdc ); double x, y; while (count--) @@ -175,7 +174,6 @@ static inline void INTERNAL_LPTODP_FLOAT( HDC hdc, FLOAT_POINT *point, int count point->y = x * dc->xformWorld2Vport.eM12 + y * dc->xformWorld2Vport.eM22 + dc->xformWorld2Vport.eDy; point++; } - release_dc_ptr( dc ); } static inline INT int_from_fixed(FIXED f) @@ -255,16 +253,16 @@ static BOOL PATH_AddEntry(struct gdi_path *pPath, const POINT *pPoint, BYTE flag /* add a number of points, converting them to device coords */ /* return a pointer to the first type byte so it can be fixed up if necessary */ -static BYTE *add_log_points( struct path_physdev *physdev, const POINT *points, DWORD count, BYTE type ) +static BYTE *add_log_points( DC *dc, struct gdi_path *path, const POINT *points, + DWORD count, BYTE type ) { BYTE *ret; - struct gdi_path *path = physdev->path; if (!PATH_ReserveEntries( path, path->count + count )) return NULL; ret = &path->flags[path->count]; memcpy( &path->points[path->count], points, count * sizeof(*points) ); - LPtoDP( physdev->dev.hdc, &path->points[path->count], count ); + lp_to_dp( dc, &path->points[path->count], count ); memset( ret, type, count ); path->count += count; return ret; @@ -325,12 +323,12 @@ static void close_figure( struct gdi_path *path ) } /* add a number of points, starting a new stroke if necessary */ -static BOOL add_log_points_new_stroke( struct path_physdev *physdev, const POINT *points, +static BOOL add_log_points_new_stroke( DC *dc, struct gdi_path *path, const POINT *points, DWORD count, BYTE type ) { - if (!start_new_stroke( physdev->path )) return FALSE; - if (!add_log_points( physdev, points, count, type )) return FALSE; - update_current_pos( physdev->path ); + if (!start_new_stroke( path )) return FALSE; + if (!add_log_points( dc, path, points, count, type )) return FALSE; + update_current_pos( path ); return TRUE; } @@ -889,11 +887,12 @@ static BOOL pathdrv_MoveTo( PHYSDEV dev, INT x, INT y ) static BOOL pathdrv_LineTo( PHYSDEV dev, INT x, INT y ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); POINT point; point.x = x; point.y = y; - return add_log_points_new_stroke( physdev, &point, 1, PT_LINETO ); + return add_log_points_new_stroke( dc, physdev->path, &point, 1, PT_LINETO ); } @@ -1066,6 +1065,7 @@ static BOOL pathdrv_Ellipse( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) static BOOL PATH_Arc( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, INT xStart, INT yStart, INT xEnd, INT yEnd, int direction, int lines ) { + DC *dc = get_physdev_dc( dev ); struct path_physdev *physdev = get_path_physdev( dev ); double angleStart, angleEnd, angleStartQuadrant, angleEndQuadrant=0.0; /* Initialize angleEndQuadrant to silence gcc's warning */ @@ -1091,9 +1091,9 @@ static BOOL PATH_Arc( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, pointStart.y = yStart; pointEnd.x = xEnd; pointEnd.y = yEnd; - INTERNAL_LPTODP_FLOAT(dev->hdc, corners, 2); - INTERNAL_LPTODP_FLOAT(dev->hdc, &pointStart, 1); - INTERNAL_LPTODP_FLOAT(dev->hdc, &pointEnd, 1); + INTERNAL_LPTODP_FLOAT(dc, corners, 2); + INTERNAL_LPTODP_FLOAT(dc, &pointStart, 1); + INTERNAL_LPTODP_FLOAT(dc, &pointEnd, 1); /* Make sure first corner is top left and second corner is bottom right */ if(corners[0].x>corners[1].x) @@ -1266,8 +1266,9 @@ static BOOL pathdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, static BOOL pathdrv_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD cbPoints ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); - return add_log_points_new_stroke( physdev, pts, cbPoints, PT_BEZIERTO ); + return add_log_points_new_stroke( dc, physdev->path, pts, cbPoints, PT_BEZIERTO ); } @@ -1277,7 +1278,8 @@ static BOOL pathdrv_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD cbPoints static BOOL pathdrv_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD cbPoints ) { struct path_physdev *physdev = get_path_physdev( dev ); - BYTE *type = add_log_points( physdev, pts, cbPoints, PT_BEZIERTO ); + DC *dc = get_physdev_dc( dev ); + BYTE *type = add_log_points( dc, physdev->path, pts, cbPoints, PT_BEZIERTO ); if (!type) return FALSE; type[0] = PT_MOVETO; @@ -1292,6 +1294,7 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, { struct path_physdev *physdev = get_path_physdev( dev ); struct gdi_path *path = physdev->path; + DC *dc = get_physdev_dc( dev ); POINT orig_pos; INT i, lastmove = 0; @@ -1310,13 +1313,13 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, break; case PT_LINETO: case PT_LINETO | PT_CLOSEFIGURE: - if (!add_log_points_new_stroke( physdev, &pts[i], 1, PT_LINETO )) return FALSE; + if (!add_log_points_new_stroke( dc, path, &pts[i], 1, PT_LINETO )) return FALSE; break; case PT_BEZIERTO: if ((i + 2 < cbPoints) && (types[i + 1] == PT_BEZIERTO) && (types[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO) { - if (!add_log_points_new_stroke( physdev, &pts[i], 3, PT_BEZIERTO )) return FALSE; + if (!add_log_points_new_stroke( dc, path, &pts[i], 3, PT_BEZIERTO )) return FALSE; i += 2; break; } @@ -1343,10 +1346,11 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, static BOOL pathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT count ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); BYTE *type; if (count < 2) return FALSE; - if (!(type = add_log_points( physdev, pts, count, PT_LINETO ))) return FALSE; + if (!(type = add_log_points( dc, physdev->path, pts, count, PT_LINETO ))) return FALSE; type[0] = PT_MOVETO; return TRUE; } @@ -1358,9 +1362,10 @@ static BOOL pathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT count ) static BOOL pathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT count ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); if (count < 1) return FALSE; - return add_log_points_new_stroke( physdev, pts, count, PT_LINETO ); + return add_log_points_new_stroke( dc, physdev->path, pts, count, PT_LINETO ); } @@ -1370,10 +1375,11 @@ static BOOL pathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT count ) static BOOL pathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT count ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); BYTE *type; if (count < 2) return FALSE; - if (!(type = add_log_points( physdev, pts, count, PT_LINETO ))) return FALSE; + if (!(type = add_log_points( dc, physdev->path, pts, count, PT_LINETO ))) return FALSE; type[0] = PT_MOVETO; type[count - 1] = PT_LINETO | PT_CLOSEFIGURE; return TRUE; @@ -1386,6 +1392,7 @@ static BOOL pathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT count ) static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); UINT poly, count; BYTE *type; @@ -1396,7 +1403,7 @@ static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* count count += counts[poly]; } - type = add_log_points( physdev, pts, count, PT_LINETO ); + type = add_log_points( dc, physdev->path, pts, count, PT_LINETO ); if (!type) return FALSE; /* make the first point of each polyline a PT_MOVETO, and close the last one */ @@ -1415,6 +1422,7 @@ static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* count static BOOL pathdrv_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines ) { struct path_physdev *physdev = get_path_physdev( dev ); + DC *dc = get_physdev_dc( dev ); UINT poly, count; BYTE *type; @@ -1425,7 +1433,7 @@ static BOOL pathdrv_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* co count += counts[poly]; } - type = add_log_points( physdev, pts, count, PT_LINETO ); + type = add_log_points( dc, physdev->path, pts, count, PT_LINETO ); if (!type) return FALSE; /* make the first point of each polyline a PT_MOVETO */
1
0
0
0
Huw Davies : gdi32: Pass the path directly to start_new_stroke().
by Alexandre Julliard
29 Jul '16
29 Jul '16
Module: wine Branch: master Commit: 1b4f0f8a07c81363aa4946de382e1852675cbec6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1b4f0f8a07c81363aa4946de3…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Jul 29 15:09:27 2016 +0100 gdi32: Pass the path directly to start_new_stroke(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/path.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index c03208f..a5d01bc 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -298,10 +298,8 @@ static void reverse_points( POINT *points, UINT count ) } /* start a new path stroke if necessary */ -static BOOL start_new_stroke( struct path_physdev *physdev ) +static BOOL start_new_stroke( struct gdi_path *path ) { - struct gdi_path *path = physdev->path; - if (!path->newStroke && path->count && !(path->flags[path->count - 1] & PT_CLOSEFIGURE) && path->points[path->count - 1].x == path->pos.x && @@ -309,7 +307,7 @@ static BOOL start_new_stroke( struct path_physdev *physdev ) return TRUE; path->newStroke = FALSE; - return add_points( physdev->path, &path->pos, 1, PT_MOVETO ) != NULL; + return add_points( path, &path->pos, 1, PT_MOVETO ) != NULL; } /* set current position to the last point that was added to the path */ @@ -330,7 +328,7 @@ static void close_figure( struct gdi_path *path ) static BOOL add_log_points_new_stroke( struct path_physdev *physdev, const POINT *points, DWORD count, BYTE type ) { - if (!start_new_stroke( physdev )) return FALSE; + if (!start_new_stroke( physdev->path )) return FALSE; if (!add_log_points( physdev, points, count, type )) return FALSE; update_current_pos( physdev->path ); return TRUE; @@ -1143,7 +1141,7 @@ static BOOL PATH_Arc( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, } /* arcto: Add a PT_MOVETO only if this is the first entry in a stroke */ - if (lines==-1 && !start_new_stroke( physdev )) return FALSE; + if (lines == -1 && !start_new_stroke( physdev->path )) return FALSE; /* Add the arc to the path with one Bezier spline per quadrant that the * arc spans */
1
0
0
0
← Newer
1
2
3
4
...
68
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
Results per page:
10
25
50
100
200