Stefan Ginsberg <stefan__100__ at hotmail.com>

- Remove old DCOrg and replace it with ptlDCOrig.

svn path=/trunk/; revision=33828
This commit is contained in:
James Tabor 2008-06-02 17:53:53 +00:00
parent ae9a18969f
commit 114a366a38
11 changed files with 92 additions and 113 deletions

View file

@ -64,12 +64,8 @@ typedef struct _WIN_DC_INFO
GdiPath path;
/* #endif */
RECT totalExtent;
BYTE bitsPerPixel;
INT DCOrgX; /* DC origin */
INT DCOrgY;
XFORM xformWorld2Wnd; /* World-to-window transformation */
XFORM xformWorld2Vport; /* World-to-viewport transformation */
XFORM xformVport2World; /* Inverse of the above transformation */

View file

@ -135,7 +135,7 @@ BOOL FASTCALL IntGdiGradientFill(DC *dc,
/* DC functions */
BOOL FASTCALL
IntGdiGetDCOrgEx(DC *dc, LPPOINT Point);
IntGdiGetDCOrg(PDC pDC, PPOINTL pPointl);
INT FASTCALL
IntGdiGetObject(HANDLE handle, INT count, LPVOID buffer);

View file

@ -167,21 +167,21 @@ DceSetDrawable(PWINDOW_OBJECT Window OPTIONAL, HDC hDC, ULONG Flags,
if (Window == NULL)
{
dc->w.DCOrgX = 0;
dc->w.DCOrgY = 0;
dc->ptlDCOrig.x = 0;
dc->ptlDCOrig.y = 0;
}
else
{
Wnd = Window->Wnd;
if (Flags & DCX_WINDOW)
{
dc->w.DCOrgX = Wnd->WindowRect.left;
dc->w.DCOrgY = Wnd->WindowRect.top;
dc->ptlDCOrig.x = Wnd->WindowRect.left;
dc->ptlDCOrig.y = Wnd->WindowRect.top;
}
else
{
dc->w.DCOrgX = Wnd->ClientRect.left;
dc->w.DCOrgY = Wnd->ClientRect.top;
dc->ptlDCOrig.x = Wnd->ClientRect.left;
dc->ptlDCOrig.y = Wnd->ClientRect.top;
}
}
DC_UnlockDc(dc);
@ -726,17 +726,17 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window)
{
if (pDCE->DCXFlags & DCX_WINDOW)
{
DeltaX = CurrentWindow->Wnd->WindowRect.left - dc->w.DCOrgX;
DeltaY = CurrentWindow->Wnd->WindowRect.top - dc->w.DCOrgY;
dc->w.DCOrgX = CurrentWindow->Wnd->WindowRect.left;
dc->w.DCOrgY = CurrentWindow->Wnd->WindowRect.top;
DeltaX = CurrentWindow->Wnd->WindowRect.left - dc->ptlDCOrig.x;
DeltaY = CurrentWindow->Wnd->WindowRect.top - dc->ptlDCOrig.y;
dc->ptlDCOrig.x = CurrentWindow->Wnd->WindowRect.left;
dc->ptlDCOrig.y = CurrentWindow->Wnd->WindowRect.top;
}
else
{
DeltaX = CurrentWindow->Wnd->ClientRect.left - dc->w.DCOrgX;
DeltaY = CurrentWindow->Wnd->ClientRect.top - dc->w.DCOrgY;
dc->w.DCOrgX = CurrentWindow->Wnd->ClientRect.left;
dc->w.DCOrgY = CurrentWindow->Wnd->ClientRect.top;
DeltaX = CurrentWindow->Wnd->ClientRect.left - dc->ptlDCOrig.x;
DeltaY = CurrentWindow->Wnd->ClientRect.top - dc->ptlDCOrig.y;
dc->ptlDCOrig.x = CurrentWindow->Wnd->ClientRect.left;
dc->ptlDCOrig.y = CurrentWindow->Wnd->ClientRect.top;
}
if (NULL != dc->w.hClipRgn)
{

View file

@ -87,10 +87,10 @@ NtGdiAlphaBlend(
}
/* Offset the destination and source by the origin of their DCs. */
XOriginDest += DCDest->w.DCOrgX;
YOriginDest += DCDest->w.DCOrgY;
XOriginSrc += DCSrc->w.DCOrgX;
YOriginSrc += DCSrc->w.DCOrgY;
XOriginDest += DCDest->ptlDCOrig.x;
YOriginDest += DCDest->ptlDCOrig.y;
XOriginSrc += DCSrc->ptlDCOrig.x;
YOriginSrc += DCSrc->ptlDCOrig.y;
DestRect.left = XOriginDest;
DestRect.top = YOriginDest;
@ -228,12 +228,12 @@ NtGdiBitBlt(
if (!Dc_Attr) Dc_Attr = &DCDest->Dc_Attr;
/* Offset the destination and source by the origin of their DCs. */
XDest += DCDest->w.DCOrgX;
YDest += DCDest->w.DCOrgY;
XDest += DCDest->ptlDCOrig.x;
YDest += DCDest->ptlDCOrig.y;
if (UsesSource)
{
XSrc += DCSrc->w.DCOrgX;
YSrc += DCSrc->w.DCOrgY;
XSrc += DCSrc->ptlDCOrig.x;
YSrc += DCSrc->ptlDCOrig.y;
}
DestRect.left = XDest;
@ -392,10 +392,10 @@ NtGdiTransparentBlt(
}
/* Offset positions */
xDst += DCDest->w.DCOrgX;
yDst += DCDest->w.DCOrgY;
xSrc += DCSrc->w.DCOrgX;
ySrc += DCSrc->w.DCOrgY;
xDst += DCDest->ptlDCOrig.x;
yDst += DCDest->ptlDCOrig.y;
xSrc += DCSrc->ptlDCOrig.x;
ySrc += DCSrc->ptlDCOrig.y;
BitmapDest = BITMAPOBJ_LockBitmap(DCDest->w.hBitmap);
if (!BitmapDest)
@ -796,13 +796,13 @@ NtGdiStretchBlt(
}
/* Offset the destination and source by the origin of their DCs. */
// FIXME: DCOrg is in device coordinates!
XOriginDest += DCDest->w.DCOrgX;
YOriginDest += DCDest->w.DCOrgY;
// FIXME: ptlDCOrig is in device coordinates!
XOriginDest += DCDest->ptlDCOrig.x;
YOriginDest += DCDest->ptlDCOrig.y;
if (UsesSource)
{
XOriginSrc += DCSrc->w.DCOrgX;
YOriginSrc += DCSrc->w.DCOrgY;
XOriginSrc += DCSrc->ptlDCOrig.x;
YOriginSrc += DCSrc->ptlDCOrig.y;
}
DestRect.left = XOriginDest;
@ -964,30 +964,30 @@ IntPatBlt(
{
if (Width > 0)
{
DestRect.left = XLeft + dc->w.DCOrgX;
DestRect.right = XLeft + Width + dc->w.DCOrgX;
DestRect.left = XLeft + dc->ptlDCOrig.x;
DestRect.right = XLeft + Width + dc->ptlDCOrig.x;
}
else
{
DestRect.left = XLeft + Width + 1 + dc->w.DCOrgX;
DestRect.right = XLeft + dc->w.DCOrgX + 1;
DestRect.left = XLeft + Width + 1 + dc->ptlDCOrig.x;
DestRect.right = XLeft + dc->ptlDCOrig.x + 1;
}
if (Height > 0)
{
DestRect.top = YLeft + dc->w.DCOrgY;
DestRect.bottom = YLeft + Height + dc->w.DCOrgY;
DestRect.top = YLeft + dc->ptlDCOrig.y;
DestRect.bottom = YLeft + Height + dc->ptlDCOrig.y;
}
else
{
DestRect.top = YLeft + Height + dc->w.DCOrgY + 1;
DestRect.bottom = YLeft + dc->w.DCOrgY + 1;
DestRect.top = YLeft + Height + dc->ptlDCOrig.y + 1;
DestRect.bottom = YLeft + dc->ptlDCOrig.y + 1;
}
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX;
BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY;
BrushOrigin.x = BrushObj->ptOrigin.x + dc->ptlDCOrig.x;
BrushOrigin.y = BrushObj->ptOrigin.y + dc->ptlDCOrig.y;
IntGdiInitBrushInstance(&BrushInst, BrushObj, dc->XlateBrush);

View file

@ -256,8 +256,8 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
DC_UnlockDc(dc);
return Result;
}
XPos += dc->w.DCOrgX;
YPos += dc->w.DCOrgY;
XPos += dc->ptlDCOrig.x;
YPos += dc->ptlDCOrig.y;
if ( IN_RECT(dc->CombinedClip->rclBounds,XPos,YPos) )
{
bInRect = TRUE;

View file

@ -34,7 +34,7 @@ CLIPPING_UpdateGCRegion(DC* Dc)
NtGdiCombineRgn(Dc->w.hGCClipRgn, Dc->w.hVisRgn, 0, RGN_COPY);
else
NtGdiCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn, RGN_AND);
NtGdiOffsetRgn(Dc->w.hGCClipRgn, Dc->w.DCOrgX, Dc->w.DCOrgY);
NtGdiOffsetRgn(Dc->w.hGCClipRgn, Dc->ptlDCOrig.x, Dc->ptlDCOrig.y);
if((CombinedRegion = REGION_LockRgn(Dc->w.hGCClipRgn)))
{
@ -55,7 +55,7 @@ CLIPPING_UpdateGCRegion(DC* Dc)
return ERROR;
}
return NtGdiOffsetRgn(Dc->w.hGCClipRgn, -Dc->w.DCOrgX, -Dc->w.DCOrgY);
return NtGdiOffsetRgn(Dc->w.hGCClipRgn, -Dc->ptlDCOrig.x, -Dc->ptlDCOrig.y);
}
INT FASTCALL
@ -86,7 +86,7 @@ GdiSelectVisRgn(HDC hdc, HRGN hrgn)
retval = NtGdiCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
if ( retval != ERROR )
{
NtGdiOffsetRgn(dc->w.hVisRgn, -dc->w.DCOrgX, -dc->w.DCOrgY);
NtGdiOffsetRgn(dc->w.hVisRgn, -dc->ptlDCOrig.x, -dc->ptlDCOrig.y);
CLIPPING_UpdateGCRegion(dc);
}
DC_UnlockDc(dc);

View file

@ -1134,15 +1134,6 @@ NtGdiGetDCObject(HDC hDC, INT ObjectType)
return SelObject;
}
BOOL FASTCALL
IntGdiGetDCOrgEx(DC *dc, LPPOINT Point)
{
Point->x = dc->w.DCOrgX;
Point->y = dc->w.DCOrgY;
return TRUE;
}
LONG FASTCALL
IntCalcFillOrigin(PDC pdc)
{
@ -1261,7 +1252,7 @@ NtGdiGetDCPoint( HDC hDC, UINT iPoint, PPOINTL Point)
IntGetWindowOrgEx(dc, &SafePoint);
break;
case GdiGetDCOrg:
Ret = IntGdiGetDCOrgEx(dc, &SafePoint);
Ret = IntGdiGetDCOrg(dc, &SafePoint);
break;
case GdiGetAspectRatioFilter:
Ret = IntGetAspectRatioFilter(dc, &Size);
@ -1319,7 +1310,6 @@ IntGdiCopyToSaveState(PDC dc, PDC newdc)
nDc_Attr->hlfntNew = Dc_Attr->hlfntNew;
newdc->w.hBitmap = dc->w.hBitmap;
newdc->DcLevel.hpal = dc->DcLevel.hpal;
newdc->w.totalExtent = dc->w.totalExtent;
newdc->w.bitsPerPixel = dc->w.bitsPerPixel;
nDc_Attr->jROP2 = Dc_Attr->jROP2;
nDc_Attr->jFillMode = Dc_Attr->jFillMode;
@ -1340,8 +1330,8 @@ IntGdiCopyToSaveState(PDC dc, PDC newdc)
nDc_Attr->iGraphicsMode = Dc_Attr->iGraphicsMode;
#if 0
/* Apparently, the DC origin is not changed by [GS]etDCState */
newdc->w.DCOrgX = dc->w.DCOrgX;
newdc->w.DCOrgY = dc->w.DCOrgY;
newdc->ptlDCOrig.x = dc->ptlDCOrig.x;
newdc->ptlDCOrig.y = dc->ptlDCOrig.y;
#endif
nDc_Attr->ptlCurrent = Dc_Attr->ptlCurrent;
nDc_Attr->ptfxCurrent = Dc_Attr->ptfxCurrent;
@ -1387,7 +1377,6 @@ IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
dc->DcLevel.flPath = dcs->DcLevel.flPath & ~DCPATH_SAVE;
Dc_Attr->dwLayout = sDc_Attr->dwLayout;
dc->w.totalExtent = dcs->w.totalExtent;
Dc_Attr->jROP2 = sDc_Attr->jROP2;
Dc_Attr->jFillMode = sDc_Attr->jFillMode;
Dc_Attr->jStretchBltMode = sDc_Attr->jStretchBltMode;
@ -1408,8 +1397,8 @@ IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
Dc_Attr->iGraphicsMode = sDc_Attr->iGraphicsMode;
#if 0
/* Apparently, the DC origin is not changed by [GS]etDCState */
dc->w.DCOrgX = dcs->w.DCOrgX;
dc->w.DCOrgY = dcs->w.DCOrgY;
dc->ptlDCOrig.x = dcs->ptlDCOrig.x;
dc->ptlDCOrig.y = dcs->ptlDCOrig.y;
#endif
Dc_Attr->ptlCurrent = sDc_Attr->ptlCurrent;
Dc_Attr->ptfxCurrent = sDc_Attr->ptfxCurrent;

View file

@ -73,8 +73,8 @@ IntGdiPolygon(PDC dc,
IntLPtoDP(dc, UnsafePoints, Count);
for (CurrentPoint = 0; CurrentPoint < Count; CurrentPoint++)
{
UnsafePoints[CurrentPoint].x += dc->w.DCOrgX;
UnsafePoints[CurrentPoint].y += dc->w.DCOrgY;
UnsafePoints[CurrentPoint].x += dc->ptlDCOrig.x;
UnsafePoints[CurrentPoint].y += dc->ptlDCOrig.y;
}
if (PATH_IsPathOpen(dc->w.path))
@ -273,10 +273,10 @@ NtGdiEllipse(
IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
RectBounds.left += dc->w.DCOrgX;
RectBounds.right += dc->w.DCOrgX;
RectBounds.top += dc->w.DCOrgY;
RectBounds.bottom += dc->w.DCOrgY;
RectBounds.left += dc->ptlDCOrig.x;
RectBounds.right += dc->ptlDCOrig.x;
RectBounds.top += dc->ptlDCOrig.y;
RectBounds.bottom += dc->ptlDCOrig.y;
RadiusX = max((RectBounds.right - RectBounds.left) >> 1, 1);
RadiusY = max((RectBounds.bottom - RectBounds.top) >> 1, 1);
@ -683,14 +683,14 @@ NtGdiPie(HDC hDC,
return FALSE;
}
Left += dc->w.DCOrgX;
Right += dc->w.DCOrgX;
Top += dc->w.DCOrgY;
Bottom += dc->w.DCOrgY;
XRadialStart += dc->w.DCOrgX;
YRadialStart += dc->w.DCOrgY;
XRadialEnd += dc->w.DCOrgX;
YRadialEnd += dc->w.DCOrgY;
Left += dc->ptlDCOrig.x;
Right += dc->ptlDCOrig.x;
Top += dc->ptlDCOrig.y;
Bottom += dc->ptlDCOrig.y;
XRadialStart += dc->ptlDCOrig.x;
YRadialStart += dc->ptlDCOrig.y;
XRadialEnd += dc->ptlDCOrig.x;
YRadialEnd += dc->ptlDCOrig.y;
RectBounds.left = Left;
RectBounds.right = Right;
@ -1047,10 +1047,10 @@ IntRectangle(PDC dc,
}
else
{
LeftRect += dc->w.DCOrgX;
RightRect += dc->w.DCOrgX - 1;
TopRect += dc->w.DCOrgY;
BottomRect += dc->w.DCOrgY - 1;
LeftRect += dc->ptlDCOrig.x;
RightRect += dc->ptlDCOrig.x - 1;
TopRect += dc->ptlDCOrig.y;
BottomRect += dc->ptlDCOrig.y - 1;
DestRect.left = LeftRect;
DestRect.right = RightRect;
@ -1207,10 +1207,10 @@ IntRoundRect(
xradius = xCurveDiameter >> 1;
yradius = yCurveDiameter >> 1;
left += dc->w.DCOrgX;
right += dc->w.DCOrgX;
top += dc->w.DCOrgY;
bottom += dc->w.DCOrgY;
left += dc->ptlDCOrig.x;
right += dc->ptlDCOrig.x;
top += dc->ptlDCOrig.y;
bottom += dc->ptlDCOrig.y;
RectBounds.left = left;
RectBounds.right = right;
@ -1540,8 +1540,8 @@ IntGdiGradientFill(
Extent.bottom = max(Extent.bottom, (pVertex + i)->y);
}
DitherOrg.x = dc->w.DCOrgX;
DitherOrg.y = dc->w.DCOrgY;
DitherOrg.x = dc->ptlDCOrig.x;
DitherOrg.y = dc->ptlDCOrig.y;
Extent.left += DitherOrg.x;
Extent.right += DitherOrg.x;
Extent.top += DitherOrg.y;

View file

@ -130,10 +130,10 @@ IntGdiLineTo(DC *dc,
IntLPtoDP(dc, Points, 2);
/* The DCOrg is in device coordinates */
Points[0].x += dc->w.DCOrgX;
Points[0].y += dc->w.DCOrgY;
Points[1].x += dc->w.DCOrgX;
Points[1].y += dc->w.DCOrgY;
Points[0].x += dc->ptlDCOrig.x;
Points[0].y += dc->ptlDCOrig.y;
Points[1].x += dc->ptlDCOrig.x;
Points[1].y += dc->ptlDCOrig.y;
Bounds.left = min(Points[0].x, Points[1].x);
Bounds.top = min(Points[0].y, Points[1].y);
@ -281,8 +281,8 @@ IntGdiPolyline(DC *dc,
/* Offset the array of point by the dc->w.DCOrg */
for (i = 0; i < Count; i++)
{
Points[i].x += dc->w.DCOrgX;
Points[i].y += dc->w.DCOrgY;
Points[i].x += dc->ptlDCOrig.x;
Points[i].y += dc->ptlDCOrig.y;
}
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);

View file

@ -2645,7 +2645,7 @@ NtGdiGetRandomRgn(
}
if (iCode == SYSRGN)
{
IntGdiGetDCOrgEx(pDC, &org);
IntGdiGetDCOrg(pDC, &org);
NtGdiOffsetRgn(hDest, org.x, org.y );
}
@ -2828,7 +2828,7 @@ IntGdiPaintRgn(
/* ei enable later
// Transform region into device co-ords
if (!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || NtGdiOffsetRgn(tmpVisRgn, dc->w.DCOrgX, dc->w.DCOrgY) == ERROR)
if (!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || NtGdiOffsetRgn(tmpVisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR)
{
NtGdiDeleteObject(tmpVisRgn);
DC_UnlockDc(dc);

View file

@ -1626,8 +1626,8 @@ NtGdiExtTextOutW(
Start.x = XStart; Start.y = YStart;
IntLPtoDP(dc, &Start, 1);
RealXStart = (Start.x + dc->w.DCOrgX) << 6;
YStart = Start.y + dc->w.DCOrgY;
RealXStart = (Start.x + dc->ptlDCOrig.x) << 6;
YStart = Start.y + dc->ptlDCOrig.y;
/* Create the brushes */
hDestPalette = BitmapObj->hDIBPalette;
@ -1685,10 +1685,10 @@ NtGdiExtTextOutW(
if ((fuOptions & ETO_OPAQUE) && lprc)
{
DestRect.left = SpecifiedDestRect.left + dc->w.DCOrgX;
DestRect.top = SpecifiedDestRect.top + dc->w.DCOrgY;
DestRect.right = SpecifiedDestRect.right + dc->w.DCOrgX;
DestRect.bottom = SpecifiedDestRect.bottom + dc->w.DCOrgY;
DestRect.left = SpecifiedDestRect.left + dc->ptlDCOrig.x;
DestRect.top = SpecifiedDestRect.top + dc->ptlDCOrig.y;
DestRect.right = SpecifiedDestRect.right + dc->ptlDCOrig.x;
DestRect.bottom = SpecifiedDestRect.bottom + dc->ptlDCOrig.y;
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
IntEngBitBlt(
&BitmapObj->SurfObj,
@ -1956,12 +1956,6 @@ NtGdiExtTextOutW(
DestRect.top = TextTop + yoff - realglyph2->top;
DestRect.bottom = DestRect.top + realglyph2->bitmap.rows;
// DbgPrint("lrtb %d %d %d %d\n", DestRect.left, DestRect.right,
// DestRect.top, DestRect.bottom);
// DbgPrint("specified lrtb %d %d %d %d\n", SpecifiedDestRect.left, SpecifiedDestRect.right,
// SpecifiedDestRect.top, SpecifiedDestRect.bottom);
// DbgPrint ("dc->w.DCOrgX: %d\n", dc->w.DCOrgX);
bitSize.cx = realglyph2->bitmap.width;
bitSize.cy = realglyph2->bitmap.rows;
MaskRect.right = realglyph2->bitmap.width;
@ -2005,12 +1999,12 @@ NtGdiExtTextOutW(
if (lprc &&
(fuOptions & ETO_CLIPPED) &&
DestRect.right >= SpecifiedDestRect.right + dc->w.DCOrgX)
DestRect.right >= SpecifiedDestRect.right + dc->ptlDCOrig.x)
{
// We do the check '>=' instead of '>' to possibly save an iteration
// through this loop, since it's breaking after the drawing is done,
// and x is always incremented.
DestRect.right = SpecifiedDestRect.right + dc->w.DCOrgX;
DestRect.right = SpecifiedDestRect.right + dc->ptlDCOrig.x;
DoBreak = TRUE;
}