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

gdi32: Use NtGdiSetTextJustification for SetTextJustification.

parent 29922c22
......@@ -63,14 +63,14 @@ BOOL EMFDC_SetTextAlign( DC_ATTR *dc_attr, UINT align )
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL CDECL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
BOOL EMFDC_SetTextJustification( DC_ATTR *dc_attr, INT extra, INT breaks )
{
EMRSETTEXTJUSTIFICATION emr;
emr.emr.iType = EMR_SETTEXTJUSTIFICATION;
emr.emr.nSize = sizeof(emr);
emr.nBreakExtra = nBreakExtra;
emr.nBreakCount = nBreakCount;
return EMFDRV_WriteRecord(dev, &emr.emr);
emr.nBreakExtra = extra;
emr.nBreakCount = breaks;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode )
......
......@@ -119,7 +119,6 @@ extern INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN
extern DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetTextJustification( PHYSDEV dev, INT nBreakExtra, INT nBreakCount ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
......
......@@ -135,7 +135,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetTextCharacterExtra */
EMFDRV_SetTextColor, /* pSetTextColor */
EMFDRV_SetTextJustification, /* pSetTextJustification */
NULL, /* pSetTextJustification */
EMFDRV_SetViewportExtEx, /* pSetViewportExtEx */
EMFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */
EMFDRV_SetWindowExtEx, /* pSetWindowExtEx */
......
......@@ -4773,36 +4773,30 @@ INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
/***********************************************************************
* SetTextJustification (GDI32.@)
* NtGdiSetTextJustification (win32u.@)
*/
BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
BOOL WINAPI NtGdiSetTextJustification( HDC hdc, INT extra, INT breaks )
{
BOOL ret;
PHYSDEV physdev;
DC * dc = get_dc_ptr( hdc );
DC *dc;
if (!dc) return FALSE;
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
physdev = GET_DC_PHYSDEV( dc, pSetTextJustification );
ret = physdev->funcs->pSetTextJustification( physdev, extra, breaks );
if (ret)
extra = abs( (extra * dc->attr->vport_ext.cx + dc->attr->wnd_ext.cx / 2) /
dc->attr->wnd_ext.cx );
if (!extra) breaks = 0;
if (breaks)
{
extra = abs( (extra * dc->attr->vport_ext.cx + dc->attr->wnd_ext.cx / 2) /
dc->attr->wnd_ext.cx );
if (!extra) breaks = 0;
if (breaks)
{
dc->breakExtra = extra / breaks;
dc->breakRem = extra - (breaks * dc->breakExtra);
}
else
{
dc->breakExtra = 0;
dc->breakRem = 0;
}
dc->breakExtra = extra / breaks;
dc->breakRem = extra - (breaks * dc->breakExtra);
}
else
{
dc->breakExtra = 0;
dc->breakRem = 0;
}
release_dc_ptr( dc );
return ret;
return TRUE;
}
......
......@@ -82,6 +82,7 @@ extern BOOL METADC_SetRelAbs( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetROP2( HDC hdc, INT rop ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetStretchBltMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextAlign( HDC hdc, UINT align ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextJustification( HDC hdc, INT extra, INT breaks ) DECLSPEC_HIDDEN;
/* enhanced metafiles */
extern BOOL EMFDC_AbortPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
......@@ -138,5 +139,6 @@ extern BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetStretchBltMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetTextAlign( DC_ATTR *dc_attr, UINT align ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetTextJustification( DC_ATTR *dc_attr, INT extra, INT breaks ) DECLSPEC_HIDDEN;
#endif /* __WINE_GDI_PRIVATE_H */
......@@ -993,6 +993,20 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
}
/***********************************************************************
* SetTextJustification (GDI32.@)
*/
BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc )) return METADC_SetTextJustification( hdc, extra, breaks );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_SetTextJustification( dc_attr, extra, breaks ))
return FALSE;
return NtGdiSetTextJustification( hdc, extra, breaks );
}
/***********************************************************************
* PatBlt (GDI32.@)
*/
BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop )
......
......@@ -135,9 +135,9 @@ BOOL CDECL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum,
return MFDRV_MetaParam4( dev, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom );
}
BOOL CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks )
BOOL METADC_SetTextJustification( HDC hdc, INT extra, INT breaks )
{
return MFDRV_MetaParam2( dev, META_SETTEXTJUSTIFICATION, extra, breaks );
return metadc_param2( hdc, META_SETTEXTJUSTIFICATION, extra, breaks );
}
INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra )
......
......@@ -200,7 +200,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pSetPixel */
MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */
MFDRV_SetTextColor, /* pSetTextColor */
MFDRV_SetTextJustification, /* pSetTextJustification */
NULL, /* pSetTextJustification */
MFDRV_SetViewportExtEx, /* pSetViewportExtEx */
MFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */
MFDRV_SetWindowExtEx, /* pSetWindowExtEx */
......
......@@ -108,7 +108,6 @@ extern INT CDECL MFDRV_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
......
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