gdi32: Only reselect the objects if the linear transform portion changes.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-08-01 09:43:18 +01:00 committed by Alexandre Julliard
parent 24291f2b6a
commit 28bb9d15a6
1 changed files with 12 additions and 1 deletions

View File

@ -324,6 +324,17 @@ static void construct_window_to_viewport(DC *dc, XFORM *xform)
if (dc->layout & LAYOUT_RTL) xform->eDx = dc->vis_rect.right - dc->vis_rect.left - 1 - xform->eDx;
}
/***********************************************************************
* linear_xform_cmp
*
* Compares the linear transform portion of two XFORMs (i.e. the 2x2 submatrix).
* Returns 0 if they match.
*/
static inline int linear_xform_cmp( const XFORM *a, const XFORM *b )
{
return memcmp( a, b, FIELD_OFFSET( XFORM, eDx ) );
}
/***********************************************************************
* DC_UpdateXforms
*
@ -351,7 +362,7 @@ void DC_UpdateXforms( DC *dc )
/* Reselect the font and pen back into the dc so that the size
gets updated. */
if (memcmp(&oldworld2vport, &dc->xformWorld2Vport, sizeof(oldworld2vport)) &&
if (linear_xform_cmp( &oldworld2vport, &dc->xformWorld2Vport ) &&
!GdiIsMetaFileDC(dc->hSelf))
{
SelectObject(dc->hSelf, dc->hFont);