Fixed (finally) ScrollConsoleScreenBuffer implementation.

This commit is contained in:
Eric Pouech 2004-09-13 18:04:50 +00:00 committed by Alexandre Julliard
parent bf5539bbe6
commit e780ea5230
2 changed files with 11 additions and 9 deletions

View File

@ -2289,6 +2289,7 @@ BOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, LPSMALL_RECT lpScr
SMALL_RECT clip;
CONSOLE_SCREEN_BUFFER_INFO csbi;
BOOL inside;
COORD src;
if (lpClipRect)
TRACE("(%p,(%d,%d-%d,%d),(%d,%d-%d,%d),%d-%d,%p)\n", hConsoleOutput,
@ -2306,6 +2307,9 @@ BOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, LPSMALL_RECT lpScr
if (!GetConsoleScreenBufferInfo(hConsoleOutput, &csbi))
return FALSE;
src.X = lpScrollRect->Left;
src.Y = lpScrollRect->Top;
/* step 1: get dst rect */
dst.Left = dwDestOrigin.X;
dst.Top = dwDestOrigin.Y;
@ -2330,8 +2334,8 @@ BOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, LPSMALL_RECT lpScr
if (clip.Left > clip.Right || clip.Top > clip.Bottom) return FALSE;
/* step 2b: clip dst rect */
if (dst.Left < clip.Left ) dst.Left = clip.Left;
if (dst.Top < clip.Top ) dst.Top = clip.Top;
if (dst.Left < clip.Left ) {src.X += clip.Left - dst.Left; dst.Left = clip.Left;}
if (dst.Top < clip.Top ) {src.Y += clip.Top - dst.Top; dst.Top = clip.Top;}
if (dst.Right > clip.Right ) dst.Right = clip.Right;
if (dst.Bottom > clip.Bottom) dst.Bottom = clip.Bottom;
@ -2339,8 +2343,8 @@ BOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, LPSMALL_RECT lpScr
SERVER_START_REQ(move_console_output)
{
req->handle = console_handle_unmap(hConsoleOutput);
req->x_src = lpScrollRect->Left;
req->y_src = lpScrollRect->Top;
req->x_src = src.X;
req->y_src = src.Y;
req->x_dst = dst.Left;
req->y_dst = dst.Top;
req->w = dst.Right - dst.Left + 1;

View File

@ -369,12 +369,12 @@ static void testScroll(HANDLE hCon, COORD sbSize)
#define W 11
#define H 7
/* no clipping, src & dst rect don't overlap */
resetContent(hCon, sbSize, TRUE);
#define IN_SRECT(r,c) ((r).Left <= (c).X && (c).X <= (r).Right && (r).Top <= (c).Y && (c).Y <= (r).Bottom)
#define IN_SRECT2(r,d,c) ((d).X <= (c).X && (c).X <= (d).X + (r).Right - (r).Left && (d).Y <= (c).Y && (c).Y <= (d).Y + (r).Bottom - (r).Top)
/* no clipping, src & dst rect don't overlap */
resetContent(hCon, sbSize, TRUE);
scroll.Left = 0;
scroll.Right = W - 1;
scroll.Top = 0;
@ -476,7 +476,6 @@ static void testScroll(HANDLE hCon, COORD sbSize)
}
}
#if 0
/* clipping, src & dst rect do overlap */
resetContent(hCon, sbSize, TRUE);
@ -511,7 +510,6 @@ static void testScroll(HANDLE hCon, COORD sbSize)
else okCHAR(hCon, c, CONTENT(c), DEFAULT_ATTRIB);
}
}
#endif
}
static int mch_count;