[PATCH 2/4] gdi32: Avoid unnecessary calls to get_dc_ptr().
Huw Davies
huw at codeweavers.com
Wed Jul 27 03:59:26 CDT 2016
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/gdi32/dibdrv/bitblt.c | 19 ++++---------------
dlls/gdi32/gdi_private.h | 7 +++++++
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index 71ef272..12e4cd8 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -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,
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop )
{
- BOOL ret;
- DC *dc_dst = get_dc_ptr( dst_dev->hdc );
-
- if (!dc_dst) return FALSE;
+ DC *dc_dst = get_physdev_dc( dst_dev );
if (dst->width == 1 && src->width > 1) src->width--;
if (dst->height == 1 && src->height > 1) src->height--;
- ret = dc_dst->nulldrv.funcs->pStretchBlt( &dc_dst->nulldrv, dst,
- src_dev, src, rop );
- release_dc_ptr( dc_dst );
- return ret;
+ return dc_dst->nulldrv.funcs->pStretchBlt( &dc_dst->nulldrv, dst, src_dev, src, rop );
}
/***********************************************************************
@@ -1410,14 +1404,9 @@ BOOL dibdrv_StretchBlt( 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 )
{
- BOOL ret;
- DC *dc_dst = get_dc_ptr( dst_dev->hdc );
+ DC *dc_dst = get_physdev_dc( dst_dev );
- if (!dc_dst) return FALSE;
-
- ret = dc_dst->nulldrv.funcs->pAlphaBlend( &dc_dst->nulldrv, dst, src_dev, src, blend );
- release_dc_ptr( dc_dst );
- return ret;
+ return dc_dst->nulldrv.funcs->pAlphaBlend( &dc_dst->nulldrv, dst, src_dev, src, blend );
}
/***********************************************************************
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 47cdf66..a837215 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -469,6 +469,13 @@ static inline DC *get_nulldrv_dc( PHYSDEV dev )
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 */
#define DIB_PAL_MONO 2
--
2.7.4
More information about the wine-patches
mailing list