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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-07-29 15:09:36 +01:00 committed by Alexandre Julliard
parent 199ca9258a
commit 0f2a776a59
4 changed files with 9 additions and 25 deletions

View File

@ -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;
}

View File

@ -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 );
}

View File

@ -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;
}

View File

@ -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;
}