Commit 62f824f7 authored by Alexandre Julliard's avatar Alexandre Julliard

Avoid calling the *Rect USER functions from inside GDI.

Moved a few USER functions to a more appropriate location.
parent fe08568a
......@@ -845,8 +845,14 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
if (widthDst < 0) xDst += widthDst;
if (heightSrc < 0) ySrc += heightSrc;
if (heightDst < 0) yDst += heightDst;
OffsetRect( &rectSrc, -xSrc, -ySrc );
OffsetRect( &rectDst, -xDst, -yDst );
rectSrc.left -= xSrc;
rectSrc.right -= xSrc;
rectSrc.top -= ySrc;
rectSrc.bottom -= ySrc;
rectDst.left -= xDst;
rectDst.right -= xDst;
rectDst.top -= yDst;
rectDst.bottom -= yDst;
/* FIXME: avoid BadMatch errors */
imageSrc = XGetImage( display, physDevSrc->drawable,
......@@ -1056,7 +1062,10 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst,
/* Get the destination visible rectangle */
SetRect( &rect, xDst, yDst, xDst + widthDst, yDst + heightDst );
rect.left = xDst;
rect.top = yDst;
rect.right = xDst + widthDst;
rect.bottom = yDst + heightDst;
if (widthDst < 0) SWAP_INT32( &rect.left, &rect.right );
if (heightDst < 0) SWAP_INT32( &rect.top, &rect.bottom );
GetRgnBox( dcDst->w.hGCClipRgn, &clipRect );
......@@ -1065,7 +1074,10 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst,
/* Get the source visible rectangle */
if (!dcSrc) return TRUE;
SetRect( &rect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc );
rect.left = xSrc;
rect.top = ySrc;
rect.right = xSrc + widthSrc;
rect.bottom = ySrc + heightSrc;
if (widthSrc < 0) SWAP_INT32( &rect.left, &rect.right );
if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom );
/* Apparently the clipping and visible regions are only for output,
......@@ -1077,10 +1089,16 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst,
if ((widthSrc == widthDst) && (heightSrc == heightDst)) /* no stretching */
{
OffsetRect( visRectSrc, xDst - xSrc, yDst - ySrc );
visRectSrc->left += xDst - xSrc;
visRectSrc->right += xDst - xSrc;
visRectSrc->top += yDst - ySrc;
visRectSrc->bottom += yDst - ySrc;
if (!IntersectRect( &rect, visRectSrc, visRectDst )) return FALSE;
*visRectSrc = *visRectDst = rect;
OffsetRect( visRectSrc, xSrc - xDst, ySrc - yDst );
visRectSrc->left += xSrc - xDst;
visRectSrc->right += xSrc - xDst;
visRectSrc->top += ySrc - yDst;
visRectSrc->bottom += ySrc - yDst;
}
else /* stretching */
{
......@@ -1091,7 +1109,12 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst,
rect.bottom = yDst + ((visRectSrc->bottom - ySrc)*heightDst)/heightSrc;
if (rect.left > rect.right) SWAP_INT32( &rect.left, &rect.right );
if (rect.top > rect.bottom) SWAP_INT32( &rect.top, &rect.bottom );
InflateRect( &rect, 1, 1 ); /* Avoid rounding errors */
/* Avoid rounding errors */
rect.left--;
rect.top--;
rect.right++;
rect.bottom++;
if (!IntersectRect( visRectDst, &rect, visRectDst )) return FALSE;
/* Map destination rectangle back to source coordinates */
......@@ -1102,7 +1125,12 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst,
rect.bottom = ySrc + ((visRectDst->bottom - yDst)*heightSrc)/heightDst;
if (rect.left > rect.right) SWAP_INT32( &rect.left, &rect.right );
if (rect.top > rect.bottom) SWAP_INT32( &rect.top, &rect.bottom );
InflateRect( &rect, 1, 1 ); /* Avoid rounding errors */
/* Avoid rounding errors */
rect.left--;
rect.top--;
rect.right++;
rect.bottom++;
if (!IntersectRect( visRectSrc, &rect, visRectSrc )) return FALSE;
}
return TRUE;
......
......@@ -25,6 +25,8 @@
#include "wingdi.h"
#include "winuser.h"
#include "winnt.h"
#include "callback.h"
#include "msdos.h"
#include "file.h"
#include "miscemu.h"
......@@ -357,11 +359,11 @@ void DOSVM_Wait( int read_pipe, HANDLE hObject )
do {
/* check for messages (waste time before the response check below) */
while (PeekMessageA(&msg,0,0,0,PM_REMOVE|PM_NOYIELD)) {
while (Callout.PeekMessageA(&msg,0,0,0,PM_REMOVE|PM_NOYIELD)) {
/* got a message */
DOSVM_ProcessMessage(lpDosTask,&msg);
/* we don't need a TranslateMessage here */
DispatchMessageA(&msg);
Callout.DispatchMessageA(&msg);
got_msg = TRUE;
}
if (read_pipe == -1) {
......
......@@ -21,7 +21,6 @@ C_SRCS = \
port.c \
printdrv.c \
registry.c \
spy.c \
system.c \
toolhelp.c \
tweak.c \
......
......@@ -10,7 +10,6 @@ C_SRCS = \
brush.c \
clipping.c \
color.c \
cursoricon.c \
dc.c \
dcvalues.c \
dib.c \
......
......@@ -440,7 +440,10 @@ BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect )
/* copy rectangle to avoid overwriting by LPtoDP */
tmpRect = *rect;
LPtoDP16( hdc, (LPPOINT16)&tmpRect, 2 );
OffsetRect16( &tmpRect, dc->w.DCOrgX, dc->w.DCOrgY );
tmpRect.left += dc->w.DCOrgX;
tmpRect.right += dc->w.DCOrgX;
tmpRect.top += dc->w.DCOrgY;
tmpRect.bottom += dc->w.DCOrgY;
return RectInRegion16( dc->w.hGCClipRgn, &tmpRect );
}
......@@ -465,7 +468,10 @@ INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR;
ret = GetRgnBox16( dc->w.hGCClipRgn, rect );
OffsetRect16( rect, -dc->w.DCOrgX, -dc->w.DCOrgY );
rect->left -= dc->w.DCOrgX;
rect->right -= dc->w.DCOrgX;
rect->top -= dc->w.DCOrgY;
rect->bottom -= dc->w.DCOrgY;
DPtoLP16( hdc, (LPPOINT16)rect, 2 );
TRACE("%d,%d-%d,%d\n", rect->left,rect->top,rect->right,rect->bottom );
return ret;
......@@ -481,7 +487,10 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR;
ret = GetRgnBox( dc->w.hGCClipRgn, rect );
OffsetRect( rect, -dc->w.DCOrgX, -dc->w.DCOrgY );
rect->left -= dc->w.DCOrgX;
rect->right -= dc->w.DCOrgX;
rect->top -= dc->w.DCOrgY;
rect->bottom -= dc->w.DCOrgY;
DPtoLP( hdc, (LPPOINT)rect, 2 );
return ret;
}
......
......@@ -1037,17 +1037,26 @@ BOOL WINAPI EqualRgn( HRGN hrgn1, HRGN hrgn2 )
{
int i;
if ( obj1->rgn->numRects != obj2->rgn->numRects ) goto done;
if ( obj1->rgn->numRects == 0 )
{
ret = TRUE;
if ( obj1->rgn->numRects != obj2->rgn->numRects ) ret = FALSE;
else if ( obj1->rgn->numRects == 0 ) ret = TRUE;
else if ( !EqualRect(&obj1->rgn->extents, &obj2->rgn->extents) )
ret = FALSE;
else for( i = 0; i < obj1->rgn->numRects; i++ ) {
if (!EqualRect(obj1->rgn->rects + i, obj2->rgn->rects + i)) {
ret = FALSE;
break;
goto done;
}
if (obj1->rgn->extents.left != obj2->rgn->extents.left) goto done;
if (obj1->rgn->extents.right != obj2->rgn->extents.right) goto done;
if (obj1->rgn->extents.top != obj2->rgn->extents.top) goto done;
if (obj1->rgn->extents.bottom != obj2->rgn->extents.bottom) goto done;
for( i = 0; i < obj1->rgn->numRects; i++ )
{
if (obj1->rgn->rects[i].left != obj2->rgn->rects[i].left) goto done;
if (obj1->rgn->rects[i].right != obj2->rgn->rects[i].right) goto done;
if (obj1->rgn->rects[i].top != obj2->rgn->rects[i].top) goto done;
if (obj1->rgn->rects[i].bottom != obj2->rgn->rects[i].bottom) goto done;
}
ret = TRUE;
done:
GDI_HEAP_UNLOCK(hrgn2);
}
GDI_HEAP_UNLOCK(hrgn1);
......@@ -1067,7 +1076,7 @@ static void REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
region.numRects = 1;
region.size = 1;
region.type = SIMPLEREGION;
CopyRect(&(region.extents), rect);
region.extents = *rect;
REGION_UnionRegion(rgn, rgn, &region);
return;
}
......@@ -2964,7 +2973,10 @@ static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINER
xrect[i].top = rgnSrc->rects[i].top + off->y;
xrect[i].bottom = rgnSrc->rects[i].bottom + off->y;
}
OffsetRect( &rgnDst->extents, off->x, off->y );
rgnDst->extents.left += off->x;
rgnDst->extents.right += off->x;
rgnDst->extents.top += off->y;
rgnDst->extents.bottom += off->y;
}
else
memcpy( xrect, rgnSrc->rects, rgnDst->numRects * sizeof(RECT));
......@@ -2972,7 +2984,9 @@ static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINER
} else
return FALSE;
}
else if( IsRectEmpty(rect) || !EXTENTCHECK(rect, &rgnSrc->extents) )
else if ((rect->left >= rect->right) ||
(rect->top >= rect->bottom) ||
!EXTENTCHECK(rect, &rgnSrc->extents))
{
empty:
if( !rgnDst->rects )
......
......@@ -453,7 +453,6 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb,
HDC memdc = CreateCompatibleDC(hdc);
int slen = len;
BOOL retval = TRUE;
RECT r;
COLORREF fg, bg;
if(!hdc) return FALSE;
......@@ -481,13 +480,11 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb,
if(cy == 0) cy = s.cy;
}
r.left = r.top = 0;
r.right = cx;
r.bottom = cy;
hbm = CreateBitmap(cx, cy, 1, 1, NULL);
hbmsave = (HBITMAP)SelectObject(memdc, hbm);
FillRect(memdc, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
hbsave = SelectObject( memdc, GetStockObject(BLACK_BRUSH) );
PatBlt( memdc, 0, 0, cx, cy, PATCOPY );
SelectObject( memdc, hbsave );
SetTextColor(memdc, RGB(255, 255, 255));
SetBkColor(memdc, RGB(0, 0, 0));
hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
......@@ -630,7 +627,10 @@ LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCSTR lpstr,
if (fDisplayText)
{
RECT r;
SetRect( &r, x, y, tabPos, y+HIWORD(extent) );
r.left = x;
r.top = y;
r.right = tabPos;
r.bottom = y + HIWORD(extent);
ExtTextOutA( hdc, x, y,
GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
&r, lpstr, i, NULL );
......
......@@ -9,6 +9,7 @@ C_SRCS = \
caret.c \
class.c \
clipboard.c \
cursoricon.c \
dce.c \
defdlg.c \
defwnd.c \
......@@ -29,8 +30,10 @@ C_SRCS = \
queue.c \
rect.c \
scroll.c \
spy.c \
syscolor.c \
sysmetrics.c \
sysparams.c \
timer.c \
user.c \
win.c \
......
......@@ -2493,23 +2493,6 @@ WORD WINAPI RegisterWindowMessageW( LPCWSTR str )
/***********************************************************************
* GetTickCount (USER.13) (KERNEL32.299) System Time
* Returns the number of milliseconds, modulo 2^32, since the start
* of the current session.
*
* CONFORMANCE
*
* ECMA-234, Win32
*/
DWORD WINAPI GetTickCount(void)
{
struct timeval t;
gettimeofday( &t, NULL );
return ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - MSG_WineStartTicks;
}
/***********************************************************************
* GetCurrentTime16 (USER.15)
*
* (effectively identical to GetTickCount)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment