+ if( PATH_PathToRegion( pPath, dc->w.polyFillMode, &hrgn ))
+ {
+ /* Since PaintRgn interprets the region as being in logical coordinates
+ * but the points we store for the path are already in device
+ * coordinates, we have to set the mapping mode to MM_TEXT temporarily.
+ * Using SaveDC to save information about the mapping mode / world
+ * transform would be easier but would require more overhead, especially
+ * now that SaveDC saves the current path.
+ */
+
+ /* Save the information about the old mapping mode */
+ mapMode = NtGdiGetMapMode( dc->hSelf );
+ NtGdiGetViewportExtEx( dc->hSelf, &ptViewportExt );
+ NtGdiGetViewportOrgEx( dc->hSelf, &ptViewportOrg );
+ NtGdiGetWindowExtEx( dc->hSelf, &ptWindowExt );
+ NtGdiGetWindowOrgEx( dc->hSelf, &ptWindowOrg );
+
+ /* Save world transform
+ * NB: The Windows documentation on world transforms would lead one to
+ * believe that this has to be done only in GM_ADVANCED; however, my
+ * tests show that resetting the graphics mode to GM_COMPATIBLE does
+ * not reset the world transform.
+ */
+ NtGdiGetWorldTransform( dc->hSelf, &xform );
+
+ /* Set MM_TEXT */
+ NtGdiSetMapMode( dc->hSelf, MM_TEXT );
+ NtGdiSetViewportOrgEx( dc->hSelf, 0, 0, NULL );
+ NtGdiSetWindowOrgEx( dc->hSelf, 0, 0, NULL );
+ graphicsMode = NtGdiGetGraphicsMode( dc->hSelf );
+ NtGdiSetGraphicsMode( dc->hSelf, GM_ADVANCED );
+ NtGdiModifyWorldTransform( dc->hSelf, &xform, MWT_IDENTITY );
+ NtGdiSetGraphicsMode( dc->hSelf, graphicsMode );
+
+ /* Paint the region */
+ NtGdiPaintRgn( dc->hSelf, hrgn );
+ NtGdiDeleteObject( hrgn );
+ /* Restore the old mapping mode */
+ NtGdiSetMapMode( dc->hSelf, mapMode );
+ NtGdiSetViewportExtEx( dc->hSelf, ptViewportExt.cx, ptViewportExt.cy, NULL );
+ NtGdiSetViewportOrgEx( dc->hSelf, ptViewportOrg.x, ptViewportOrg.y, NULL );
+ NtGdiSetWindowExtEx( dc->hSelf, ptWindowExt.cx, ptWindowExt.cy, NULL );
+ NtGdiSetWindowOrgEx( dc->hSelf, ptWindowOrg.x, ptWindowOrg.y, NULL );
+
+ /* Go to GM_ADVANCED temporarily to restore the world transform */
+ graphicsMode = NtGdiGetGraphicsMode( dc->hSelf );
+ NtGdiSetGraphicsMode( dc->hSelf, GM_ADVANCED );
+ NtGdiSetWorldTransform( dc->hSelf, &xform );
+ NtGdiSetGraphicsMode( dc->hSelf, graphicsMode );
+ return TRUE;
+ }