+ add VESA compatible mode in 16 and 256 colors

This commit is contained in:
pierre 1999-12-08 09:09:34 +00:00
parent 087d0f86d3
commit 1fe7793288
2 changed files with 143 additions and 3 deletions

View File

@ -40,6 +40,9 @@ var
graphdrawing : tcriticalsection;
{$ifdef DEBUG_WM_PAINT}
graphdebug : text;
const
wm_paint_count : longint = 0;
var
{$endif DEBUG_WM_PAINT}
bitmapdc : hdc;
oldbitmap : hgdiobj;
@ -65,6 +68,8 @@ function GetPaletteEntry(r,g,b : word) : word;
begin
index:=i;
dist:=currentdist;
if dist=0 then
break;
end;
end;
GetPaletteEntry:=index;
@ -342,6 +347,9 @@ begin
WindowProc:=charmessagehandler(window,amessage,wparam,lparam);
wm_paint:
begin
{$ifdef DEBUG_WM_PAINT}
inc(wm_paint_count);
{$endif DEBUG_WM_PAINT}
if not GetUpdateRect(Window,@r,false) then
exit;
EnterCriticalSection(graphdrawing);
@ -534,10 +542,13 @@ function queryadapterinfo : pmodeinfo;
var
mode: TModeInfo;
ScreenWidth,ScreenHeight : longint;
begin
SaveVideoState:=savestate;
RestoreVideoState:=restorestate;
ScreenWidth:=GetSystemMetrics(SM_CXSCREEN);
ScreenHeight:=GetSystemMetrics(SM_CYSCREEN);
QueryAdapterInfo := ModeList;
{ If the mode listing already exists... }
{ simply return it, without changing }
@ -611,11 +622,106 @@ function queryadapterinfo : pmodeinfo;
mode.XAspect := 10000;
mode.YAspect := 10000;
AddMode(mode);
InitMode(mode);
mode.DriverNumber:= VESA;
mode.HardwarePages:= 0;
mode.ModeNumber:=m640x400x256;
mode.ModeName:='640 x 400 x 256 Win32GUI';
mode.MaxColor := 256;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 639;
mode.MaxY := 399;
mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
mode.HLine := {$ifdef fpc}@{$endif}HLine16Win32GUI;
mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetRGBPaletteWin32GUI;
mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetRGBPaletteWin32GUI;
mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisualWin32GUI;
mode.SetActivePage := {$ifdef fpc}@{$endif}SetActiveWin32GUI;
mode.InitMode := {$ifdef fpc}@{$endif}InitWin32GUI16colors;
mode.XAspect := 10000;
mode.YAspect := 10000;
AddMode(mode);
InitMode(mode);
mode.DriverNumber:= VESA;
mode.HardwarePages:= 0;
mode.ModeNumber:=m640x480x256;
mode.ModeName:='640 x 480 x 256 Win32GUI';
mode.MaxColor := 256;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 639;
mode.MaxY := 479;
mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
mode.HLine := {$ifdef fpc}@{$endif}HLine16Win32GUI;
mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetRGBPaletteWin32GUI;
mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetRGBPaletteWin32GUI;
mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisualWin32GUI;
mode.SetActivePage := {$ifdef fpc}@{$endif}SetActiveWin32GUI;
mode.InitMode := {$ifdef fpc}@{$endif}InitWin32GUI16colors;
mode.XAspect := 10000;
mode.YAspect := 10000;
AddMode(mode);
{ add 800x600 only if screen is large enough }
If (ScreenWidth>=800) and (ScreenHeight>=600) then
begin
InitMode(mode);
mode.DriverNumber:= VESA;
mode.HardwarePages:= 0;
mode.ModeNumber:=m800x600x16;
mode.ModeName:='800 x 600 x 16 Win32GUI';
mode.MaxColor := 16;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 799;
mode.MaxY := 599;
mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
mode.HLine := {$ifdef fpc}@{$endif}HLine16Win32GUI;
mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetRGBPaletteWin32GUI;
mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetRGBPaletteWin32GUI;
mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisualWin32GUI;
mode.SetActivePage := {$ifdef fpc}@{$endif}SetActiveWin32GUI;
mode.InitMode := {$ifdef fpc}@{$endif}InitWin32GUI16colors;
mode.XAspect := 10000;
mode.YAspect := 10000;
AddMode(mode);
InitMode(mode);
mode.DriverNumber:= VESA;
mode.HardwarePages:= 0;
mode.ModeNumber:=m800x600x256;
mode.ModeName:='800 x 600 x 256 Win32GUI';
mode.MaxColor := 256;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 799;
mode.MaxY := 599;
mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
mode.HLine := {$ifdef fpc}@{$endif}HLine16Win32GUI;
mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetRGBPaletteWin32GUI;
mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetRGBPaletteWin32GUI;
mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisualWin32GUI;
mode.SetActivePage := {$ifdef fpc}@{$endif}SetActiveWin32GUI;
mode.InitMode := {$ifdef fpc}@{$endif}InitWin32GUI16colors;
mode.XAspect := 10000;
mode.YAspect := 10000;
AddMode(mode);
end;
end;
{
$Log$
Revision 1.4 1999-12-02 00:24:36 pierre
Revision 1.5 1999-12-08 09:09:34 pierre
+ add VESA compatible mode in 16 and 256 colors
Revision 1.4 1999/12/02 00:24:36 pierre
* local var col was undefined
+ 640x200 and 640x350 modes added (VGALo and VGAMed)
* WM_PAINT better handled (only requested region written)

View File

@ -27,11 +27,45 @@
const
{ predefined window style }
graphwindowstyle : DWord = cs_hRedraw or cs_vRedraw;
CONST
m640x200x16 = VGALo;
m640x400x16 = VGAMed;
m640x480x16 = VGAHi;
{ VESA Specific video modes. }
m320x200x32k = $10D;
m320x200x64k = $10E;
m640x400x256 = $100;
m640x480x256 = $101;
m640x480x32k = $110;
m640x480x64k = $111;
m800x600x16 = $102;
m800x600x256 = $103;
m800x600x32k = $113;
m800x600x64k = $114;
m1024x768x16 = $104;
m1024x768x256 = $105;
m1024x768x32k = $116;
m1024x768x64k = $117;
m1280x1024x16 = $106;
m1280x1024x256 = $107;
m1280x1024x32k = $119;
m1280x1024x64k = $11A;
{
$Log$
Revision 1.2 1999-11-29 22:03:39 florian
Revision 1.3 1999-12-08 09:09:34 pierre
+ add VESA compatible mode in 16 and 256 colors
Revision 1.2 1999/11/29 22:03:39 florian
* first implementation of winmouse unit
Revision 1.1 1999/11/08 15:01:39 peter