diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 7af63eed23b..7c7c060a53b 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -658,19 +658,6 @@ static BOOL CDECL emfpathdrv_EndPath( PHYSDEV dev ) return next->funcs->pEndPath( next ); } -/*********************************************************************** - * emfpathdrv_ExtTextOut - */ -static BOOL CDECL emfpathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect, - LPCWSTR str, UINT count, const INT *dx ) -{ - PHYSDEV emfdev = get_emfdev( dev ); - PHYSDEV next = GET_NEXT_PHYSDEV( dev, pExtTextOut ); - - return (emfdev->funcs->pExtTextOut( emfdev, x, y, flags, rect, str, count, dx ) && - next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx )); -} - static const struct gdi_dc_funcs emfpath_driver = { @@ -700,7 +687,7 @@ static const struct gdi_dc_funcs emfpath_driver = NULL, /* pExtEscape */ NULL, /* pExtFloodFill */ NULL, /* pExtSelectClipRgn */ - emfpathdrv_ExtTextOut, /* pExtTextOut */ + NULL, /* pExtTextOut */ NULL, /* pFillPath */ NULL, /* pFillRgn */ NULL, /* pFlattenPath */ diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c index 67def307f1e..d4fd2b482ef 100644 --- a/dlls/gdi32/enhmfdrv/graphics.c +++ b/dlls/gdi32/enhmfdrv/graphics.c @@ -929,15 +929,24 @@ BOOL CDECL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) { - EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); - DC *dc = get_physdev_dc( dev ); + /* FIXME: update bounding rect */ + return TRUE; +} + +/********************************************************************** + * EMFDC_ExtTextOut + */ +BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *lprect, + const WCHAR *str, UINT count, const INT *lpDx ) +{ + EMFDRV_PDEVICE *emf = dc_attr->emf; EMREXTTEXTOUTW *pemr; DWORD nSize; BOOL ret; int textHeight = 0; int textWidth = 0; - const UINT textAlign = dc->attr->text_align; - const INT graphicsMode = dc->attr->graphics_mode; + const UINT textAlign = dc_attr->text_align; + const INT graphicsMode = dc_attr->graphics_mode; FLOAT exScale, eyScale; nSize = sizeof(*pemr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT); @@ -948,14 +957,14 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT if (graphicsMode == GM_COMPATIBLE) { - const INT horzSize = GetDeviceCaps( dev->hdc, HORZSIZE ); - const INT horzRes = GetDeviceCaps( dev->hdc, HORZRES ); - const INT vertSize = GetDeviceCaps( dev->hdc, VERTSIZE ); - const INT vertRes = GetDeviceCaps( dev->hdc, VERTRES ); + const INT horzSize = GetDeviceCaps( emf->dev.hdc, HORZSIZE ); + const INT horzRes = GetDeviceCaps( emf->dev.hdc, HORZRES ); + const INT vertSize = GetDeviceCaps( emf->dev.hdc, VERTSIZE ); + const INT vertRes = GetDeviceCaps( emf->dev.hdc, VERTRES ); SIZE wndext, vportext; - GetViewportExtEx( dev->hdc, &vportext ); - GetWindowExtEx( dev->hdc, &wndext ); + GetViewportExtEx( emf->dev.hdc, &vportext ); + GetWindowExtEx( emf->dev.hdc, &wndext ); exScale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) / ((FLOAT)wndext.cx / (FLOAT)vportext.cx); eyScale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) / @@ -996,7 +1005,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT for (i = 0; i < count; i++) { textWidth += lpDx[i]; } - if (GetTextExtentPoint32W( dev->hdc, str, count, &strSize )) + if (GetTextExtentPoint32W( emf->dev.hdc, str, count, &strSize )) textHeight = strSize.cy; } else { @@ -1004,7 +1013,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx); SIZE charSize; for (i = 0; i < count; i++) { - if (GetTextExtentPoint32W( dev->hdc, str + i, 1, &charSize )) { + if (GetTextExtentPoint32W( emf->dev.hdc, str + i, 1, &charSize )) { dx[i] = charSize.cx; textWidth += charSize.cx; textHeight = max(textHeight, charSize.cy); @@ -1012,7 +1021,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT } } - if (physDev->path) + if (emf->path) { pemr->rclBounds.left = pemr->rclBounds.top = 0; pemr->rclBounds.right = pemr->rclBounds.bottom = -1; @@ -1040,7 +1049,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) { case TA_BASELINE: { TEXTMETRICW tm; - if (!GetTextMetricsW( dev->hdc, &tm )) + if (!GetTextMetricsW( emf->dev.hdc, &tm )) tm.tmDescent = 0; /* Play safe here... it's better to have a bounding box */ /* that is too big than too small. */ @@ -1058,10 +1067,10 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT pemr->rclBounds.bottom = y + textHeight + 1; } } - EMFDRV_UpdateBBox( dev, &pemr->rclBounds ); + EMFDRV_UpdateBBox( &emf->dev, &pemr->rclBounds ); no_bounds: - ret = EMFDRV_WriteRecord( dev, &pemr->emr ); + ret = EMFDRV_WriteRecord( &emf->dev, &pemr->emr ); HeapFree( GetProcessHeap(), 0, pemr ); return ret; } diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index d89f9182b9b..6ebdae869f8 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -5895,7 +5895,7 @@ static inline int get_line_width( DC *dc, int metric_size ) } /*********************************************************************** - * ExtTextOutW (GDI32.@) + * NtGdiExtTextOutW (win32u.@) * * Draws text using the currently selected font, background color, and text color. * @@ -5924,8 +5924,8 @@ static inline int get_line_width( DC *dc, int metric_size ) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, - const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) +BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lprect, + const WCHAR *str, UINT count, const INT *lpDx, DWORD cp ) { BOOL ret = FALSE; LPWSTR reordered_str = (LPWSTR)str; diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index f7b04be18dc..ea670732f96 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -47,6 +47,8 @@ extern BOOL METADC_Arc( HDC hdc, INT left, INT top, INT right, INT bottom, extern BOOL METADC_Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; +extern BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *rect, + const WCHAR *str, UINT count, const INT *dx ) DECLSPEC_HIDDEN; extern BOOL METADC_LineTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL METADC_MoveTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom, @@ -67,6 +69,8 @@ extern BOOL EMFDC_ArcChordPie( DC_ATTR *dc_attr, INT left, INT top, INT right, INT yend, DWORD type ) DECLSPEC_HIDDEN; extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; +extern BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *rect, + const WCHAR *str, UINT count, const INT *dx ) DECLSPEC_HIDDEN; extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_PolyBezier( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index e2161d062b8..9200803b6f0 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -360,3 +360,18 @@ BOOL WINAPI PolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD cou if (dc_attr->emf && !EMFDC_PolyDraw( dc_attr, points, types, count )) return FALSE; return NtGdiPolyDraw( hdc, points, types, count ); } + +/*********************************************************************** + * ExtTextOutW (GDI32.@) + */ +BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect, + const WCHAR *str, UINT count, const INT *dx ) +{ + DC_ATTR *dc_attr; + + if (is_meta_dc( hdc )) return METADC_ExtTextOut( hdc, x, y, flags, rect, str, count, dx ); + if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; + if (dc_attr->emf && !EMFDC_ExtTextOut( dc_attr, x, y, flags, rect, str, count, dx )) + return FALSE; + return NtGdiExtTextOutW( hdc, x, y, flags, rect, str, count, dx, 0 ); +} diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index a5ed56a0f5b..b37dc5c6d92 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -125,7 +125,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = MFDRV_ExtEscape, /* pExtEscape */ MFDRV_ExtFloodFill, /* pExtFloodFill */ MFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */ - MFDRV_ExtTextOut, /* pExtTextOut */ + NULL, /* pExtTextOut */ MFDRV_FillPath, /* pFillPath */ MFDRV_FillRgn, /* pFillRgn */ MFDRV_FlattenPath, /* pFlattenPath */ diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 4bf5bc24be0..3fad2970e64 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -81,8 +81,6 @@ extern BOOL CDECL MFDRV_EndPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) DECLSPEC_HIDDEN; -extern BOOL CDECL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, - UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/mfdrv/text.c b/dlls/gdi32/mfdrv/text.c index 99fbf1ddef6..9860d3b0557 100644 --- a/dlls/gdi32/mfdrv/text.c +++ b/dlls/gdi32/mfdrv/text.c @@ -31,11 +31,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile); /****************************************************************** - * MFDRV_MetaExtTextOut + * metadc_text */ -static BOOL MFDRV_MetaExtTextOut( PHYSDEV dev, short x, short y, UINT16 flags, - const RECT16 *rect, LPCSTR str, short count, - const INT16 *lpDx) +static BOOL metadc_text( HDC hdc, short x, short y, UINT16 flags, + const RECT16 *rect, LPCSTR str, short count, + const INT16 *lpDx) { BOOL ret; DWORD len; @@ -62,7 +62,7 @@ static BOOL MFDRV_MetaExtTextOut( PHYSDEV dev, short x, short y, UINT16 flags, if (lpDx) memcpy(mr->rdParm + (isrect ? 8 : 4) + ((count + 1) >> 1),lpDx, count*sizeof(INT16)); - ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2); + ret = metadc_record( hdc, mr, mr->rdSize * 2); HeapFree( GetProcessHeap(), 0, mr); return ret; } @@ -70,10 +70,10 @@ static BOOL MFDRV_MetaExtTextOut( PHYSDEV dev, short x, short y, UINT16 flags, /*********************************************************************** - * MFDRV_ExtTextOut + * METADC_ExtTextOut */ -BOOL CDECL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, - const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) +BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *lprect, + const WCHAR *str, UINT count, const INT *lpDx ) { RECT16 rect16; LPINT16 lpdx16 = NULL; @@ -82,7 +82,7 @@ BOOL CDECL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, LPSTR ascii; DWORD len; CHARSETINFO csi; - int charset = GetTextCharset( dev->hdc ); + int charset = GetTextCharset( hdc ); UINT cp = CP_ACP; if(TranslateCharsetInfo(ULongToPtr(charset), &csi, TCI_SRCCHARSET)) @@ -146,7 +146,7 @@ BOOL CDECL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, lpdx16[i++] = lpDx[j++]; } - ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16); + ret = metadc_text( hdc, x, y, flags, lprect ? &rect16 : NULL, ascii, len, lpdx16 ); HeapFree( GetProcessHeap(), 0, ascii ); HeapFree( GetProcessHeap(), 0, lpdx16 ); return ret; diff --git a/include/ntgdi.h b/include/ntgdi.h index 33c5b53f50f..56921d68fc3 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -160,6 +160,8 @@ BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result ); BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result ); INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap ); BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr ); +BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect, + const WCHAR *str, UINT count, const INT *dx, DWORD cp ); BOOL WINAPI NtGdiGetMiterLimit( HDC hdc, FLOAT *limit ); COLORREF WINAPI NtGdiGetNearestColor( HDC hdc, COLORREF color ); UINT WINAPI NtGdiGetNearestPaletteIndex( HPALETTE hpalette, COLORREF color );