Module: wine Branch: master Commit: bbf3e8621ab2168032979489300122e54751b2c9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bbf3e8621ab216803297948930...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Dec 18 17:52:37 2012 +0100
gdi32: Remove from the GetTextExtentExPoint entry points parameters that can't be handled by the driver.
---
dlls/gdi32/driver.c | 6 +--- dlls/gdi32/font.c | 4 +- dlls/gdi32/freetype.c | 62 +++++++++++--------------------------------- dlls/wineps.drv/builtin.c | 26 +++---------------- dlls/wineps.drv/psdrv.h | 3 +- include/wine/gdi_driver.h | 6 ++-- 6 files changed, 28 insertions(+), 79 deletions(-)
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index f5cadbe..6b68499 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -423,14 +423,12 @@ static UINT nulldrv_GetTextCharsetInfo( PHYSDEV dev, LPFONTSIGNATURE fs, DWORD f return DEFAULT_CHARSET; }
-static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT max_ext, - INT *fit, INT *dx, SIZE *size ) +static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT *dx ) { return FALSE; }
-static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT max_ext, - INT *fit, INT *dx, SIZE *size ) +static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT *dx ) { return FALSE; } diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 3c609a2..3f79dff 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -320,7 +320,7 @@ static BOOL get_char_positions( DC *dc, const WCHAR *str, INT count, INT *dx, SI dev = GET_DC_PHYSDEV( dc, pGetTextMetrics ); dev->funcs->pGetTextMetrics( dev, &tm );
- if (!dev->funcs->pGetTextExtentExPoint( dev, str, count, 0, NULL, dx, size )) return FALSE; + if (!dev->funcs->pGetTextExtentExPoint( dev, str, count, dx )) return FALSE;
if (dc->breakExtra || dc->breakRem) { @@ -357,7 +357,7 @@ static BOOL get_char_positions_indices( DC *dc, const WORD *indices, INT count, dev = GET_DC_PHYSDEV( dc, pGetTextMetrics ); dev->funcs->pGetTextMetrics( dev, &tm );
- if (!dev->funcs->pGetTextExtentExPointI( dev, indices, count, 0, NULL, dx, size )) return FALSE; + if (!dev->funcs->pGetTextExtentExPointI( dev, indices, count, dx )) return FALSE;
if (dc->breakExtra || dc->breakRem) { diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 6c39b97..9b6a909 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7134,97 +7134,67 @@ static BOOL freetype_GetCharABCWidthsI( PHYSDEV dev, UINT firstChar, UINT count, /************************************************************* * freetype_GetTextExtentExPoint */ -static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count, - INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size) +static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count, LPINT dxs ) { static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; - INT idx; - INT nfit = 0, ext; + INT idx, pos; ABC abc; GLYPHMETRICS gm; - TEXTMETRICW tm; struct freetype_physdev *physdev = get_freetype_dev( dev );
if (!physdev->font) { dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint ); - return dev->funcs->pGetTextExtentExPoint( dev, wstr, count, max_ext, pnfit, dxs, size ); + return dev->funcs->pGetTextExtentExPoint( dev, wstr, count, dxs ); }
- TRACE("%p, %s, %d, %d, %p\n", physdev->font, debugstr_wn(wstr, count), count, max_ext, size); + TRACE("%p, %s, %d\n", physdev->font, debugstr_wn(wstr, count), count);
GDI_CheckNotLock(); EnterCriticalSection( &freetype_cs );
- size->cx = 0; - get_text_metrics( physdev->font, &tm ); - size->cy = tm.tmHeight; - - for(idx = 0; idx < count; idx++) { + for (idx = pos = 0; idx < count; idx++) + { get_glyph_outline( physdev->font, wstr[idx], GGO_METRICS, &gm, &abc, 0, NULL, &identity ); - size->cx += abc.abcA + abc.abcB + abc.abcC; - ext = size->cx; - if (! pnfit || ext <= max_ext) { - ++nfit; - if (dxs) - dxs[idx] = ext; - } + pos += abc.abcA + abc.abcB + abc.abcC; + dxs[idx] = pos; }
- if (pnfit) - *pnfit = nfit; - LeaveCriticalSection( &freetype_cs ); - TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit); return TRUE; }
/************************************************************* * freetype_GetTextExtentExPointI */ -static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, - INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size ) +static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, LPINT dxs ) { static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; - INT idx; - INT nfit = 0, ext; + INT idx, pos; ABC abc; GLYPHMETRICS gm; - TEXTMETRICW tm; struct freetype_physdev *physdev = get_freetype_dev( dev );
if (!physdev->font) { dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPointI ); - return dev->funcs->pGetTextExtentExPointI( dev, indices, count, max_ext, pnfit, dxs, size ); + return dev->funcs->pGetTextExtentExPointI( dev, indices, count, dxs ); }
- TRACE("%p, %p, %d, %d, %p\n", physdev->font, indices, count, max_ext, size); + TRACE("%p, %p, %d\n", physdev->font, indices, count);
GDI_CheckNotLock(); EnterCriticalSection( &freetype_cs );
- size->cx = 0; - get_text_metrics(physdev->font, &tm); - size->cy = tm.tmHeight; - - for(idx = 0; idx < count; idx++) { + for (idx = pos = 0; idx < count; idx++) + { get_glyph_outline( physdev->font, indices[idx], GGO_METRICS | GGO_GLYPH_INDEX, &gm, &abc, 0, NULL, &identity ); - size->cx += abc.abcA + abc.abcB + abc.abcC; - ext = size->cx; - if (! pnfit || ext <= max_ext) { - ++nfit; - if (dxs) - dxs[idx] = ext; - } + pos += abc.abcA + abc.abcB + abc.abcC; + dxs[idx] = pos; }
- if (pnfit) - *pnfit = nfit; - LeaveCriticalSection( &freetype_cs ); - TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit); return TRUE; }
diff --git a/dlls/wineps.drv/builtin.c b/dlls/wineps.drv/builtin.c index 873a473..e2106d3 100644 --- a/dlls/wineps.drv/builtin.c +++ b/dlls/wineps.drv/builtin.c @@ -317,43 +317,25 @@ const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm) /*********************************************************************** * PSDRV_GetTextExtentExPoint */ -BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, - INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) +BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); - int nfit = 0; int i; float width = 0.0; - float scale;
if (physDev->font.fontloc == Download) { dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint ); - return dev->funcs->pGetTextExtentExPoint( dev, str, count, maxExt, lpnFit, alpDx, size ); + return dev->funcs->pGetTextExtentExPoint( dev, str, count, alpDx ); }
TRACE("%s %i\n", debugstr_wn(str, count), count);
- scale = physDev->font.fontinfo.Builtin.scale; - for (i = 0; i < count && str[i] != '\0'; ++i) + for (i = 0; i < count; ++i) { - float scaled_width; width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX; - scaled_width = width * scale; - if (alpDx) - alpDx[i] = scaled_width; - if (scaled_width <= maxExt) - ++nfit; + alpDx[i] = width * physDev->font.fontinfo.Builtin.scale; } - - size->cx = width * physDev->font.fontinfo.Builtin.scale; - size->cy = physDev->font.fontinfo.Builtin.tm.tmHeight; - - if (lpnFit) - *lpnFit = nfit; - - TRACE("cx=%i cy=%i\n", size->cx, size->cy); - return TRUE; }
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h index bfc2ad6..428f7ba 100644 --- a/dlls/wineps.drv/psdrv.h +++ b/dlls/wineps.drv/psdrv.h @@ -425,8 +425,7 @@ extern BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN; -extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, - INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) DECLSPEC_HIDDEN; +extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx) DECLSPEC_HIDDEN; extern BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN; extern BOOL PSDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN; extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index f6be211d..fffbad0 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -116,8 +116,8 @@ struct gdi_dc_funcs COLORREF (*pGetPixel)(PHYSDEV,INT,INT); UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY); UINT (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD); - BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE); - BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,INT,LPINT,LPINT,LPSIZE); + BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,LPINT); + BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,LPINT); INT (*pGetTextFace)(PHYSDEV,INT,LPWSTR); BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*); BOOL (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG); @@ -197,7 +197,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 45 +#define WINE_GDI_DRIVER_VERSION 46
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */