gdi32: Avoid unnecessary calls to get_dc_ptr().

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-27 09:59:26 +01:00 committed by Alexandre Julliard
parent 6a8cfea99b
commit 36a0bb0f52
2 changed files with 11 additions and 15 deletions

View File

@ -1390,18 +1390,12 @@ COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt
BOOL dibdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, BOOL dibdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop )
{ {
BOOL ret; DC *dc_dst = get_physdev_dc( dst_dev );
DC *dc_dst = get_dc_ptr( dst_dev->hdc );
if (!dc_dst) return FALSE;
if (dst->width == 1 && src->width > 1) src->width--; if (dst->width == 1 && src->width > 1) src->width--;
if (dst->height == 1 && src->height > 1) src->height--; if (dst->height == 1 && src->height > 1) src->height--;
ret = dc_dst->nulldrv.funcs->pStretchBlt( &dc_dst->nulldrv, dst, return dc_dst->nulldrv.funcs->pStretchBlt( &dc_dst->nulldrv, dst, src_dev, src, rop );
src_dev, src, rop );
release_dc_ptr( dc_dst );
return ret;
} }
/*********************************************************************** /***********************************************************************
@ -1410,14 +1404,9 @@ BOOL dibdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
BOOL dibdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, BOOL dibdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION blend ) PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION blend )
{ {
BOOL ret; DC *dc_dst = get_physdev_dc( dst_dev );
DC *dc_dst = get_dc_ptr( dst_dev->hdc );
if (!dc_dst) return FALSE; return dc_dst->nulldrv.funcs->pAlphaBlend( &dc_dst->nulldrv, dst, src_dev, src, blend );
ret = dc_dst->nulldrv.funcs->pAlphaBlend( &dc_dst->nulldrv, dst, src_dev, src, blend );
release_dc_ptr( dc_dst );
return ret;
} }
/*********************************************************************** /***********************************************************************

View File

@ -469,6 +469,13 @@ static inline DC *get_nulldrv_dc( PHYSDEV dev )
return CONTAINING_RECORD( dev, DC, nulldrv ); return CONTAINING_RECORD( dev, DC, nulldrv );
} }
static inline DC *get_physdev_dc( PHYSDEV dev )
{
while (dev->funcs != &null_driver)
dev = dev->next;
return get_nulldrv_dc( dev );
}
/* Undocumented value for DIB's iUsage: Indicates a mono DIB w/o pal entries */ /* Undocumented value for DIB's iUsage: Indicates a mono DIB w/o pal entries */
#define DIB_PAL_MONO 2 #define DIB_PAL_MONO 2