mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-06 11:27:27 +01:00
* fixed AssignVideoBuf
* fixed some indentions * fixed possible sign problems git-svn-id: trunk@3595 -
This commit is contained in:
parent
ab6b1551df
commit
d36ac1283e
@ -115,11 +115,12 @@ Procedure AssignVideoBuf (OldCols, OldRows : Word);
|
||||
|
||||
var NewVideoBuf,NewOldVideoBuf:PVideoBuf;
|
||||
old_rowstart,new_rowstart:word;
|
||||
NewVideoBufSize : longint;
|
||||
|
||||
begin
|
||||
VideoBufSize:=ScreenWidth*ScreenHeight*sizeof(TVideoCell);
|
||||
GetMem(NewVideoBuf,VideoBufSize);
|
||||
GetMem(NewOldVideoBuf,VideoBufSize);
|
||||
NewVideoBufSize:=ScreenWidth*ScreenHeight*sizeof(TVideoCell);
|
||||
GetMem(NewVideoBuf,NewVideoBufSize);
|
||||
GetMem(NewOldVideoBuf,NewVideoBufSize);
|
||||
{Move contents of old videobuffers to new if there are any.}
|
||||
if VideoBuf<>nil then
|
||||
begin
|
||||
@ -129,15 +130,18 @@ begin
|
||||
OldRows:=ScreenHeight;
|
||||
old_rowstart:=0;
|
||||
new_rowstart:=0;
|
||||
repeat
|
||||
move(VideoBuf^[old_rowstart],NewVideoBuf^[new_rowstart],OldCols*sizeof(TVideoCell));
|
||||
move(OldVideoBuf^[old_rowstart],NewOldVideoBuf^[new_rowstart],OldCols*sizeof(TVideoCell));
|
||||
inc(old_rowstart,OldCols);
|
||||
inc(new_rowstart,ScreenWidth);
|
||||
dec(OldRows);
|
||||
until OldRows=0;
|
||||
while oldrows>0 do
|
||||
begin
|
||||
move(VideoBuf^[old_rowstart],NewVideoBuf^[new_rowstart],OldCols*sizeof(TVideoCell));
|
||||
move(OldVideoBuf^[old_rowstart],NewOldVideoBuf^[new_rowstart],OldCols*sizeof(TVideoCell));
|
||||
inc(old_rowstart,OldCols);
|
||||
inc(new_rowstart,ScreenWidth);
|
||||
dec(OldRows);
|
||||
end;
|
||||
end;
|
||||
FreeVideoBuf;
|
||||
{ FreeVideoBuf sets VideoBufSize to 0 }
|
||||
VideoBufSize:=NewVideoBufSize;
|
||||
VideoBuf:=NewVideoBuf;
|
||||
OldVideoBuf:=NewOldVideoBuf;
|
||||
end;
|
||||
@ -246,20 +250,20 @@ begin
|
||||
exit;
|
||||
If VideoInitialized then
|
||||
begin
|
||||
OldC:=ScreenWidth;
|
||||
OldR:=ScreenHeight;
|
||||
If Assigned(CurrentVideoDriver.SetVideoMode) then
|
||||
SetVideoMode:=CurrentVideoDriver.SetVideoMode(Mode)
|
||||
else
|
||||
SetVideoMode:=False;
|
||||
// Assign buffer
|
||||
If SetVideoMode then
|
||||
AssignVideoBuf(OldC,Oldr);
|
||||
OldC:=ScreenWidth;
|
||||
OldR:=ScreenHeight;
|
||||
If Assigned(CurrentVideoDriver.SetVideoMode) then
|
||||
SetVideoMode:=CurrentVideoDriver.SetVideoMode(Mode)
|
||||
else
|
||||
SetVideoMode:=False;
|
||||
// Assign buffer
|
||||
If SetVideoMode then
|
||||
AssignVideoBuf(OldC,Oldr);
|
||||
end
|
||||
else
|
||||
begin
|
||||
NextVideoMode:=Mode;
|
||||
NextVideoModeSet:=true;
|
||||
NextVideoMode:=Mode;
|
||||
NextVideoModeSet:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -161,8 +161,8 @@ begin
|
||||
begin
|
||||
Top := 0;
|
||||
Left := 0;
|
||||
(* First, we need to make sure we reach the minimum window size *)
|
||||
(* to always fit in the new buffer after changing buffer size. *)
|
||||
{ First, we need to make sure we reach the minimum window size
|
||||
to always fit in the new buffer after changing buffer size. }
|
||||
Right := MI.srWindow.Right - MI.srWindow.Left;
|
||||
if VideoMode.Col <= Right then
|
||||
Right := Pred (VideoMode.Col);
|
||||
@ -171,24 +171,24 @@ begin
|
||||
Bottom := Pred (VideoMode.Row);
|
||||
end;
|
||||
if SetConsoleWindowInfo (cardinal (TextRec (Output).Handle), true, SR) then
|
||||
if SetConsoleScreenBufferSize (TextRec (Output).Handle, C) then
|
||||
if SetConsoleScreenBufferSize (TextRec (Output).Handle, C) then
|
||||
begin
|
||||
with SR do
|
||||
begin
|
||||
(* Now, we can resize the window to the final size. *)
|
||||
{ Now, we can resize the window to the final size. }
|
||||
Right := Pred (VideoMode.Col);
|
||||
Bottom := Pred (VideoMode.Row);
|
||||
end;
|
||||
if SetConsoleWindowInfo (cardinal (TextRec (Output).Handle), true, SR) then
|
||||
begin
|
||||
SysVideoModeSelector := true;
|
||||
SetCursorType (LastCursorType);
|
||||
ClearScreen;
|
||||
end
|
||||
else
|
||||
begin
|
||||
SysVideoModeSelector := false;
|
||||
SetConsoleScreenBufferSize (TextRec (Output).Handle, MI.dwSize);
|
||||
begin
|
||||
SysVideoModeSelector := true;
|
||||
SetCursorType (LastCursorType);
|
||||
ClearScreen;
|
||||
end
|
||||
else
|
||||
begin
|
||||
SysVideoModeSelector := false;
|
||||
SetConsoleScreenBufferSize (TextRec (Output).Handle, MI.dwSize);
|
||||
SetConsoleWindowInfo (cardinal (TextRec (Output).Handle), true, MI.srWindow);
|
||||
SetCursorType (LastCursorType);
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user