From c441d5745238c6982efd05b812d3c685a4bedf05 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 25 Oct 2011 16:56:18 +0200 Subject: [PATCH] gdi32: Implement the ExtTextOut entry point in the path driver. --- dlls/gdi32/font.c | 40 ++++++++++++---------------------------- dlls/gdi32/gdi_private.h | 9 --------- dlls/gdi32/path.c | 35 +++++++++++++++++------------------ 3 files changed, 29 insertions(+), 55 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index f9e690cbf7a..44f1af481eb 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -1822,7 +1822,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, if(rc.top > rc.bottom) {INT tmp = rc.top; rc.top = rc.bottom; rc.bottom = tmp;} } - if ((flags & ETO_OPAQUE) && !PATH_IsPathOpen(dc->path)) + if (flags & ETO_OPAQUE) physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL ); if(count == 0) @@ -1963,7 +1963,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, break; } - if (GetBkMode(hdc) != TRANSPARENT && !PATH_IsPathOpen(dc->path)) + if (GetBkMode(hdc) != TRANSPARENT) { if(!((flags & ETO_CLIPPED) && (flags & ETO_OPAQUE))) { @@ -2030,15 +2030,10 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, } if(span) { - if (PATH_IsPathOpen(dc->path)) - ret = PATH_ExtTextOut(dc, x + offsets[i - span].x, y + offsets[i - span].y, - (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, - glyphs, span, deltas ? (INT*)(deltas + (i - span)) : NULL); - else - physdev->funcs->pExtTextOut( physdev, x + offsets[i - span].x, - y + offsets[i - span].y, - (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs, - span, deltas ? (INT*)(deltas + (i - span)) : NULL); + physdev->funcs->pExtTextOut( physdev, x + offsets[i - span].x, + y + offsets[i - span].y, + (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs, + span, deltas ? (INT*)(deltas + (i - span)) : NULL); span = 0; } SelectObject(hdc, cur_font); @@ -2047,16 +2042,10 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, if(i == count - 1) { - if (PATH_IsPathOpen(dc->path)) - ret = PATH_ExtTextOut(dc, x + (offsets ? offsets[count - span].x : 0), - y + (offsets ? offsets[count - span].y : 0), - (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, - glyphs, span, deltas ? (INT*)(deltas + (count - span)) : NULL); - else - ret = physdev->funcs->pExtTextOut(physdev, x + (offsets ? offsets[count - span].x : 0), - y + (offsets ? offsets[count - span].y : 0), - (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs, - span, deltas ? (INT*)(deltas + (count - span)) : NULL); + ret = physdev->funcs->pExtTextOut(physdev, x + (offsets ? offsets[count - span].x : 0), + y + (offsets ? offsets[count - span].y : 0), + (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs, + span, deltas ? (INT*)(deltas + (count - span)) : NULL); SelectObject(hdc, orig_font); HeapFree(GetProcessHeap(), 0, offsets); } @@ -2070,13 +2059,8 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, GetGlyphIndicesW(hdc, reordered_str, count, glyphs, 0); flags |= ETO_GLYPH_INDEX; } - - if (PATH_IsPathOpen(dc->path)) - ret = PATH_ExtTextOut(dc, x, y, (flags & ~ETO_OPAQUE), &rc, - glyphs ? glyphs : reordered_str, count, (INT*)deltas); - else - ret = physdev->funcs->pExtTextOut( physdev, x, y, (flags & ~ETO_OPAQUE), &rc, - glyphs ? glyphs : reordered_str, count, (INT*)deltas ); + ret = physdev->funcs->pExtTextOut( physdev, x, y, (flags & ~ETO_OPAQUE), &rc, + glyphs ? glyphs : reordered_str, count, (INT*)deltas ); } done: diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 96825310edf..93842a5b1ab 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -314,20 +314,11 @@ extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOO /* path.c */ -#define PATH_IsPathOpen(path) ((path).state==PATH_Open) -/* Returns TRUE if the specified path is in the open state, i.e. in the - * state where points will be added to the path, or FALSE otherwise. This - * function is implemented as a macro for performance reasons. - */ - extern void PATH_InitGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN; extern void PATH_DestroyGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN; extern BOOL PATH_SavePath( DC *dst, DC *src ) DECLSPEC_HIDDEN; extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN; -extern BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc, - LPCWSTR str, UINT count, const INT *dx) DECLSPEC_HIDDEN; - /* painting.c */ extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 956eaa21153..9689e67abd2 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -1470,9 +1470,9 @@ static void PATH_BezierTo(GdiPath *pPath, POINT *lppt, INT n) } } -static BOOL PATH_add_outline(DC *dc, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) +static BOOL PATH_add_outline(struct path_physdev *physdev, INT x, INT y, + TTPOLYGONHEADER *header, DWORD size) { - GdiPath *pPath = &dc->path; TTPOLYGONHEADER *start; POINT pt; @@ -1490,7 +1490,7 @@ static BOOL PATH_add_outline(DC *dc, INT x, INT y, TTPOLYGONHEADER *header, DWOR pt.x = x + int_from_fixed(header->pfxStart.x); pt.y = y - int_from_fixed(header->pfxStart.y); - PATH_AddEntry(pPath, &pt, PT_MOVETO); + PATH_AddEntry(physdev->path, &pt, PT_MOVETO); curve = (TTPOLYCURVE *)(header + 1); @@ -1508,7 +1508,7 @@ static BOOL PATH_add_outline(DC *dc, INT x, INT y, TTPOLYGONHEADER *header, DWOR { pt.x = x + int_from_fixed(curve->apfx[i].x); pt.y = y - int_from_fixed(curve->apfx[i].y); - PATH_AddEntry(pPath, &pt, PT_LINETO); + PATH_AddEntry(physdev->path, &pt, PT_LINETO); } break; } @@ -1533,7 +1533,7 @@ static BOOL PATH_add_outline(DC *dc, INT x, INT y, TTPOLYGONHEADER *header, DWOR pts[i + 1].y = y - int_from_fixed(curve->apfx[i].y); } - PATH_BezierTo(pPath, pts, curve->cpfx + 1); + PATH_BezierTo(physdev->path, pts, curve->cpfx + 1); HeapFree(GetProcessHeap(), 0, pts); break; @@ -1550,22 +1550,19 @@ static BOOL PATH_add_outline(DC *dc, INT x, INT y, TTPOLYGONHEADER *header, DWOR header = (TTPOLYGONHEADER *)((char *)header + header->cb); } - return CloseFigure(dc->hSelf); + return CloseFigure(physdev->dev.hdc); } -/********************************************************************** - * PATH_ExtTextOut +/************************************************************* + * pathdrv_ExtTextOut */ -BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc, - LPCWSTR str, UINT count, const INT *dx) +static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprc, + LPCWSTR str, UINT count, const INT *dx ) { + struct path_physdev *physdev = get_path_physdev( dev ); unsigned int idx; - HDC hdc = dc->hSelf; POINT offset = {0, 0}; - TRACE("%p, %d, %d, %08x, %s, %s, %d, %p)\n", hdc, x, y, flags, - wine_dbgstr_rect(lprc), debugstr_wn(str, count), count, dx); - if (!count) return TRUE; for (idx = 0; idx < count; idx++) @@ -1575,7 +1572,8 @@ BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc, DWORD dwSize; void *outline; - dwSize = GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, 0, NULL, &identity); + dwSize = GetGlyphOutlineW(dev->hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, + &gm, 0, NULL, &identity); if (dwSize == GDI_ERROR) return FALSE; /* add outline only if char is printable */ @@ -1584,9 +1582,10 @@ BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc, outline = HeapAlloc(GetProcessHeap(), 0, dwSize); if (!outline) return FALSE; - GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, dwSize, outline, &identity); + GetGlyphOutlineW(dev->hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, + &gm, dwSize, outline, &identity); - PATH_add_outline(dc, x + offset.x, y + offset.y, outline, dwSize); + PATH_add_outline(physdev, x + offset.x, y + offset.y, outline, dwSize); HeapFree(GetProcessHeap(), 0, outline); } @@ -2300,7 +2299,7 @@ const struct gdi_dc_funcs path_driver = NULL, /* pExtEscape */ NULL, /* pExtFloodFill */ NULL, /* pExtSelectClipRgn */ - NULL, /* pExtTextOut */ + pathdrv_ExtTextOut, /* pExtTextOut */ NULL, /* pFillPath */ NULL, /* pFillRgn */ NULL, /* pFlattenPath */