Fixed aliasing problems (do not use (POINT*)&rect constructs).
This commit is contained in:
parent
5163752e8e
commit
dba95f28f5
@ -194,14 +194,14 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
|
|||||||
ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
|
ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RECT rect;
|
POINT pt[2];
|
||||||
rect.left = left;
|
|
||||||
rect.top = top;
|
|
||||||
rect.right = right;
|
|
||||||
rect.bottom = bottom;
|
|
||||||
LPtoDP( hdc, (POINT*)&rect, 2 );
|
|
||||||
|
|
||||||
if (!(newRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR;
|
pt[0].x = left;
|
||||||
|
pt[0].y = top;
|
||||||
|
pt[1].x = right;
|
||||||
|
pt[1].y = bottom;
|
||||||
|
LPtoDP( hdc, pt, 2 );
|
||||||
|
if (!(newRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!dc->hClipRgn)
|
if (!dc->hClipRgn)
|
||||||
@ -234,24 +234,25 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom
|
|||||||
ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
|
ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RECT rect;
|
POINT pt[2];
|
||||||
|
|
||||||
rect.left = left;
|
pt[0].x = left;
|
||||||
rect.top = top;
|
pt[0].y = top;
|
||||||
rect.right = right;
|
pt[1].x = right;
|
||||||
rect.bottom = bottom;
|
pt[1].y = bottom;
|
||||||
LPtoDP( hdc, (POINT*)&rect, 2 );
|
|
||||||
|
LPtoDP( hdc, pt, 2 );
|
||||||
|
|
||||||
if (!dc->hClipRgn)
|
if (!dc->hClipRgn)
|
||||||
{
|
{
|
||||||
dc->hClipRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom );
|
dc->hClipRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y );
|
||||||
ret = SIMPLEREGION;
|
ret = SIMPLEREGION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HRGN newRgn;
|
HRGN newRgn;
|
||||||
|
|
||||||
if (!(newRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom))) ret = ERROR;
|
if (!(newRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = CombineRgn( dc->hClipRgn, dc->hClipRgn, newRgn, RGN_AND );
|
ret = CombineRgn( dc->hClipRgn, dc->hClipRgn, newRgn, RGN_AND );
|
||||||
@ -273,19 +274,20 @@ INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top,
|
|||||||
{
|
{
|
||||||
HRGN tempRgn;
|
HRGN tempRgn;
|
||||||
INT16 ret;
|
INT16 ret;
|
||||||
RECT rect;
|
POINT pt[2];
|
||||||
DC * dc = DC_GetDCUpdate( hdc );
|
DC * dc = DC_GetDCUpdate( hdc );
|
||||||
if (!dc) return ERROR;
|
if (!dc) return ERROR;
|
||||||
|
|
||||||
rect.left = left;
|
pt[0].x = left;
|
||||||
rect.top = top;
|
pt[0].y = top;
|
||||||
rect.right = right;
|
pt[1].x = right;
|
||||||
rect.bottom = bottom;
|
pt[1].y = bottom;
|
||||||
LPtoDP( hdc, (POINT*)&rect, 2 );
|
|
||||||
|
|
||||||
TRACE("%04x %d,%d - %d,%d\n", hdc, rect.left, rect.top, rect.right, rect.bottom );
|
LPtoDP( hdc, pt, 2 );
|
||||||
|
|
||||||
if (!(tempRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR;
|
TRACE("%04x %ld,%ld - %ld,%ld\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
|
||||||
|
if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_DIFF );
|
ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_DIFF );
|
||||||
@ -305,19 +307,21 @@ INT16 WINAPI IntersectVisRect16( HDC16 hdc, INT16 left, INT16 top,
|
|||||||
{
|
{
|
||||||
HRGN tempRgn;
|
HRGN tempRgn;
|
||||||
INT16 ret;
|
INT16 ret;
|
||||||
RECT rect;
|
POINT pt[2];
|
||||||
DC * dc = DC_GetDCUpdate( hdc );
|
DC * dc = DC_GetDCUpdate( hdc );
|
||||||
if (!dc) return ERROR;
|
if (!dc) return ERROR;
|
||||||
|
|
||||||
rect.left = left;
|
pt[0].x = left;
|
||||||
rect.top = top;
|
pt[0].y = top;
|
||||||
rect.right = right;
|
pt[1].x = right;
|
||||||
rect.bottom = bottom;
|
pt[1].y = bottom;
|
||||||
LPtoDP( hdc, (POINT*)&rect, 2 );
|
|
||||||
|
|
||||||
TRACE("%04x %d,%d - %d,%d\n", hdc, rect.left, rect.top, rect.right, rect.bottom );
|
LPtoDP( hdc, pt, 2 );
|
||||||
|
|
||||||
if (!(tempRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR;
|
TRACE("%04x %ld,%ld - %ld,%ld\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
|
||||||
|
|
||||||
|
if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_AND );
|
ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_AND );
|
||||||
@ -359,16 +363,24 @@ BOOL WINAPI PtVisible( HDC hdc, INT x, INT y )
|
|||||||
BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
|
BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
RECT tmpRect;
|
|
||||||
DC *dc = DC_GetDCUpdate( hdc );
|
DC *dc = DC_GetDCUpdate( hdc );
|
||||||
if (!dc) return FALSE;
|
if (!dc) return FALSE;
|
||||||
TRACE("%04x %d,%dx%d,%d\n",
|
TRACE("%04x %d,%dx%d,%d\n",
|
||||||
hdc, rect->left, rect->top, rect->right, rect->bottom );
|
hdc, rect->left, rect->top, rect->right, rect->bottom );
|
||||||
if (dc->hGCClipRgn)
|
if (dc->hGCClipRgn)
|
||||||
{
|
{
|
||||||
/* copy rectangle to avoid overwriting by LPtoDP */
|
POINT pt[2];
|
||||||
tmpRect = *rect;
|
RECT tmpRect;
|
||||||
LPtoDP( hdc, (LPPOINT)&tmpRect, 2 );
|
|
||||||
|
pt[0].x = rect->left;
|
||||||
|
pt[0].y = rect->top;
|
||||||
|
pt[1].x = rect->right;
|
||||||
|
pt[1].y = rect->bottom;
|
||||||
|
LPtoDP( hdc, pt, 2 );
|
||||||
|
tmpRect.left = pt[0].x;
|
||||||
|
tmpRect.top = pt[0].y;
|
||||||
|
tmpRect.right = pt[1].x;
|
||||||
|
tmpRect.bottom = pt[1].y;
|
||||||
ret = RectInRegion( dc->hGCClipRgn, &tmpRect );
|
ret = RectInRegion( dc->hGCClipRgn, &tmpRect );
|
||||||
}
|
}
|
||||||
GDI_ReleaseObj( hdc );
|
GDI_ReleaseObj( hdc );
|
||||||
|
@ -303,7 +303,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
RECT tmprc;
|
POINT pt[2];
|
||||||
|
|
||||||
TRACE(
|
TRACE(
|
||||||
"hdc = %08x, handletable = %p, record = %p, numHandles = %d\n",
|
"hdc = %08x, handletable = %p, record = %p, numHandles = %d\n",
|
||||||
@ -1566,11 +1566,12 @@ BOOL WINAPI PlayEnhMetaFileRecord(
|
|||||||
FIXME("type %d is unimplemented\n", type);
|
FIXME("type %d is unimplemented\n", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tmprc.left = tmprc.top = 0;
|
|
||||||
tmprc.right = tmprc.bottom = 1000;
|
pt[0].x = pt[0].y = 0;
|
||||||
LPtoDP(hdc, (POINT*)&tmprc, 2);
|
pt[1].x = pt[1].y = 1000;
|
||||||
TRACE("L:0,0 - 1000,1000 -> D:%d,%d - %d,%d\n", tmprc.left,
|
LPtoDP(hdc, pt, 2);
|
||||||
tmprc.top, tmprc.right, tmprc.bottom);
|
TRACE("L:0,0 - 1000,1000 -> D:%ld,%ld - %ld,%ld\n", pt[0].x, pt[0].y,
|
||||||
|
pt[1].x, pt[1].y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1612,7 +1613,7 @@ BOOL WINAPI EnumEnhMetaFile(
|
|||||||
HPEN hPen = (HPEN)NULL;
|
HPEN hPen = (HPEN)NULL;
|
||||||
HBRUSH hBrush = (HBRUSH)NULL;
|
HBRUSH hBrush = (HBRUSH)NULL;
|
||||||
HFONT hFont = (HFONT)NULL;
|
HFONT hFont = (HFONT)NULL;
|
||||||
RECT tmprc;
|
POINT pt[2];
|
||||||
|
|
||||||
if(!lpRect)
|
if(!lpRect)
|
||||||
{
|
{
|
||||||
@ -1671,11 +1672,11 @@ BOOL WINAPI EnumEnhMetaFile(
|
|||||||
hFont = GetCurrentObject(hdc, OBJ_FONT);
|
hFont = GetCurrentObject(hdc, OBJ_FONT);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmprc.left = tmprc.top = 0;
|
pt[0].x = pt[0].y = 0;
|
||||||
tmprc.right = tmprc.bottom = 1000;
|
pt[1].x = pt[1].y = 1000;
|
||||||
LPtoDP(hdc, (POINT*)&tmprc, 2);
|
LPtoDP(hdc, pt, 2);
|
||||||
TRACE("L:0,0-1000,1000 maps to D:%d,%d - %d,%d\n", tmprc.left, tmprc.top,
|
TRACE("L:0,0-1000,1000 maps to D:%ld,%ld - %ld,%ld\n", pt[0].x, pt[0].y,
|
||||||
tmprc.right, tmprc.bottom);
|
pt[1].x, pt[1].y);
|
||||||
TRACE("nSize = %ld, nBytes = %ld, nHandles = %d, nRecords = %ld, nPalEntries = %ld\n",
|
TRACE("nSize = %ld, nBytes = %ld, nHandles = %d, nRecords = %ld, nPalEntries = %ld\n",
|
||||||
emh->nSize, emh->nBytes, emh->nHandles, emh->nRecords, emh->nPalEntries);
|
emh->nSize, emh->nBytes, emh->nHandles, emh->nRecords, emh->nPalEntries);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user