mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 23:13:38 +00:00
gdi32: Move CombineTransform to objects.c.
And use a separated copy in ntgdi functions. 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
00359ebfa0
commit
34508690cb
|
@ -1070,7 +1070,7 @@ BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint,
|
|||
) / det;
|
||||
|
||||
GetWorldTransform(hdcSrc,&SrcXf);
|
||||
CombineTransform(&xf,&xf,&SrcXf);
|
||||
combine_transform( &xf, &xf, &SrcXf );
|
||||
|
||||
/* save actual dest transform */
|
||||
GetWorldTransform(hdcDest,&oldDestXf);
|
||||
|
|
|
@ -366,8 +366,7 @@ void DC_UpdateXforms( DC *dc )
|
|||
|
||||
oldworld2vport = dc->xformWorld2Vport;
|
||||
/* Combine with the world transformation */
|
||||
CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd,
|
||||
&xformWnd2Vport );
|
||||
combine_transform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd, &xformWnd2Vport );
|
||||
|
||||
/* Create inverse of world-to-viewport transformation */
|
||||
dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport,
|
||||
|
@ -933,55 +932,6 @@ BOOL WINAPI NtGdiGetTransform( HDC hdc, DWORD which, XFORM *xform )
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* CombineTransform [GDI32.@]
|
||||
* Combines two transformation matrices.
|
||||
*
|
||||
* PARAMS
|
||||
* xformResult [O] Stores the result of combining the two matrices
|
||||
* xform1 [I] Specifies the first matrix to apply
|
||||
* xform2 [I] Specifies the second matrix to apply
|
||||
*
|
||||
* REMARKS
|
||||
* The same matrix can be passed in for more than one of the parameters.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE.
|
||||
* Failure: FALSE. Use GetLastError() to determine the cause.
|
||||
*/
|
||||
BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
|
||||
const XFORM *xform2 )
|
||||
{
|
||||
XFORM xformTemp;
|
||||
|
||||
/* Check for illegal parameters */
|
||||
if (!xformResult || !xform1 || !xform2)
|
||||
return FALSE;
|
||||
|
||||
/* Create the result in a temporary XFORM, since xformResult may be
|
||||
* equal to xform1 or xform2 */
|
||||
xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
|
||||
xform1->eM12 * xform2->eM21;
|
||||
xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
|
||||
xform1->eM12 * xform2->eM22;
|
||||
xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
|
||||
xform1->eM22 * xform2->eM21;
|
||||
xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
|
||||
xform1->eM22 * xform2->eM22;
|
||||
xformTemp.eDx = xform1->eDx * xform2->eM11 +
|
||||
xform1->eDy * xform2->eM21 +
|
||||
xform2->eDx;
|
||||
xformTemp.eDy = xform1->eDx * xform2->eM12 +
|
||||
xform1->eDy * xform2->eM22 +
|
||||
xform2->eDy;
|
||||
|
||||
/* Copy the result to xformResult */
|
||||
*xformResult = xformTemp;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCHook (win32u.@)
|
||||
*
|
||||
|
|
|
@ -347,10 +347,12 @@ BOOL WINAPI NtGdiModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
|
|||
ret = TRUE;
|
||||
break;
|
||||
case MWT_LEFTMULTIPLY:
|
||||
ret = CombineTransform( &dc->xformWorld2Wnd, xform, &dc->xformWorld2Wnd );
|
||||
combine_transform( &dc->xformWorld2Wnd, xform, &dc->xformWorld2Wnd );
|
||||
ret = TRUE;
|
||||
break;
|
||||
case MWT_RIGHTMULTIPLY:
|
||||
ret = CombineTransform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd, xform );
|
||||
combine_transform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd, xform );
|
||||
ret = TRUE;
|
||||
break;
|
||||
case MWT_SET:
|
||||
ret = dc->attr->graphics_mode == GM_ADVANCED &&
|
||||
|
@ -414,3 +416,19 @@ BOOL WINAPI NtGdiSetVirtualResolution( HDC hdc, DWORD horz_res, DWORD vert_res,
|
|||
release_dc_ptr( dc );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void combine_transform( XFORM *result, const XFORM *xform1, const XFORM *xform2 )
|
||||
{
|
||||
XFORM r;
|
||||
|
||||
/* Create the result in a temporary XFORM, since result may be
|
||||
* equal to xform1 or xform2 */
|
||||
r.eM11 = xform1->eM11 * xform2->eM11 + xform1->eM12 * xform2->eM21;
|
||||
r.eM12 = xform1->eM11 * xform2->eM12 + xform1->eM12 * xform2->eM22;
|
||||
r.eM21 = xform1->eM21 * xform2->eM11 + xform1->eM22 * xform2->eM21;
|
||||
r.eM22 = xform1->eM21 * xform2->eM12 + xform1->eM22 * xform2->eM22;
|
||||
r.eDx = xform1->eDx * xform2->eM11 + xform1->eDy * xform2->eM21 + xform2->eDx;
|
||||
r.eDy = xform1->eDx * xform2->eM12 + xform1->eDy * xform2->eM22 + xform2->eDy;
|
||||
|
||||
*result = r;
|
||||
}
|
||||
|
|
|
@ -409,6 +409,8 @@ extern DWORD get_system_dpi(void) DECLSPEC_HIDDEN;
|
|||
extern BOOL dp_to_lp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
|
||||
extern void lp_to_dp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
|
||||
extern BOOL set_map_mode( DC *dc, int mode ) DECLSPEC_HIDDEN;
|
||||
extern void combine_transform( XFORM *result, const XFORM *xform1,
|
||||
const XFORM *xform2 ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* metafile.c */
|
||||
extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -977,3 +977,27 @@ INT WINAPI EnumObjects( HDC hdc, INT type, GOBJENUMPROC enum_func, LPARAM param
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CombineTransform (GDI32.@)
|
||||
*
|
||||
* Combines two transformation matrices.
|
||||
*/
|
||||
BOOL WINAPI CombineTransform( XFORM *result, const XFORM *xform1, const XFORM *xform2 )
|
||||
{
|
||||
XFORM r;
|
||||
|
||||
if (!result || !xform1 || !xform2) return FALSE;
|
||||
|
||||
/* Create the result in a temporary XFORM, since result may be
|
||||
* equal to xform1 or xform2 */
|
||||
r.eM11 = xform1->eM11 * xform2->eM11 + xform1->eM12 * xform2->eM21;
|
||||
r.eM12 = xform1->eM11 * xform2->eM12 + xform1->eM12 * xform2->eM22;
|
||||
r.eM21 = xform1->eM21 * xform2->eM11 + xform1->eM22 * xform2->eM21;
|
||||
r.eM22 = xform1->eM21 * xform2->eM12 + xform1->eM22 * xform2->eM22;
|
||||
r.eDx = xform1->eDx * xform2->eM11 + xform1->eDy * xform2->eM21 + xform2->eDx;
|
||||
r.eDy = xform1->eDx * xform2->eM12 + xform1->eDy * xform2->eM22 + xform2->eDy;
|
||||
|
||||
*result = r;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue