gdi32: Move ExtTextOutW wrappers to text.c.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c5d9f2f7c6
commit
cd60db086a
|
@ -5748,66 +5748,6 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ExtTextOutA (GDI32.@)
|
|
||||||
*
|
|
||||||
* See ExtTextOutW.
|
|
||||||
*/
|
|
||||||
BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags,
|
|
||||||
const RECT *lprect, LPCSTR str, UINT count, const INT *lpDx )
|
|
||||||
{
|
|
||||||
INT wlen;
|
|
||||||
UINT codepage;
|
|
||||||
LPWSTR p;
|
|
||||||
BOOL ret;
|
|
||||||
LPINT lpDxW = NULL;
|
|
||||||
|
|
||||||
if (count > INT_MAX) return FALSE;
|
|
||||||
|
|
||||||
if (flags & ETO_GLYPH_INDEX)
|
|
||||||
return ExtTextOutW( hdc, x, y, flags, lprect, (LPCWSTR)str, count, lpDx );
|
|
||||||
|
|
||||||
p = FONT_mbtowc(hdc, str, count, &wlen, &codepage);
|
|
||||||
|
|
||||||
if (lpDx) {
|
|
||||||
unsigned int i = 0, j = 0;
|
|
||||||
|
|
||||||
/* allocate enough for a ETO_PDY */
|
|
||||||
lpDxW = HeapAlloc( GetProcessHeap(), 0, 2*wlen*sizeof(INT));
|
|
||||||
while(i < count) {
|
|
||||||
if(IsDBCSLeadByteEx(codepage, str[i]))
|
|
||||||
{
|
|
||||||
if(flags & ETO_PDY)
|
|
||||||
{
|
|
||||||
lpDxW[j++] = lpDx[i * 2] + lpDx[(i + 1) * 2];
|
|
||||||
lpDxW[j++] = lpDx[i * 2 + 1] + lpDx[(i + 1) * 2 + 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lpDxW[j++] = lpDx[i] + lpDx[i + 1];
|
|
||||||
i = i + 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(flags & ETO_PDY)
|
|
||||||
{
|
|
||||||
lpDxW[j++] = lpDx[i * 2];
|
|
||||||
lpDxW[j++] = lpDx[i * 2 + 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lpDxW[j++] = lpDx[i];
|
|
||||||
i = i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ExtTextOutW( hdc, x, y, flags, lprect, p, wlen, lpDxW );
|
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, p );
|
|
||||||
HeapFree( GetProcessHeap(), 0, lpDxW );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* get_line_width
|
* get_line_width
|
||||||
*
|
*
|
||||||
|
@ -6213,57 +6153,6 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* TextOutA (GDI32.@)
|
|
||||||
*/
|
|
||||||
BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, LPCSTR str, INT count )
|
|
||||||
{
|
|
||||||
return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* TextOutW (GDI32.@)
|
|
||||||
*/
|
|
||||||
BOOL WINAPI TextOutW(HDC hdc, INT x, INT y, LPCWSTR str, INT count)
|
|
||||||
{
|
|
||||||
return ExtTextOutW( hdc, x, y, 0, NULL, str, count, NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* PolyTextOutA (GDI32.@)
|
|
||||||
*
|
|
||||||
* See PolyTextOutW.
|
|
||||||
*/
|
|
||||||
BOOL WINAPI PolyTextOutA( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
|
|
||||||
{
|
|
||||||
for (; cStrings>0; cStrings--, pptxt++)
|
|
||||||
if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* PolyTextOutW (GDI32.@)
|
|
||||||
*
|
|
||||||
* Draw several Strings
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* TRUE: Success.
|
|
||||||
* FALSE: Failure.
|
|
||||||
*/
|
|
||||||
BOOL WINAPI PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
|
|
||||||
{
|
|
||||||
for (; cStrings>0; cStrings--, pptxt++)
|
|
||||||
if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetAspectRatioFilterEx (GDI32.@)
|
* GetAspectRatioFilterEx (GDI32.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -669,6 +669,36 @@ cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* text_mbtowc
|
||||||
|
*
|
||||||
|
* Returns a Unicode translation of str using the charset of the
|
||||||
|
* currently selected font in hdc. If count is -1 then str is assumed
|
||||||
|
* to be '\0' terminated, otherwise it contains the number of bytes to
|
||||||
|
* convert. If plenW is non-NULL, on return it will point to the
|
||||||
|
* number of WCHARs that have been written. If ret_cp is non-NULL, on
|
||||||
|
* return it will point to the codepage used in the conversion. The
|
||||||
|
* caller should free the returned string from the process heap
|
||||||
|
* itself.
|
||||||
|
*/
|
||||||
|
static WCHAR *text_mbtowc( HDC hdc, const char *str, INT count, INT *plenW, UINT *ret_cp )
|
||||||
|
{
|
||||||
|
UINT cp;
|
||||||
|
INT lenW;
|
||||||
|
LPWSTR strW;
|
||||||
|
|
||||||
|
cp = GdiGetCodePage( hdc );
|
||||||
|
|
||||||
|
if (count == -1) count = strlen( str );
|
||||||
|
lenW = MultiByteToWideChar( cp, 0, str, count, NULL, 0 );
|
||||||
|
strW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) );
|
||||||
|
MultiByteToWideChar( cp, 0, str, count, strW, lenW );
|
||||||
|
TRACE( "mapped %s -> %s\n", debugstr_an(str, count), debugstr_wn(strW, lenW) );
|
||||||
|
if (plenW) *plenW = lenW;
|
||||||
|
if (ret_cp) *ret_cp = cp;
|
||||||
|
return strW;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ExtTextOutW (GDI32.@)
|
* ExtTextOutW (GDI32.@)
|
||||||
*/
|
*/
|
||||||
|
@ -711,6 +741,104 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ExtTextOutA (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
|
||||||
|
const char *str, UINT count, const INT *dx )
|
||||||
|
{
|
||||||
|
INT wlen;
|
||||||
|
UINT codepage;
|
||||||
|
WCHAR *p;
|
||||||
|
BOOL ret;
|
||||||
|
INT *dxW = NULL;
|
||||||
|
|
||||||
|
if (count > INT_MAX) return FALSE;
|
||||||
|
|
||||||
|
if (flags & ETO_GLYPH_INDEX)
|
||||||
|
return ExtTextOutW( hdc, x, y, flags, rect, (const WCHAR *)str, count, dx );
|
||||||
|
|
||||||
|
p = text_mbtowc( hdc, str, count, &wlen, &codepage );
|
||||||
|
|
||||||
|
if (dx)
|
||||||
|
{
|
||||||
|
unsigned int i = 0, j = 0;
|
||||||
|
|
||||||
|
/* allocate enough for a ETO_PDY */
|
||||||
|
dxW = HeapAlloc( GetProcessHeap(), 0, 2 * wlen * sizeof(INT) );
|
||||||
|
while (i < count)
|
||||||
|
{
|
||||||
|
if (IsDBCSLeadByteEx( codepage, str[i] ))
|
||||||
|
{
|
||||||
|
if (flags & ETO_PDY)
|
||||||
|
{
|
||||||
|
dxW[j++] = dx[i * 2] + dx[(i + 1) * 2];
|
||||||
|
dxW[j++] = dx[i * 2 + 1] + dx[(i + 1) * 2 + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dxW[j++] = dx[i] + dx[i + 1];
|
||||||
|
i = i + 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flags & ETO_PDY)
|
||||||
|
{
|
||||||
|
dxW[j++] = dx[i * 2];
|
||||||
|
dxW[j++] = dx[i * 2 + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dxW[j++] = dx[i];
|
||||||
|
i = i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ExtTextOutW( hdc, x, y, flags, rect, p, wlen, dxW );
|
||||||
|
|
||||||
|
HeapFree( GetProcessHeap(), 0, p );
|
||||||
|
HeapFree( GetProcessHeap(), 0, dxW );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* TextOutA (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, const char *str, INT count )
|
||||||
|
{
|
||||||
|
return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* TextOutW (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI TextOutW( HDC hdc, INT x, INT y, const WCHAR *str, INT count )
|
||||||
|
{
|
||||||
|
return ExtTextOutW( hdc, x, y, 0, NULL, str, count, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* PolyTextOutA (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI PolyTextOutA( HDC hdc, const POLYTEXTA *pt, INT count )
|
||||||
|
{
|
||||||
|
for (; count>0; count--, pt++)
|
||||||
|
if (!ExtTextOutA( hdc, pt->x, pt->y, pt->uiFlags, &pt->rcl, pt->lpstr, pt->n, pt->pdx ))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* PolyTextOutW (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI PolyTextOutW( HDC hdc, const POLYTEXTW *pt, INT count )
|
||||||
|
{
|
||||||
|
for (; count>0; count--, pt++)
|
||||||
|
if (!ExtTextOutW( hdc, pt->x, pt->y, pt->uiFlags, &pt->rcl, pt->lpstr, pt->n, pt->pdx ))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static int kern_pair( const KERNINGPAIR *kern, int count, WCHAR c1, WCHAR c2 )
|
static int kern_pair( const KERNINGPAIR *kern, int count, WCHAR c1, WCHAR c2 )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
Loading…
Reference in New Issue