[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 28 Jul 2012 18:31:24 +0000 (18:31 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 28 Jul 2012 18:31:24 +0000 (18:31 +0000)
- Take translation into account when inverting an XFORMOBJ
- Always use the matrices from the DCATTR instead of DCLEVEL
- Mark Device-to-World translation as invalid when the Window Origin is modified
Fixes 7088
See issue #7088 for more details.

svn path=/trunk/; revision=56970

reactos/win32ss/gdi/ntgdi/coord.c
reactos/win32ss/gdi/ntgdi/fillshap.c
reactos/win32ss/gdi/ntgdi/freetype.c
reactos/win32ss/gdi/ntgdi/gdifloat.h
reactos/win32ss/gdi/ntgdi/path.c
reactos/win32ss/gdi/ntgdi/xformobj.c

index d3a1a66..f4fb626 100644 (file)
@@ -635,7 +635,7 @@ NtGdiOffsetWindowOrgEx(
 
     pdcattr->ptlWindowOrg.x += XOffset;
     pdcattr->ptlWindowOrg.y += YOffset;
-    pdcattr->flXform |= PAGE_XLATE_CHANGED;
+    pdcattr->flXform |= PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID;
 
     DC_UnlockDc(dc);
 
@@ -1052,8 +1052,6 @@ DC_vSetLayout(
     pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
                          INVALIDATE_ATTRIBUTES |
                          DEVICE_TO_WORLD_INVALID);
-
-//  DC_UpdateXforms(pdc);
 }
 
 // NtGdiSetLayout
index 846398d..551bea4 100644 (file)
@@ -663,7 +663,7 @@ NtGdiRectangle(HDC  hDC,
     }
 
     /* Do we rotate or shear? */
-    if (!(dc->dclevel.mxWorldToDevice.flAccel & XFORM_SCALE))
+    if (!(dc->pdcattr->mxWorldToDevice.flAccel & XFORM_SCALE))
     {
         POINTL DestCoords[4];
         ULONG PolyCounts = 4;
index 9461b11..201cb9b 100644 (file)
@@ -1490,7 +1490,7 @@ ftGdiGetGlyphOutline(
 
     pdcattr = dc->pdcattr;
 
-    MatrixS2XForm(&xForm, &dc->dclevel.mxWorldToDevice);
+    MatrixS2XForm(&xForm, &dc->pdcattr->mxWorldToDevice);
     eM11 = xForm.eM11;
 
     hFont = pdcattr->hlfntNew;
index 566388f..25bd1b2 100644 (file)
@@ -23,8 +23,8 @@ static __inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
 {
     FLOAT x, y;
     XFORM xformWorld2Vport;
-    
-    MatrixS2XForm(&xformWorld2Vport, &dc->dclevel.mxWorldToDevice);
+
+    MatrixS2XForm(&xformWorld2Vport, &dc->pdcattr->mxWorldToDevice);
 
     /* Perform the transformation */
     x = point->x;
index 315b95e..bfafeec 100644 (file)
@@ -76,7 +76,7 @@ GdiPathDPtoLP(PDC pdc, PPOINT ppt, INT count)
 {
   XFORMOBJ xo;
 
-  XFORMOBJ_vInit(&xo, &pdc->dclevel.mxDeviceToWorld);
+  XFORMOBJ_vInit(&xo, &pdc->pdcattr->mxDeviceToWorld);
   return XFORMOBJ_bApplyXform(&xo, XF_LTOL, count, (PPOINTL)ppt, (PPOINTL)ppt);
 }
 
@@ -124,7 +124,7 @@ PATH_FillPath( PDC dc, PPATH pPath )
      * tests show that resetting the graphics mode to GM_COMPATIBLE does
      * not reset the world transform.
      */
-    MatrixS2XForm(&xform, &dc->dclevel.mxWorldToPage);
+    MatrixS2XForm(&xform, &dc->pdcattr->mxWorldToPage);
 
     /* Set MM_TEXT */
 //    IntGdiSetMapMode( dc, MM_TEXT );
@@ -1429,7 +1429,7 @@ BOOL FASTCALL PATH_StrokePath(DC *dc, PPATH pPath)
     szWindowExt = dc->pdcattr->szlWindowExt;
     ptWindowOrg = dc->pdcattr->ptlWindowOrg;
 
-    MatrixS2XForm(&xform, &dc->dclevel.mxWorldToPage);
+    MatrixS2XForm(&xform, &dc->pdcattr->mxWorldToPage);
 
     /* Set MM_TEXT */
     pdcattr->iMapMode = MM_TEXT;
@@ -1556,7 +1556,7 @@ end:
     pdcattr->ptlViewportOrg.y = ptViewportOrg.y;
 
     /* Restore the world transform */
-    XForm2MatrixS(&dc->dclevel.mxWorldToPage, &xform);
+    XForm2MatrixS(&dc->pdcattr->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
index 6492174..a4b0b18 100644 (file)
@@ -289,6 +289,16 @@ XFORMOBJ_iInverse(
     pmxDst->efM21 = pmxSrc->efM21;
     FLOATOBJ_Div(&pmxDst->efM21, &foDet);
 
+    /* Calculate the inverted x shift: Dx' = -Dx * M11' - Dy * M21' */
+    pmxDst->efDx = pmxSrc->efDx;
+    FLOATOBJ_Neg(&pmxDst->efDx);
+    MulSub(&pmxDst->efDx, &pmxDst->efDx, &pmxDst->efM11, &pmxSrc->efDy, &pmxDst->efM21);
+
+    /* Calculate the inverted y shift: Dy' = -Dy * M22' - Dx * M12' */
+    pmxDst->efDy = pmxSrc->efDy;
+    FLOATOBJ_Neg(&pmxDst->efDy);
+    MulSub(&pmxDst->efDy, &pmxDst->efDy, &pmxDst->efM22, &pmxSrc->efDx, &pmxDst->efM12);
+
     /* Update accelerators and return complexity */
     return XFORMOBJ_UpdateAccel(pxoDst);
 }