Commit e5f5e734 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiGetCharWidthW for GetCharWidthFloatW.

parent 2c77643e
......@@ -4882,10 +4882,19 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first, UINT last, WCHAR *chars,
if (ret)
{
INT *buffer = buf;
/* convert device units to logical */
for (i = 0; i < count; i++)
buffer[i] = width_to_LP( dc, buffer[i] );
if (flags & NTGDI_GETCHARWIDTH_INT)
{
INT *buffer = buf;
/* convert device units to logical */
for (i = 0; i < count; i++)
buffer[i] = width_to_LP( dc, buffer[i] );
}
else
{
float scale = fabs( dc->xformVport2World.eM11 ) / 16.0f;
for (i = 0; i < count; i++)
((float *)buf)[i] = ((int *)buf)[i] * scale;
}
}
release_dc_ptr( dc );
return ret;
......@@ -6460,39 +6469,6 @@ BOOL WINAPI GetCharWidthFloatA( HDC hdc, UINT first, UINT last, float *buffer )
return TRUE;
}
/*************************************************************************
* GetCharWidthFloatW [GDI32.@]
*/
BOOL WINAPI GetCharWidthFloatW( HDC hdc, UINT first, UINT last, float *buffer )
{
DC *dc = get_dc_ptr( hdc );
int *ibuffer;
PHYSDEV dev;
BOOL ret;
UINT i;
TRACE("dc %p, first %#x, last %#x, buffer %p\n", dc, first, last, buffer);
if (!dc) return FALSE;
if (!(ibuffer = heap_alloc( (last - first + 1) * sizeof(int) )))
{
release_dc_ptr( dc );
return FALSE;
}
dev = GET_DC_PHYSDEV( dc, pGetCharWidth );
if ((ret = dev->funcs->pGetCharWidth( dev, first, last - first + 1, NULL, ibuffer )))
{
float scale = fabs( dc->xformVport2World.eM11 ) / 16.0f;
for (i = first; i <= last; ++i)
buffer[i - first] = ibuffer[i - first] * scale;
}
heap_free(ibuffer);
return ret;
}
/***********************************************************************
* *
* Font Resource API *
......
......@@ -1649,3 +1649,11 @@ BOOL WINAPI GetCharWidth32A( HDC hdc, UINT first, UINT last, INT *buffer )
HeapFree( GetProcessHeap(), 0, chars );
return ret;
}
/***********************************************************************
* GetCharWidthFloatW (GDI32.@)
*/
BOOL WINAPI GetCharWidthFloatW( HDC hdc, UINT first, UINT last, float *buffer )
{
return NtGdiGetCharWidthW( hdc, first, last, NULL, 0, buffer );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment