Author: tkreuzer
Date: Wed Jul 16 15:16:30 2008
New Revision: 34554
URL:
http://svn.reactos.org/svn/reactos?rev=34554&view=rev
Log:
Patch by Stefan Ginsberg:
- remove XFORM members from DC structure and use MATRIX instead. Use MatrixS2XForm and
XForm2MatrixS for intermediate conversion.
- this is a temporary solution (still using fpu) until I'm finished with FLOATOBJ
rewrite + XFOROMOBJ api (soon)
Modified:
trunk/reactos/subsystems/win32/win32k/include/dc.h
trunk/reactos/subsystems/win32/win32k/include/gdifloat.h
trunk/reactos/subsystems/win32/win32k/objects/coord.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
trunk/reactos/subsystems/win32/win32k/objects/path.c
trunk/reactos/subsystems/win32/win32k/objects/text.c
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Wed Jul 16 15:16:30
2008
@@ -32,10 +32,7 @@
typedef struct _WIN_DC_INFO
{
HRGN hClipRgn; /* Clip region (may be 0) */
- HRGN hrgnMeta; /* Meta region (may be 0) */
- HRGN hMetaClipRgn; /* Intersection of meta and clip regions (may be 0) */
HRGN hVisRgn; /* Should me to DC. Visible region (must never be 0) */
-
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
HBITMAP hBitmap;
@@ -80,18 +77,9 @@
BOOL ufiSet;
FLONG fl;
FLONG flBrush;
- union{
MATRIX_S mxWorldToDevice;
- XFORM xformWorld2Vport; /* World-to-viewport transformation */
- };
- union{
MATRIX_S mxDeviceToWorld;
- XFORM xformVport2World; /* Inverse of the above transformation */
- };
- union{
MATRIX_S mxWorldToPage;
- XFORM xformWorld2Wnd; /* World-to-window transformation */
- };
EFLOAT_S efM11PtoD;
EFLOAT_S efM22PtoD;
EFLOAT_S efDxPtoD;
@@ -102,7 +90,7 @@
EFLOAT_S efPr22;
PBITMAPOBJ pSurface; // SURFACE*
SIZE sizl;
-} DCLEVEL, PDCLEVEL;
+} DCLEVEL, *PDCLEVEL;
/* The DC object structure */
typedef struct _DC
@@ -150,8 +138,6 @@
/* Reactos specific members */
WIN_DC_INFO w;
- HRGN hprgnAPI; // should use prgnAPI
- HRGN hprgnVis; // should use prgnVis
CLIPOBJ *CombinedClip;
XLATEOBJ *XlateBrush;
XLATEOBJ *XlatePen;
Modified: trunk/reactos/subsystems/win32/win32k/include/gdifloat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdifloat.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdifloat.h [iso-8859-1] Wed Jul 16
15:16:30 2008
@@ -23,22 +23,29 @@
return (int)floor(val + 0.5);
}
+
+VOID FASTCALL XForm2MatrixS( MATRIX_S *, PXFORM);
+VOID FASTCALL MatrixS2XForm( PXFORM, MATRIX_S *);
/* Performs a world-to-viewport transformation on the specified point (which
* is in floating point format).
*/
static __inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
+ XFORM xformWorld2Vport;
+
+ MatrixS2XForm(&xformWorld2Vport, &dc->DcLevel.mxWorldToDevice);
/* Perform the transformation */
x = point->x;
y = point->y;
- point->x = x * dc->DcLevel.xformWorld2Vport.eM11 +
- y * dc->DcLevel.xformWorld2Vport.eM21 +
- dc->DcLevel.xformWorld2Vport.eDx;
- point->y = x * dc->DcLevel.xformWorld2Vport.eM12 +
- y * dc->DcLevel.xformWorld2Vport.eM22 +
- dc->DcLevel.xformWorld2Vport.eDy;
+ point->x = x * xformWorld2Vport.eM11 +
+ y * xformWorld2Vport.eM21 +
+ xformWorld2Vport.eDx;
+
+ point->y = x * xformWorld2Vport.eM12 +
+ y * xformWorld2Vport.eM22 +
+ xformWorld2Vport.eDy;
}
/* Performs a viewport-to-world transformation on the specified point (which
@@ -103,8 +110,6 @@
#define YLSTODS(Dc_Attr,ty) \
MulDiv((ty), (Dc_Attr)->szlViewportExt.cy, (Dc_Attr)->szlWindowExt.cy)
-VOID FASTCALL XForm2MatrixS( MATRIX_S *, PXFORM);
-VOID FASTCALL MatrixS2XForm( PXFORM, MATRIX_S *);
-
#endif
+
Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Wed Jul 16 15:16:30
2008
@@ -122,10 +122,14 @@
FLOAT x, y;
x = (FLOAT)Point->x;
y = (FLOAT)Point->y;
- Point->x = x * Dc->DcLevel.xformVport2World.eM11 +
- y * Dc->DcLevel.xformVport2World.eM21 + Dc->DcLevel.xformVport2World.eDx;
- Point->y = x * Dc->DcLevel.xformVport2World.eM12 +
- y * Dc->DcLevel.xformVport2World.eM22 + Dc->DcLevel.xformVport2World.eDy;
+ XFORM xformVport2World;
+
+ MatrixS2XForm(&xformVport2World, &Dc->DcLevel.mxDeviceToWorld);
+
+ Point->x = x * xformVport2World.eM11 +
+ y * xformVport2World.eM21 + xformVport2World.eDx;
+ Point->y = x * xformVport2World.eM12 +
+ y * xformVport2World.eM22 + xformVport2World.eDy;
}
VOID
@@ -158,28 +162,34 @@
DWORD Mode)
{
ASSERT(pDc);
+ XFORM xformWorld2Wnd;
switch(Mode)
{
case MWT_IDENTITY:
- pDc->DcLevel.xformWorld2Wnd.eM11 = 1.0f;
- pDc->DcLevel.xformWorld2Wnd.eM12 = 0.0f;
- pDc->DcLevel.xformWorld2Wnd.eM21 = 0.0f;
- pDc->DcLevel.xformWorld2Wnd.eM22 = 1.0f;
- pDc->DcLevel.xformWorld2Wnd.eDx = 0.0f;
- pDc->DcLevel.xformWorld2Wnd.eDy = 0.0f;
+ xformWorld2Wnd.eM11 = 1.0f;
+ xformWorld2Wnd.eM12 = 0.0f;
+ xformWorld2Wnd.eM21 = 0.0f;
+ xformWorld2Wnd.eM22 = 1.0f;
+ xformWorld2Wnd.eDx = 0.0f;
+ xformWorld2Wnd.eDy = 0.0f;
+ XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, &xformWorld2Wnd);
break;
case MWT_LEFTMULTIPLY:
- IntGdiCombineTransform(&pDc->DcLevel.xformWorld2Wnd, lpXForm,
&pDc->DcLevel.xformWorld2Wnd );
+ MatrixS2XForm(&xformWorld2Wnd, &pDc->DcLevel.mxWorldToPage);
+ IntGdiCombineTransform(&xformWorld2Wnd, lpXForm, &xformWorld2Wnd);
+ XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, &xformWorld2Wnd);
break;
case MWT_RIGHTMULTIPLY:
- IntGdiCombineTransform(&pDc->DcLevel.xformWorld2Wnd,
&pDc->DcLevel.xformWorld2Wnd, lpXForm);
+ MatrixS2XForm(&xformWorld2Wnd, &pDc->DcLevel.mxWorldToPage);
+ IntGdiCombineTransform(&xformWorld2Wnd, &xformWorld2Wnd, lpXForm);
+ XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, &xformWorld2Wnd);
break;
case MWT_MAX+1: // Must be MWT_SET????
- pDc->DcLevel.xformWorld2Wnd = *lpXForm; // Do it like Wine.
+ XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, lpXForm); // Do it like Wine.
break;
default:
@@ -219,7 +229,7 @@
switch(iXform)
{
case GdiWorldSpaceToPageSpace:
- *XForm = dc->DcLevel.xformWorld2Wnd;
+ MatrixS2XForm(XForm, &dc->DcLevel.mxWorldToPage);
break;
default:
break;
@@ -240,16 +250,20 @@
CoordLPtoDP ( PDC Dc, LPPOINT Point )
{
FLOAT x, y;
-
- ASSERT ( Dc );
- ASSERT ( Point );
+ XFORM xformWorld2Vport;
+
+ ASSERT(Dc);
+ ASSERT(Point);
x = (FLOAT)Point->x;
y = (FLOAT)Point->y;
- Point->x = x * Dc->DcLevel.xformWorld2Vport.eM11 +
- y * Dc->DcLevel.xformWorld2Vport.eM21 + Dc->DcLevel.xformWorld2Vport.eDx;
- Point->y = x * Dc->DcLevel.xformWorld2Vport.eM12 +
- y * Dc->DcLevel.xformWorld2Vport.eM22 + Dc->DcLevel.xformWorld2Vport.eDy;
+
+ MatrixS2XForm(&xformWorld2Vport, &Dc->DcLevel.mxWorldToDevice);
+
+ Point->x = x * xformWorld2Vport.eM11 +
+ y * xformWorld2Vport.eM21 + xformWorld2Vport.eDx;
+ Point->y = x * xformWorld2Vport.eM12 +
+ y * xformWorld2Vport.eM22 + xformWorld2Vport.eDy;
}
VOID
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Wed Jul 16 15:16:30
2008
@@ -1359,9 +1359,9 @@
#endif
nDc_Attr->ptlCurrent = Dc_Attr->ptlCurrent;
nDc_Attr->ptfxCurrent = Dc_Attr->ptfxCurrent;
- newdc->DcLevel.xformWorld2Wnd = dc->DcLevel.xformWorld2Wnd;
- newdc->DcLevel.xformWorld2Vport = dc->DcLevel.xformWorld2Vport;
- newdc->DcLevel.xformVport2World = dc->DcLevel.xformVport2World;
+ newdc->DcLevel.mxWorldToDevice = dc->DcLevel.mxWorldToDevice;
+ newdc->DcLevel.mxDeviceToWorld = dc->DcLevel.mxDeviceToWorld;
+ newdc->DcLevel.mxWorldToPage = dc->DcLevel.mxWorldToPage;
nDc_Attr->flXform = Dc_Attr->flXform;
nDc_Attr->ptlWindowOrg = Dc_Attr->ptlWindowOrg;
nDc_Attr->szlWindowExt = Dc_Attr->szlWindowExt;
@@ -1425,9 +1425,9 @@
#endif
Dc_Attr->ptlCurrent = sDc_Attr->ptlCurrent;
Dc_Attr->ptfxCurrent = sDc_Attr->ptfxCurrent;
- dc->DcLevel.xformWorld2Wnd = dcs->DcLevel.xformWorld2Wnd;
- dc->DcLevel.xformWorld2Vport = dcs->DcLevel.xformWorld2Vport;
- dc->DcLevel.xformVport2World = dcs->DcLevel.xformVport2World;
+ dc->DcLevel.mxWorldToDevice = dcs->DcLevel.mxWorldToDevice;
+ dc->DcLevel.mxDeviceToWorld = dcs->DcLevel.mxDeviceToWorld;
+ dc->DcLevel.mxWorldToPage = dcs->DcLevel.mxWorldToPage;
Dc_Attr->flXform = sDc_Attr->flXform;
Dc_Attr->ptlWindowOrg = sDc_Attr->ptlWindowOrg;
Dc_Attr->szlWindowExt = sDc_Attr->szlWindowExt;
@@ -2435,6 +2435,7 @@
PDC_ATTR Dc_Attr;
HDC hDC;
PWSTR Buf = NULL;
+ XFORM xformTemplate;
if (Driver != NULL)
{
@@ -2471,14 +2472,17 @@
if(!Dc_Attr) Dc_Attr = &NewDC->Dc_Attr;
NewDC->BaseObject.hHmgr = (HGDIOBJ) hDC; // Save the handle for this DC object.
- NewDC->DcLevel.xformWorld2Wnd.eM11 = 1.0f;
- NewDC->DcLevel.xformWorld2Wnd.eM12 = 0.0f;
- NewDC->DcLevel.xformWorld2Wnd.eM21 = 0.0f;
- NewDC->DcLevel.xformWorld2Wnd.eM22 = 1.0f;
- NewDC->DcLevel.xformWorld2Wnd.eDx = 0.0f;
- NewDC->DcLevel.xformWorld2Wnd.eDy = 0.0f;
- NewDC->DcLevel.xformWorld2Vport = NewDC->DcLevel.xformWorld2Wnd;
- NewDC->DcLevel.xformVport2World = NewDC->DcLevel.xformWorld2Wnd;
+
+ xformTemplate.eM11 = 1.0f;
+ xformTemplate.eM12 = 0.0f;
+ xformTemplate.eM21 = 0.0f;
+ xformTemplate.eM22 = 1.0f;
+ xformTemplate.eDx = 0.0f;
+ xformTemplate.eDy = 0.0f;
+ XForm2MatrixS(&NewDC->DcLevel.mxWorldToDevice, &xformTemplate);
+ XForm2MatrixS(&NewDC->DcLevel.mxDeviceToWorld, &xformTemplate);
+ XForm2MatrixS(&NewDC->DcLevel.mxWorldToPage, &xformTemplate);
+
// Setup syncing bits for the dcattr data packets.
Dc_Attr->flXform = DEVICE_TO_PAGE_INVALID;
@@ -2663,6 +2667,7 @@
FLOAT scaleX, scaleY;
PDC_ATTR Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+ XFORM xformWorld2Vport, xformWorld2Wnd, xformVport2World;
/* Construct a transformation to do the window-to-viewport conversion */
scaleX = (Dc_Attr->szlWindowExt.cx ? (FLOAT)Dc_Attr->szlViewportExt.cx /
(FLOAT)Dc_Attr->szlWindowExt.cx : 0.0f);
@@ -2675,13 +2680,23 @@
xformWnd2Vport.eDy = (FLOAT)Dc_Attr->ptlViewportOrg.y - scaleY *
(FLOAT)Dc_Attr->ptlWindowOrg.y;
/* Combine with the world transformation */
- IntGdiCombineTransform(&dc->DcLevel.xformWorld2Vport,
&dc->DcLevel.xformWorld2Wnd, &xformWnd2Vport);
+ MatrixS2XForm(&xformWorld2Vport, &dc->DcLevel.mxWorldToDevice);
+ MatrixS2XForm(&xformWorld2Wnd, &dc->DcLevel.mxWorldToPage);
+ IntGdiCombineTransform(&xformWorld2Vport, &xformWorld2Wnd,
&xformWnd2Vport);
/* Create inverse of world-to-viewport transformation */
- if (DC_InvertXform(&dc->DcLevel.xformWorld2Vport,
&dc->DcLevel.xformVport2World))
- Dc_Attr->flXform &= ~DEVICE_TO_WORLD_INVALID;
+ MatrixS2XForm(&xformVport2World, &dc->DcLevel.mxDeviceToWorld);
+ if (DC_InvertXform(&xformWorld2Vport, &xformVport2World))
+ {
+ Dc_Attr->flXform &= ~DEVICE_TO_WORLD_INVALID;
+ }
else
- Dc_Attr->flXform |= DEVICE_TO_WORLD_INVALID;
+ {
+ Dc_Attr->flXform |= DEVICE_TO_WORLD_INVALID;
+ }
+
+ XForm2MatrixS(&dc->DcLevel.mxWorldToDevice, &xformWorld2Vport);
+
}
BOOL FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Wed Jul 16
15:16:30 2008
@@ -113,9 +113,10 @@
CopytoUserDcAttr(PDC dc, PDC_ATTR Dc_Attr)
{
NTSTATUS Status = STATUS_SUCCESS;
- XForm2MatrixS( &dc->Dc_Attr.mxWorldToDevice,
&dc->DcLevel.xformWorld2Vport);
- XForm2MatrixS( &dc->Dc_Attr.mxDevicetoWorld,
&dc->DcLevel.xformVport2World);
- XForm2MatrixS( &dc->Dc_Attr.mxWorldToPage, &dc->DcLevel.xformWorld2Wnd);
+ dc->Dc_Attr.mxWorldToDevice = dc->DcLevel.mxWorldToDevice;
+ dc->Dc_Attr.mxDevicetoWorld = dc->DcLevel.mxDeviceToWorld;
+ dc->Dc_Attr.mxWorldToPage = dc->DcLevel.mxWorldToPage;
+
_SEH_TRY
{
ProbeForWrite( Dc_Attr,
Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Wed Jul 16
15:16:30 2008
@@ -540,8 +540,7 @@
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
/* Do we rotate or shear? */
-// if (!(dc->DcLevel.mxWorldToDevice.flAccel & MXACC_DIAGONAL))
- if (dc->DcLevel.xformWorld2Vport.eM12 != 0. ||
dc->DcLevel.xformWorld2Vport.eM21 != 0.)
+ if (!(dc->DcLevel.mxWorldToDevice.flAccel & MX_SCALE))
{
POINTL DestCoords[4];
DestCoords[0].x = DestCoords[3].x = LeftRect;
Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Wed Jul 16 15:16:30
2008
@@ -120,7 +120,7 @@
* tests show that resetting the graphics mode to GM_COMPATIBLE does
* not reset the world transform.
*/
- xform = dc->DcLevel.xformWorld2Wnd;
+ MatrixS2XForm(&xform, &dc->DcLevel.mxWorldToPage);
/* Set MM_TEXT */
// IntGdiSetMapMode( dc, MM_TEXT );
@@ -1337,7 +1337,8 @@
IntGetViewportOrgEx(dc, &ptViewportOrg);
IntGetWindowExtEx(dc, &szWindowExt);
IntGetWindowOrgEx(dc, &ptWindowOrg);
- xform = dc->DcLevel.xformWorld2Wnd;
+
+ MatrixS2XForm(&xform, &dc->DcLevel.mxWorldToPage);
/* Set MM_TEXT */
Dc_Attr->iMapMode = MM_TEXT;
@@ -1464,7 +1465,7 @@
Dc_Attr->ptlViewportOrg.y = ptViewportOrg.y;
/* Restore the world transform */
- dc->DcLevel.xformWorld2Wnd = xform;
+ XForm2MatrixS(&dc->DcLevel.mxWorldToPage, &xform);
/* If we've moved the current point then get its new position
which will be in device (MM_TEXT) co-ords, convert it to
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] Wed Jul 16 15:16:30
2008
@@ -2611,6 +2611,7 @@
PVOID pvBuf = NULL;
int n = 0;
FT_CharMap found = 0, charmap;
+ XFORM xForm;
DPRINT("%p, %d, %08x, %p, %08lx, %p, %p\n", hdc, wch, iFormat, pgm,
cjBuf, UnsafeBuf, pmat2);
@@ -2623,7 +2624,10 @@
}
Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
- eM11 = dc->DcLevel.xformWorld2Vport.eM11;
+
+ MatrixS2XForm(&xForm, &dc->DcLevel.mxWorldToDevice);
+ eM11 = xForm.eM11;
+
hFont = Dc_Attr->hlfntNew;
TextObj = TEXTOBJ_LockText(hFont);
DC_UnlockDc(dc);