From f284f5970a2a0c48830db72f643bc6393dff75cd Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 14 Nov 2011 12:49:04 +0000 Subject: [PATCH] gdi32: Move the ETO_OPAQUE rectangle drawing to the dib driver. --- dlls/gdi32/dibdrv/dc.c | 2 +- dlls/gdi32/dibdrv/dibdrv.h | 2 ++ dlls/gdi32/dibdrv/graphics.c | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 274d586489b..3ccdd043c4f 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -566,7 +566,7 @@ const struct gdi_dc_funcs dib_driver = NULL, /* pExtEscape */ NULL, /* pExtFloodFill */ NULL, /* pExtSelectClipRgn */ - NULL, /* pExtTextOut */ + dibdrv_ExtTextOut, /* pExtTextOut */ NULL, /* pFillPath */ NULL, /* pFillRgn */ NULL, /* pFlattenPath */ diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index bb52156aa22..2e7ac01d61f 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -110,6 +110,8 @@ extern BOOL dibdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION blend ) DECLSPEC_HIDDEN; extern DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, BLENDFUNCTION func ) DECLSPEC_HIDDEN; +extern BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, + const RECT *rect, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN; extern DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index 65f5b9ac8ff..82aaafac484 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -56,6 +56,47 @@ static RECT get_device_rect( HDC hdc, int left, int top, int right, int bottom, return rect; } +/********************************************************************** + * get_text_bkgnd_masks + * + * See the comment above get_pen_bkgnd_masks + */ +static inline void get_text_bkgnd_masks( const dibdrv_physdev *pdev, rop_mask *mask ) +{ + mask->and = 0; + + if (pdev->dib.bit_count != 1) + mask->xor = pdev->bkgnd_color; + else + { + mask->xor = ~pdev->text_color; + if (GetTextColor( pdev->dev.hdc ) == GetBkColor( pdev->dev.hdc )) + mask->xor = pdev->text_color; + } +} + +/*********************************************************************** + * dibdrv_ExtTextOut + */ +BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, + const RECT *rect, LPCWSTR str, UINT count, const INT *dx ) +{ + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pExtTextOut ); + dibdrv_physdev *pdev = get_dibdrv_pdev(dev); + + if (flags & ETO_OPAQUE) + { + rop_mask bkgnd_color; + get_text_bkgnd_masks( pdev, &bkgnd_color ); + solid_rects( &pdev->dib, 1, rect, &bkgnd_color, pdev->clip ); + } + + if (count == 0) return TRUE; + + flags &= ~ETO_OPAQUE; + return next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx ); +} + /*********************************************************************** * dibdrv_GetPixel */