gdi32: Remove from the GetTextExtentExPoint entry points parameters that can't be handled by the driver.

This commit is contained in:
Alexandre Julliard 2012-12-18 17:52:37 +01:00
parent 1c2f23cf2f
commit bbf3e8621a
6 changed files with 28 additions and 79 deletions

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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 */