Commit 36a0bb0f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Avoid unnecessary calls to get_dc_ptr().

parent 6a8cfea9
...@@ -1390,18 +1390,12 @@ COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt ...@@ -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, ...@@ -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;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -469,6 +469,13 @@ static inline DC *get_nulldrv_dc( PHYSDEV dev ) ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment