gdi32: Add null driver entry points for the text functions.

oldstable
Alexandre Julliard 2011-03-15 20:42:49 +01:00
parent 7b970a1657
commit 1fc5603cc9
3 changed files with 81 additions and 54 deletions

View File

@ -376,6 +376,12 @@ static INT CDECL nulldrv_EndPage( PHYSDEV dev )
return 0; return 0;
} }
static BOOL CDECL nulldrv_EnumDeviceFonts( PHYSDEV dev, LOGFONTW *logfont,
FONTENUMPROCW proc, LPARAM lParam )
{
return FALSE;
}
static INT CDECL nulldrv_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW func, LPARAM lparam ) static INT CDECL nulldrv_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW func, LPARAM lparam )
{ {
return -1; return -1;
@ -398,11 +404,22 @@ static BOOL CDECL nulldrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF colo
return TRUE; return TRUE;
} }
static BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect,
LPCWSTR str, UINT count, const INT *dx )
{
return TRUE;
}
static BOOL CDECL nulldrv_GdiComment( PHYSDEV dev, UINT size, const BYTE *data ) static BOOL CDECL nulldrv_GdiComment( PHYSDEV dev, UINT size, const BYTE *data )
{ {
return FALSE; return FALSE;
} }
static BOOL CDECL nulldrv_GetCharWidth( PHYSDEV dev, UINT first, UINT last, INT *buffer )
{
return FALSE;
}
static BOOL CDECL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp ) static BOOL CDECL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
{ {
return FALSE; return FALSE;
@ -429,6 +446,17 @@ static UINT CDECL nulldrv_GetSystemPaletteEntries( PHYSDEV dev, UINT start,
return 0; return 0;
} }
static BOOL CDECL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT max_ext,
INT *fit, INT *dx, SIZE *size )
{
return FALSE;
}
static BOOL CDECL nulldrv_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
{
return FALSE;
}
static BOOL CDECL nulldrv_LineTo( PHYSDEV dev, INT x, INT y ) static BOOL CDECL nulldrv_LineTo( PHYSDEV dev, INT x, INT y )
{ {
return TRUE; return TRUE;
@ -718,21 +746,21 @@ const DC_FUNCTIONS null_driver =
nulldrv_EndDoc, /* pEndDoc */ nulldrv_EndDoc, /* pEndDoc */
nulldrv_EndPage, /* pEndPage */ nulldrv_EndPage, /* pEndPage */
nulldrv_EndPath, /* pEndPath */ nulldrv_EndPath, /* pEndPath */
nulldrv_EnumDeviceFonts, /* pEnumDeviceFonts */
nulldrv_EnumICMProfiles, /* pEnumICMProfiles */ nulldrv_EnumICMProfiles, /* pEnumICMProfiles */
NULL, /* pEnumDeviceFonts */
nulldrv_ExcludeClipRect, /* pExcludeClipRect */ nulldrv_ExcludeClipRect, /* pExcludeClipRect */
nulldrv_ExtDeviceMode, /* pExtDeviceMode */ nulldrv_ExtDeviceMode, /* pExtDeviceMode */
nulldrv_ExtEscape, /* pExtEscape */ nulldrv_ExtEscape, /* pExtEscape */
nulldrv_ExtFloodFill, /* pExtFloodFill */ nulldrv_ExtFloodFill, /* pExtFloodFill */
nulldrv_ExtSelectClipRgn, /* pExtSelectClipRgn */ nulldrv_ExtSelectClipRgn, /* pExtSelectClipRgn */
NULL, /* pExtTextOut */ nulldrv_ExtTextOut, /* pExtTextOut */
nulldrv_FillPath, /* pFillPath */ nulldrv_FillPath, /* pFillPath */
nulldrv_FillRgn, /* pFillRgn */ nulldrv_FillRgn, /* pFillRgn */
nulldrv_FlattenPath, /* pFlattenPath */ nulldrv_FlattenPath, /* pFlattenPath */
nulldrv_FrameRgn, /* pFrameRgn */ nulldrv_FrameRgn, /* pFrameRgn */
nulldrv_GdiComment, /* pGdiComment */ nulldrv_GdiComment, /* pGdiComment */
nulldrv_GetBitmapBits, /* pGetBitmapBits */ nulldrv_GetBitmapBits, /* pGetBitmapBits */
NULL, /* pGetCharWidth */ nulldrv_GetCharWidth, /* pGetCharWidth */
nulldrv_GetDIBits, /* pGetDIBits */ nulldrv_GetDIBits, /* pGetDIBits */
NULL, /* pGetDeviceCaps */ NULL, /* pGetDeviceCaps */
nulldrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */ nulldrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
@ -741,8 +769,8 @@ const DC_FUNCTIONS null_driver =
nulldrv_GetPixel, /* pGetPixel */ nulldrv_GetPixel, /* pGetPixel */
nulldrv_GetPixelFormat, /* pGetPixelFormat */ nulldrv_GetPixelFormat, /* pGetPixelFormat */
nulldrv_GetSystemPaletteEntries, /* pGetSystemPaletteEntries */ nulldrv_GetSystemPaletteEntries, /* pGetSystemPaletteEntries */
NULL, /* pGetTextExtentExPoint */ nulldrv_GetTextExtentExPoint, /* pGetTextExtentExPoint */
NULL, /* pGetTextMetrics */ nulldrv_GetTextMetrics, /* pGetTextMetrics */
nulldrv_IntersectClipRect, /* pIntersectClipRect */ nulldrv_IntersectClipRect, /* pIntersectClipRect */
nulldrv_InvertRgn, /* pInvertRgn */ nulldrv_InvertRgn, /* pInvertRgn */
nulldrv_LineTo, /* pLineTo */ nulldrv_LineTo, /* pLineTo */

View File

@ -678,21 +678,16 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf,
enum_gdi_fonts = GetDeviceCaps(hDC, TEXTCAPS) & TC_VA_ABLE; enum_gdi_fonts = GetDeviceCaps(hDC, TEXTCAPS) & TC_VA_ABLE;
if (!dc->funcs->pEnumDeviceFonts && !enum_gdi_fonts)
{
ret = 0;
goto done;
}
if (enum_gdi_fonts) if (enum_gdi_fonts)
ret = WineEngEnumFonts( plf, FONT_EnumInstance, (LPARAM)&fe32 ); ret = WineEngEnumFonts( plf, FONT_EnumInstance, (LPARAM)&fe32 );
fe32.dwFlags &= ~ENUM_CALLED; fe32.dwFlags &= ~ENUM_CALLED;
if (ret && dc->funcs->pEnumDeviceFonts) { if (ret)
ret2 = dc->funcs->pEnumDeviceFonts( dc->physDev, plf, FONT_EnumInstance, (LPARAM)&fe32 ); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEnumDeviceFonts );
ret2 = physdev->funcs->pEnumDeviceFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe32 );
if(fe32.dwFlags & ENUM_CALLED) /* update ret iff a font gets enumed */ if(fe32.dwFlags & ENUM_CALLED) /* update ret iff a font gets enumed */
ret = ret2; ret = ret2;
} }
done:
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -989,10 +984,11 @@ BOOL WINAPI GetTextExtentExPointI( HDC hdc, const WORD *indices, INT count, INT
size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy)); size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy));
size->cx += count * dc->charExtra; size->cx += count * dc->charExtra;
} }
else if(dc->funcs->pGetTextExtentExPoint) { else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetTextExtentExPoint );
FIXME("calling GetTextExtentExPoint\n"); FIXME("calling GetTextExtentExPoint\n");
ret = dc->funcs->pGetTextExtentExPoint( dc->physDev, indices, count, ret = physdev->funcs->pGetTextExtentExPoint( physdev, indices, count, max_ext, nfit, dxs, size );
max_ext, nfit, dxs, size );
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
@ -1146,9 +1142,11 @@ BOOL WINAPI GetTextExtentExPointW( HDC hdc, LPCWSTR str, INT count,
if (dc->gdiFont) if (dc->gdiFont)
ret = WineEngGetTextExtentExPoint(dc->gdiFont, str, count, ret = WineEngGetTextExtentExPoint(dc->gdiFont, str, count,
0, NULL, dxs, size); 0, NULL, dxs, size);
else if (dc->funcs->pGetTextExtentExPoint) else
ret = dc->funcs->pGetTextExtentExPoint(dc->physDev, str, count, {
0, NULL, dxs, size); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetTextExtentExPoint );
ret = physdev->funcs->pGetTextExtentExPoint(physdev, str, count, 0, NULL, dxs, size);
}
/* Perform device size to world size transformations. */ /* Perform device size to world size transformations. */
if (ret) if (ret)
@ -1233,8 +1231,11 @@ BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
if (dc->gdiFont) if (dc->gdiFont)
ret = WineEngGetTextMetrics(dc->gdiFont, metrics); ret = WineEngGetTextMetrics(dc->gdiFont, metrics);
else if (dc->funcs->pGetTextMetrics) else
ret = dc->funcs->pGetTextMetrics( dc->physDev, metrics ); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
ret = physdev->funcs->pGetTextMetrics( physdev, metrics );
}
if (ret) if (ret)
{ {
@ -1251,14 +1252,14 @@ BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
(-abs(INTERNAL_YDSTOWS(dc, (y)))): \ (-abs(INTERNAL_YDSTOWS(dc, (y)))): \
(abs(INTERNAL_YDSTOWS(dc, (y))))) (abs(INTERNAL_YDSTOWS(dc, (y)))))
metrics->tmHeight = HDPTOLP(metrics->tmHeight); metrics->tmHeight = HDPTOLP(metrics->tmHeight);
metrics->tmAscent = HDPTOLP(metrics->tmAscent); metrics->tmAscent = HDPTOLP(metrics->tmAscent);
metrics->tmDescent = HDPTOLP(metrics->tmDescent); metrics->tmDescent = HDPTOLP(metrics->tmDescent);
metrics->tmInternalLeading = HDPTOLP(metrics->tmInternalLeading); metrics->tmInternalLeading = HDPTOLP(metrics->tmInternalLeading);
metrics->tmExternalLeading = HDPTOLP(metrics->tmExternalLeading); metrics->tmExternalLeading = HDPTOLP(metrics->tmExternalLeading);
metrics->tmAveCharWidth = WDPTOLP(metrics->tmAveCharWidth); metrics->tmAveCharWidth = WDPTOLP(metrics->tmAveCharWidth);
metrics->tmMaxCharWidth = WDPTOLP(metrics->tmMaxCharWidth); metrics->tmMaxCharWidth = WDPTOLP(metrics->tmMaxCharWidth);
metrics->tmOverhang = WDPTOLP(metrics->tmOverhang); metrics->tmOverhang = WDPTOLP(metrics->tmOverhang);
ret = TRUE; ret = TRUE;
#undef WDPTOLP #undef WDPTOLP
#undef HDPTOLP #undef HDPTOLP
@ -1613,14 +1614,17 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
LPINT buffer ) LPINT buffer )
{ {
UINT i; UINT i;
BOOL ret = FALSE; BOOL ret;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->gdiFont) if (dc->gdiFont)
ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer ); ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer );
else if (dc->funcs->pGetCharWidth) else
ret = dc->funcs->pGetCharWidth( dc->physDev, firstChar, lastChar, buffer); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetCharWidth );
ret = physdev->funcs->pGetCharWidth( physdev, firstChar, lastChar, buffer);
}
if (ret) if (ret)
{ {
@ -1776,6 +1780,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
POINT *deltas = NULL, width = {0, 0}; POINT *deltas = NULL, width = {0, 0};
DWORD type; DWORD type;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
PHYSDEV physdev;
INT breakRem; INT breakRem;
static int quietfixme = 0; static int quietfixme = 0;
@ -1788,17 +1793,13 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
FIXME("flags ETO_NUMERICSLOCAL | ETO_NUMERICSLATIN unimplemented\n"); FIXME("flags ETO_NUMERICSLOCAL | ETO_NUMERICSLATIN unimplemented\n");
quietfixme = 1; quietfixme = 1;
} }
if (!dc->funcs->pExtTextOut && !PATH_IsPathOpen(dc->path))
{
release_dc_ptr( dc );
return ret;
}
update_dc( dc ); update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pExtTextOut );
type = GetObjectType(hdc); type = GetObjectType(hdc);
if(type == OBJ_METADC || type == OBJ_ENHMETADC) if(type == OBJ_METADC || type == OBJ_ENHMETADC)
{ {
ret = dc->funcs->pExtTextOut(dc->physDev, x, y, flags, lprect, str, count, lpDx); ret = physdev->funcs->pExtTextOut( physdev, x, y, flags, lprect, str, count, lpDx );
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -1888,7 +1889,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
} }
if ((flags & ETO_OPAQUE) && !PATH_IsPathOpen(dc->path)) if ((flags & ETO_OPAQUE) && !PATH_IsPathOpen(dc->path))
dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL); physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
if(count == 0) if(count == 0)
{ {
@ -2049,7 +2050,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
rc.bottom = min(lprect->bottom, rc.bottom); rc.bottom = min(lprect->bottom, rc.bottom);
} }
if(rc.left < rc.right && rc.top < rc.bottom) if(rc.left < rc.right && rc.top < rc.bottom)
dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL); physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
} }
} }
} }
@ -2100,9 +2101,10 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
(flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc,
glyphs, span, deltas ? (INT*)(deltas + (i - span)) : NULL); glyphs, span, deltas ? (INT*)(deltas + (i - span)) : NULL);
else else
dc->funcs->pExtTextOut(dc->physDev, x + offsets[i - span].x, y + offsets[i - span].y, physdev->funcs->pExtTextOut( physdev, x + offsets[i - span].x,
(flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, y + offsets[i - span].y,
glyphs, span, deltas ? (INT*)(deltas + (i - span)) : NULL); (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs,
span, deltas ? (INT*)(deltas + (i - span)) : NULL);
span = 0; span = 0;
} }
SelectObject(hdc, cur_font); SelectObject(hdc, cur_font);
@ -2117,10 +2119,10 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
(flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc,
glyphs, span, deltas ? (INT*)(deltas + (count - span)) : NULL); glyphs, span, deltas ? (INT*)(deltas + (count - span)) : NULL);
else else
ret = dc->funcs->pExtTextOut(dc->physDev, x + (offsets ? offsets[count - span].x : 0), ret = physdev->funcs->pExtTextOut(physdev, x + (offsets ? offsets[count - span].x : 0),
y + (offsets ? offsets[count - span].y : 0), y + (offsets ? offsets[count - span].y : 0),
(flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs,
glyphs, span, deltas ? (INT*)(deltas + (count - span)) : NULL); span, deltas ? (INT*)(deltas + (count - span)) : NULL);
SelectObject(hdc, orig_font); SelectObject(hdc, orig_font);
HeapFree(GetProcessHeap(), 0, offsets); HeapFree(GetProcessHeap(), 0, offsets);
} }
@ -2139,8 +2141,8 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
ret = PATH_ExtTextOut(dc, x, y, (flags & ~ETO_OPAQUE), &rc, ret = PATH_ExtTextOut(dc, x, y, (flags & ~ETO_OPAQUE), &rc,
glyphs ? glyphs : reordered_str, count, (INT*)deltas); glyphs ? glyphs : reordered_str, count, (INT*)deltas);
else else
ret = dc->funcs->pExtTextOut(dc->physDev, x, y, (flags & ~ETO_OPAQUE), &rc, ret = physdev->funcs->pExtTextOut( physdev, x, y, (flags & ~ETO_OPAQUE), &rc,
glyphs ? glyphs : reordered_str, count, (INT*)deltas); glyphs ? glyphs : reordered_str, count, (INT*)deltas );
} }
done: done:
@ -2314,9 +2316,6 @@ BOOL WINAPI PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
} }
/* FIXME: all following APIs ******************************************/
/*********************************************************************** /***********************************************************************
* SetMapperFlags (GDI32.@) * SetMapperFlags (GDI32.@)
*/ */

View File

@ -104,8 +104,8 @@ typedef struct tagDC_FUNCS
INT (CDECL *pEndDoc)(PHYSDEV); INT (CDECL *pEndDoc)(PHYSDEV);
INT (CDECL *pEndPage)(PHYSDEV); INT (CDECL *pEndPage)(PHYSDEV);
BOOL (CDECL *pEndPath)(PHYSDEV); BOOL (CDECL *pEndPath)(PHYSDEV);
INT (CDECL *pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
BOOL (CDECL *pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM); BOOL (CDECL *pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
INT (CDECL *pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
INT (CDECL *pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT); INT (CDECL *pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD); INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
INT (CDECL *pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID); INT (CDECL *pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);