gdi32: Pass a HDC instead of a DC pointer to internal path functions.
This commit is contained in:
parent
507d929051
commit
fbafa45e84
|
@ -683,7 +683,7 @@ HRGN WINAPI PathToRegion(HDC hdc)
|
||||||
return hrgnRval;
|
return hrgnRval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
|
static BOOL PATH_FillPath( HDC hdc, GdiPath *pPath )
|
||||||
{
|
{
|
||||||
INT mapMode, graphicsMode;
|
INT mapMode, graphicsMode;
|
||||||
SIZE ptViewportExt, ptWindowExt;
|
SIZE ptViewportExt, ptWindowExt;
|
||||||
|
@ -692,7 +692,7 @@ static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
|
||||||
HRGN hrgn;
|
HRGN hrgn;
|
||||||
|
|
||||||
/* Construct a region from the path and fill it */
|
/* Construct a region from the path and fill it */
|
||||||
if(PATH_PathToRegion(pPath, dc->polyFillMode, &hrgn))
|
if(PATH_PathToRegion(pPath, GetPolyFillMode(hdc), &hrgn))
|
||||||
{
|
{
|
||||||
/* Since PaintRgn interprets the region as being in logical coordinates
|
/* Since PaintRgn interprets the region as being in logical coordinates
|
||||||
* but the points we store for the path are already in device
|
* but the points we store for the path are already in device
|
||||||
|
@ -703,11 +703,11 @@ static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Save the information about the old mapping mode */
|
/* Save the information about the old mapping mode */
|
||||||
mapMode=GetMapMode(dc->hSelf);
|
mapMode=GetMapMode(hdc);
|
||||||
GetViewportExtEx(dc->hSelf, &ptViewportExt);
|
GetViewportExtEx(hdc, &ptViewportExt);
|
||||||
GetViewportOrgEx(dc->hSelf, &ptViewportOrg);
|
GetViewportOrgEx(hdc, &ptViewportOrg);
|
||||||
GetWindowExtEx(dc->hSelf, &ptWindowExt);
|
GetWindowExtEx(hdc, &ptWindowExt);
|
||||||
GetWindowOrgEx(dc->hSelf, &ptWindowOrg);
|
GetWindowOrgEx(hdc, &ptWindowOrg);
|
||||||
|
|
||||||
/* Save world transform
|
/* Save world transform
|
||||||
* NB: The Windows documentation on world transforms would lead one to
|
* NB: The Windows documentation on world transforms would lead one to
|
||||||
|
@ -715,32 +715,32 @@ static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
|
||||||
* tests show that resetting the graphics mode to GM_COMPATIBLE does
|
* tests show that resetting the graphics mode to GM_COMPATIBLE does
|
||||||
* not reset the world transform.
|
* not reset the world transform.
|
||||||
*/
|
*/
|
||||||
GetWorldTransform(dc->hSelf, &xform);
|
GetWorldTransform(hdc, &xform);
|
||||||
|
|
||||||
/* Set MM_TEXT */
|
/* Set MM_TEXT */
|
||||||
SetMapMode(dc->hSelf, MM_TEXT);
|
SetMapMode(hdc, MM_TEXT);
|
||||||
SetViewportOrgEx(dc->hSelf, 0, 0, NULL);
|
SetViewportOrgEx(hdc, 0, 0, NULL);
|
||||||
SetWindowOrgEx(dc->hSelf, 0, 0, NULL);
|
SetWindowOrgEx(hdc, 0, 0, NULL);
|
||||||
graphicsMode=GetGraphicsMode(dc->hSelf);
|
graphicsMode=GetGraphicsMode(hdc);
|
||||||
SetGraphicsMode(dc->hSelf, GM_ADVANCED);
|
SetGraphicsMode(hdc, GM_ADVANCED);
|
||||||
ModifyWorldTransform(dc->hSelf, &xform, MWT_IDENTITY);
|
ModifyWorldTransform(hdc, &xform, MWT_IDENTITY);
|
||||||
SetGraphicsMode(dc->hSelf, graphicsMode);
|
SetGraphicsMode(hdc, graphicsMode);
|
||||||
|
|
||||||
/* Paint the region */
|
/* Paint the region */
|
||||||
PaintRgn(dc->hSelf, hrgn);
|
PaintRgn(hdc, hrgn);
|
||||||
DeleteObject(hrgn);
|
DeleteObject(hrgn);
|
||||||
/* Restore the old mapping mode */
|
/* Restore the old mapping mode */
|
||||||
SetMapMode(dc->hSelf, mapMode);
|
SetMapMode(hdc, mapMode);
|
||||||
SetViewportExtEx(dc->hSelf, ptViewportExt.cx, ptViewportExt.cy, NULL);
|
SetViewportExtEx(hdc, ptViewportExt.cx, ptViewportExt.cy, NULL);
|
||||||
SetViewportOrgEx(dc->hSelf, ptViewportOrg.x, ptViewportOrg.y, NULL);
|
SetViewportOrgEx(hdc, ptViewportOrg.x, ptViewportOrg.y, NULL);
|
||||||
SetWindowExtEx(dc->hSelf, ptWindowExt.cx, ptWindowExt.cy, NULL);
|
SetWindowExtEx(hdc, ptWindowExt.cx, ptWindowExt.cy, NULL);
|
||||||
SetWindowOrgEx(dc->hSelf, ptWindowOrg.x, ptWindowOrg.y, NULL);
|
SetWindowOrgEx(hdc, ptWindowOrg.x, ptWindowOrg.y, NULL);
|
||||||
|
|
||||||
/* Go to GM_ADVANCED temporarily to restore the world transform */
|
/* Go to GM_ADVANCED temporarily to restore the world transform */
|
||||||
graphicsMode=GetGraphicsMode(dc->hSelf);
|
graphicsMode=GetGraphicsMode(hdc);
|
||||||
SetGraphicsMode(dc->hSelf, GM_ADVANCED);
|
SetGraphicsMode(hdc, GM_ADVANCED);
|
||||||
SetWorldTransform(dc->hSelf, &xform);
|
SetWorldTransform(hdc, &xform);
|
||||||
SetGraphicsMode(dc->hSelf, graphicsMode);
|
SetGraphicsMode(hdc, graphicsMode);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1630,7 +1630,7 @@ BOOL WINAPI FlattenPath(HDC hdc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
static BOOL PATH_StrokePath( HDC hdc, GdiPath *pPath )
|
||||||
{
|
{
|
||||||
INT i, nLinePts, nAlloc;
|
INT i, nLinePts, nAlloc;
|
||||||
POINT *pLinePts;
|
POINT *pLinePts;
|
||||||
|
@ -1641,21 +1641,21 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
|
|
||||||
/* Save the mapping mode info */
|
/* Save the mapping mode info */
|
||||||
mapMode=GetMapMode(dc->hSelf);
|
mapMode=GetMapMode(hdc);
|
||||||
GetViewportExtEx(dc->hSelf, &szViewportExt);
|
GetViewportExtEx(hdc, &szViewportExt);
|
||||||
GetViewportOrgEx(dc->hSelf, &ptViewportOrg);
|
GetViewportOrgEx(hdc, &ptViewportOrg);
|
||||||
GetWindowExtEx(dc->hSelf, &szWindowExt);
|
GetWindowExtEx(hdc, &szWindowExt);
|
||||||
GetWindowOrgEx(dc->hSelf, &ptWindowOrg);
|
GetWindowOrgEx(hdc, &ptWindowOrg);
|
||||||
GetWorldTransform(dc->hSelf, &xform);
|
GetWorldTransform(hdc, &xform);
|
||||||
|
|
||||||
/* Set MM_TEXT */
|
/* Set MM_TEXT */
|
||||||
SetMapMode(dc->hSelf, MM_TEXT);
|
SetMapMode(hdc, MM_TEXT);
|
||||||
SetViewportOrgEx(dc->hSelf, 0, 0, NULL);
|
SetViewportOrgEx(hdc, 0, 0, NULL);
|
||||||
SetWindowOrgEx(dc->hSelf, 0, 0, NULL);
|
SetWindowOrgEx(hdc, 0, 0, NULL);
|
||||||
graphicsMode=GetGraphicsMode(dc->hSelf);
|
graphicsMode=GetGraphicsMode(hdc);
|
||||||
SetGraphicsMode(dc->hSelf, GM_ADVANCED);
|
SetGraphicsMode(hdc, GM_ADVANCED);
|
||||||
ModifyWorldTransform(dc->hSelf, &xform, MWT_IDENTITY);
|
ModifyWorldTransform(hdc, &xform, MWT_IDENTITY);
|
||||||
SetGraphicsMode(dc->hSelf, graphicsMode);
|
SetGraphicsMode(hdc, graphicsMode);
|
||||||
|
|
||||||
/* Allocate enough memory for the worst case without beziers (one PT_MOVETO
|
/* Allocate enough memory for the worst case without beziers (one PT_MOVETO
|
||||||
* and the rest PT_LINETO with PT_CLOSEFIGURE at the end) plus some buffer
|
* and the rest PT_LINETO with PT_CLOSEFIGURE at the end) plus some buffer
|
||||||
|
@ -1678,7 +1678,7 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
||||||
TRACE("Got PT_MOVETO (%d, %d)\n",
|
TRACE("Got PT_MOVETO (%d, %d)\n",
|
||||||
pPath->pPoints[i].x, pPath->pPoints[i].y);
|
pPath->pPoints[i].x, pPath->pPoints[i].y);
|
||||||
if(nLinePts >= 2)
|
if(nLinePts >= 2)
|
||||||
Polyline(dc->hSelf, pLinePts, nLinePts);
|
Polyline(hdc, pLinePts, nLinePts);
|
||||||
nLinePts = 0;
|
nLinePts = 0;
|
||||||
pLinePts[nLinePts++] = pPath->pPoints[i];
|
pLinePts[nLinePts++] = pPath->pPoints[i];
|
||||||
break;
|
break;
|
||||||
|
@ -1724,23 +1724,23 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
||||||
pLinePts[nLinePts++] = pLinePts[0];
|
pLinePts[nLinePts++] = pLinePts[0];
|
||||||
}
|
}
|
||||||
if(nLinePts >= 2)
|
if(nLinePts >= 2)
|
||||||
Polyline(dc->hSelf, pLinePts, nLinePts);
|
Polyline(hdc, pLinePts, nLinePts);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
HeapFree(GetProcessHeap(), 0, pLinePts);
|
HeapFree(GetProcessHeap(), 0, pLinePts);
|
||||||
|
|
||||||
/* Restore the old mapping mode */
|
/* Restore the old mapping mode */
|
||||||
SetMapMode(dc->hSelf, mapMode);
|
SetMapMode(hdc, mapMode);
|
||||||
SetWindowExtEx(dc->hSelf, szWindowExt.cx, szWindowExt.cy, NULL);
|
SetWindowExtEx(hdc, szWindowExt.cx, szWindowExt.cy, NULL);
|
||||||
SetWindowOrgEx(dc->hSelf, ptWindowOrg.x, ptWindowOrg.y, NULL);
|
SetWindowOrgEx(hdc, ptWindowOrg.x, ptWindowOrg.y, NULL);
|
||||||
SetViewportExtEx(dc->hSelf, szViewportExt.cx, szViewportExt.cy, NULL);
|
SetViewportExtEx(hdc, szViewportExt.cx, szViewportExt.cy, NULL);
|
||||||
SetViewportOrgEx(dc->hSelf, ptViewportOrg.x, ptViewportOrg.y, NULL);
|
SetViewportOrgEx(hdc, ptViewportOrg.x, ptViewportOrg.y, NULL);
|
||||||
|
|
||||||
/* Go to GM_ADVANCED temporarily to restore the world transform */
|
/* Go to GM_ADVANCED temporarily to restore the world transform */
|
||||||
graphicsMode=GetGraphicsMode(dc->hSelf);
|
graphicsMode=GetGraphicsMode(hdc);
|
||||||
SetGraphicsMode(dc->hSelf, GM_ADVANCED);
|
SetGraphicsMode(hdc, GM_ADVANCED);
|
||||||
SetWorldTransform(dc->hSelf, &xform);
|
SetWorldTransform(hdc, &xform);
|
||||||
SetGraphicsMode(dc->hSelf, graphicsMode);
|
SetGraphicsMode(hdc, graphicsMode);
|
||||||
|
|
||||||
/* If we've moved the current point then get its new position
|
/* If we've moved the current point then get its new position
|
||||||
which will be in device (MM_TEXT) co-ords, convert it to
|
which will be in device (MM_TEXT) co-ords, convert it to
|
||||||
|
@ -1750,9 +1750,9 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
|
||||||
*/
|
*/
|
||||||
if(i > 0) {
|
if(i > 0) {
|
||||||
POINT pt;
|
POINT pt;
|
||||||
GetCurrentPositionEx(dc->hSelf, &pt);
|
GetCurrentPositionEx(hdc, &pt);
|
||||||
DPtoLP(dc->hSelf, &pt, 1);
|
DPtoLP(hdc, &pt, 1);
|
||||||
MoveToEx(dc->hSelf, pt.x, pt.y, NULL);
|
MoveToEx(hdc, pt.x, pt.y, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2207,7 +2207,7 @@ BOOL nulldrv_FillPath( PHYSDEV dev )
|
||||||
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!PATH_FillPath( dc, &dc->path )) return FALSE;
|
if (!PATH_FillPath( dev->hdc, &dc->path )) return FALSE;
|
||||||
/* FIXME: Should the path be emptied even if conversion failed? */
|
/* FIXME: Should the path be emptied even if conversion failed? */
|
||||||
PATH_EmptyPath( &dc->path );
|
PATH_EmptyPath( &dc->path );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2222,8 +2222,8 @@ BOOL nulldrv_StrokeAndFillPath( PHYSDEV dev )
|
||||||
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!PATH_FillPath( dc, &dc->path )) return FALSE;
|
if (!PATH_FillPath( dev->hdc, &dc->path )) return FALSE;
|
||||||
if (!PATH_StrokePath( dc, &dc->path )) return FALSE;
|
if (!PATH_StrokePath( dev->hdc, &dc->path )) return FALSE;
|
||||||
PATH_EmptyPath( &dc->path );
|
PATH_EmptyPath( &dc->path );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2237,7 +2237,7 @@ BOOL nulldrv_StrokePath( PHYSDEV dev )
|
||||||
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!PATH_StrokePath( dc, &dc->path )) return FALSE;
|
if (!PATH_StrokePath( dev->hdc, &dc->path )) return FALSE;
|
||||||
PATH_EmptyPath( &dc->path );
|
PATH_EmptyPath( &dc->path );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue