mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 14:29:13 +02:00
+ add VESA compatible mode in 16 and 256 colors
This commit is contained in:
parent
087d0f86d3
commit
1fe7793288
@ -40,6 +40,9 @@ var
|
|||||||
graphdrawing : tcriticalsection;
|
graphdrawing : tcriticalsection;
|
||||||
{$ifdef DEBUG_WM_PAINT}
|
{$ifdef DEBUG_WM_PAINT}
|
||||||
graphdebug : text;
|
graphdebug : text;
|
||||||
|
const
|
||||||
|
wm_paint_count : longint = 0;
|
||||||
|
var
|
||||||
{$endif DEBUG_WM_PAINT}
|
{$endif DEBUG_WM_PAINT}
|
||||||
bitmapdc : hdc;
|
bitmapdc : hdc;
|
||||||
oldbitmap : hgdiobj;
|
oldbitmap : hgdiobj;
|
||||||
@ -65,6 +68,8 @@ function GetPaletteEntry(r,g,b : word) : word;
|
|||||||
begin
|
begin
|
||||||
index:=i;
|
index:=i;
|
||||||
dist:=currentdist;
|
dist:=currentdist;
|
||||||
|
if dist=0 then
|
||||||
|
break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
GetPaletteEntry:=index;
|
GetPaletteEntry:=index;
|
||||||
@ -342,6 +347,9 @@ begin
|
|||||||
WindowProc:=charmessagehandler(window,amessage,wparam,lparam);
|
WindowProc:=charmessagehandler(window,amessage,wparam,lparam);
|
||||||
wm_paint:
|
wm_paint:
|
||||||
begin
|
begin
|
||||||
|
{$ifdef DEBUG_WM_PAINT}
|
||||||
|
inc(wm_paint_count);
|
||||||
|
{$endif DEBUG_WM_PAINT}
|
||||||
if not GetUpdateRect(Window,@r,false) then
|
if not GetUpdateRect(Window,@r,false) then
|
||||||
exit;
|
exit;
|
||||||
EnterCriticalSection(graphdrawing);
|
EnterCriticalSection(graphdrawing);
|
||||||
@ -534,10 +542,13 @@ function queryadapterinfo : pmodeinfo;
|
|||||||
|
|
||||||
var
|
var
|
||||||
mode: TModeInfo;
|
mode: TModeInfo;
|
||||||
|
ScreenWidth,ScreenHeight : longint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SaveVideoState:=savestate;
|
SaveVideoState:=savestate;
|
||||||
RestoreVideoState:=restorestate;
|
RestoreVideoState:=restorestate;
|
||||||
|
ScreenWidth:=GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
ScreenHeight:=GetSystemMetrics(SM_CYSCREEN);
|
||||||
QueryAdapterInfo := ModeList;
|
QueryAdapterInfo := ModeList;
|
||||||
{ If the mode listing already exists... }
|
{ If the mode listing already exists... }
|
||||||
{ simply return it, without changing }
|
{ simply return it, without changing }
|
||||||
@ -611,11 +622,106 @@ function queryadapterinfo : pmodeinfo;
|
|||||||
mode.XAspect := 10000;
|
mode.XAspect := 10000;
|
||||||
mode.YAspect := 10000;
|
mode.YAspect := 10000;
|
||||||
AddMode(mode);
|
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;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* local var col was undefined
|
||||||
+ 640x200 and 640x350 modes added (VGALo and VGAMed)
|
+ 640x200 and 640x350 modes added (VGALo and VGAMed)
|
||||||
* WM_PAINT better handled (only requested region written)
|
* WM_PAINT better handled (only requested region written)
|
||||||
|
@ -28,10 +28,44 @@
|
|||||||
{ predefined window style }
|
{ predefined window style }
|
||||||
graphwindowstyle : DWord = cs_hRedraw or cs_vRedraw;
|
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$
|
$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
|
* first implementation of winmouse unit
|
||||||
|
|
||||||
Revision 1.1 1999/11/08 15:01:39 peter
|
Revision 1.1 1999/11/08 15:01:39 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user