Browse Source

--- Merging r40805 into '.':
U packages/graph/src/inc/graph.inc
U packages/graph/src/inc/fills.inc
U packages/graph/src/inc/graphh.inc
--- Recording mergeinfo for merge of r40805 into '.':
U .
--- Merging r40836 into '.':
G packages/graph/src/inc/graphh.inc
--- Recording mergeinfo for merge of r40836 into '.':
G .
--- Merging r40837 into '.':
U packages/graph/src/msdos/graph.pp
U packages/graph/src/go32v2/graph.pp
--- Recording mergeinfo for merge of r40837 into '.':
G .
--- Merging r40852 into '.':
U packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40852 into '.':
G .
--- Merging r40853 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40853 into '.':
G .
--- Merging r40861 into '.':
G packages/graph/src/go32v2/graph.pp
--- Recording mergeinfo for merge of r40861 into '.':
G .
--- Merging r40862 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40862 into '.':
G .
--- Merging r40863 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40863 into '.':
G .
--- Merging r40864 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
G packages/graph/src/inc/graph.inc
--- Recording mergeinfo for merge of r40864 into '.':
G .
--- Merging r40865 into '.':
U packages/graph/src/inc/modes.inc
--- Recording mergeinfo for merge of r40865 into '.':
G .
--- Merging r40866 into '.':
G packages/graph/src/inc/graph.inc
--- Recording mergeinfo for merge of r40866 into '.':
G .
--- Merging r40867 into '.':
G packages/graph/src/inc/fills.inc
--- Recording mergeinfo for merge of r40867 into '.':
G .
--- Merging r40868 into '.':
G packages/graph/src/inc/graph.inc
--- Recording mergeinfo for merge of r40868 into '.':
G .
--- Merging r40873 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40873 into '.':
G .
--- Merging r40875 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40875 into '.':
G .
--- Merging r40876 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40876 into '.':
G .
--- Merging r40877 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40877 into '.':
G .
--- Merging r40878 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40878 into '.':
G .
--- Merging r40879 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40879 into '.':
G .
--- Merging r40880 into '.':
G packages/graph/src/ptcgraph/ptcgraph.pp
--- Recording mergeinfo for merge of r40880 into '.':
G .
--- Merging r40887 into '.':
U packages/graph/src/go32v2/vesa.inc
--- Recording mergeinfo for merge of r40887 into '.':
G .
--- Merging r40888 into '.':
G packages/graph/src/go32v2/vesa.inc
G packages/graph/src/go32v2/graph.pp
--- Recording mergeinfo for merge of r40888 into '.':
G .
--- Merging r40889 into '.':
G packages/graph/src/go32v2/graph.pp
G packages/graph/src/go32v2/vesa.inc
--- Recording mergeinfo for merge of r40889 into '.':
G .
--- Merging r40890 into '.':
G packages/graph/src/msdos/graph.pp
U packages/graph/src/msdos/vesa.inc
--- Recording mergeinfo for merge of r40890 into '.':
G .
--- Merging r40891 into '.':
G packages/graph/src/msdos/vesa.inc
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40891 into '.':
G .
--- Merging r40892 into '.':
G packages/graph/src/msdos/graph.pp
G packages/graph/src/msdos/vesa.inc
--- Recording mergeinfo for merge of r40892 into '.':
G .
--- Merging r40893 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40893 into '.':
G .
--- Merging r40894 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40894 into '.':
G .
--- Merging r40895 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40895 into '.':
G .
--- Merging r40896 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40896 into '.':
G .
--- Merging r40897 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40897 into '.':
G .
--- Merging r40898 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40898 into '.':
G .
--- Merging r40900 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40900 into '.':
G .
--- Merging r40901 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40901 into '.':
G .
--- Merging r40902 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40902 into '.':
G .
--- Merging r40903 into '.':
G packages/graph/src/inc/graphh.inc
G packages/graph/src/inc/graph.inc
--- Recording mergeinfo for merge of r40903 into '.':
G .
--- Merging r40904 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40904 into '.':
G .
--- Merging r40906 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40906 into '.':
G .
--- Merging r40907 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40907 into '.':
G .
--- Merging r40909 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40909 into '.':
G .
--- Merging r40910 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40910 into '.':
G .
--- Merging r40911 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40911 into '.':
G .
--- Merging r40913 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40913 into '.':
G .
--- Merging r40914 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40914 into '.':
G .
--- Merging r40915 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40915 into '.':
G .
--- Merging r40916 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40916 into '.':
G .
--- Merging r40917 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40917 into '.':
G .
--- Merging r40918 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40918 into '.':
G .
--- Merging r40919 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40919 into '.':
G .
--- Merging r40922 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40922 into '.':
G .
--- Merging r40923 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40923 into '.':
G .
--- Merging r40924 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40924 into '.':
G .
--- Merging r40954 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40954 into '.':
G .
--- Merging r40955 into '.':
G packages/graph/src/msdos/graph.pp
--- Recording mergeinfo for merge of r40955 into '.':
G .

# revisions: 40805,40836,40837,40852,40853,40861,40862,40863,40864,40865,40866,40867,40868,40873,40875,40876,40877,40878,40879,40880,40887,40888,40889,40890,40891,40892,40893,40894,40895,40896,40897,40898,40900,40901,40902,40903,40904,40906,40907,40909,40910,40911,40913,40914,40915,40916,40917,40918,40919,40922,40923,40924,40954,40955
r40805 | nickysn | 2019-01-08 09:50:44 +0100 (Tue, 08 Jan 2019) | 5 lines
Changed paths:
M /trunk/packages/graph/src/inc/fills.inc
M /trunk/packages/graph/src/inc/graph.inc
M /trunk/packages/graph/src/inc/graphh.inc

+ introduced the ColorType (=word) to the graph unit. This is the type, used to
represent a color. This is intended to make it easier to add support for
24-bit and 32-bit color to the graph unit on platforms that support it.
r40836 | nickysn | 2019-01-10 16:56:53 +0100 (Thu, 10 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/graphh.inc

* define ColorType as LongWord if FPC_GRAPH_SUPPORTS_TRUECOLOR is defined
r40837 | nickysn | 2019-01-10 17:09:34 +0100 (Thu, 10 Jan 2019) | 2 lines
Changed paths:
M /trunk/packages/graph/src/go32v2/graph.pp
M /trunk/packages/graph/src/msdos/graph.pp

+ added the 24-bit color modes, as defined by VBE 1.x, behind ifdef
FPC_GRAPH_SUPPORTS_TRUECOLOR (not enabled yet)
r40852 | nickysn | 2019-01-13 11:34:06 +0100 (Sun, 13 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added the 24-bit color modes, as defined by VBE 1.x, behind ifdef
FPC_GRAPH_SUPPORTS_TRUECOLOR (not enabled yet)
r40853 | nickysn | 2019-01-13 12:25:58 +0100 (Sun, 13 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* factored out the common VESA mode initialization for each screen resolution to
a separate procedure
r40861 | nickysn | 2019-01-14 13:56:15 +0100 (Mon, 14 Jan 2019) | 2 lines
Changed paths:
M /trunk/packages/graph/src/go32v2/graph.pp

* factored out the common VESA mode initialization for each screen resolution to
a separate procedure (same change as r40853, but for go32v2)
r40862 | nickysn | 2019-01-14 15:09:21 +0100 (Mon, 14 Jan 2019) | 2 lines
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

* factored out the common VESA mode initialization for each screen resolution to
a separate procedure (same change as r40853, but for ptcgraph)
r40863 | nickysn | 2019-01-14 15:59:58 +0100 (Mon, 14 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ initial implementation of 32bpp support (not enabled yet)
r40864 | nickysn | 2019-01-14 16:20:59 +0100 (Mon, 14 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/graph.inc
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

* 32bpp (True Color) compilation fixes
r40865 | nickysn | 2019-01-14 17:23:42 +0100 (Mon, 14 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/modes.inc

* 24-bit color support in modes.inc:res2mode
r40866 | nickysn | 2019-01-14 18:12:14 +0100 (Mon, 14 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/graph.inc

+ True Color fixes in GetScanlineDefault (returns 32 bits per pixel, but only in modes with >16bit color)
r40867 | nickysn | 2019-01-14 18:13:07 +0100 (Mon, 14 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/fills.inc

+ True Color fixes in FloodFill
r40868 | nickysn | 2019-01-14 18:33:53 +0100 (Mon, 14 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/graph.inc

+ True Color fixes in DefaultGetImage, DefaultPutImage and DefaultImageSize
r40873 | nickysn | 2019-01-16 14:52:07 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added fast 32bpp hline and vline drawing routines
r40875 | nickysn | 2019-01-16 15:34:29 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added fast 32bpp GetScanLine routine
r40876 | nickysn | 2019-01-16 15:54:53 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added fast 32bpp GetImage routine
r40877 | nickysn | 2019-01-16 16:04:38 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added fast 32bpp PutImage routine
r40878 | nickysn | 2019-01-16 17:00:31 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added an accelerated 8bpp pattern line drawing routine
r40879 | nickysn | 2019-01-16 17:14:07 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added an accelerated 16bpp pattern line routine
r40880 | nickysn | 2019-01-16 17:24:07 +0100 (Wed, 16 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/ptcgraph/ptcgraph.pp

+ added a 32bpp accelerated pattern line drawing routine
r40887 | nickysn | 2019-01-17 15:47:39 +0100 (Thu, 17 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/go32v2/vesa.inc

+ added a 16bpp linear framebuffer horizontal line drawing routine
r40888 | nickysn | 2019-01-17 17:00:02 +0100 (Thu, 17 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/go32v2/graph.pp
M /trunk/packages/graph/src/go32v2/vesa.inc

+ accelerated xor/and/orput hline routines for the 16bpp linear framebuffer modes
r40889 | nickysn | 2019-01-17 18:07:54 +0100 (Thu, 17 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/go32v2/graph.pp
M /trunk/packages/graph/src/go32v2/vesa.inc

- removed all the 'ifdef fpc'/'ifndef fpc' from the go32v2 graph unit to
make it easier to maintain and because its TP7 compatibility hasn't been
maintained for a very long time
r40890 | nickysn | 2019-01-18 13:32:00 +0100 (Fri, 18 Jan 2019) | 2 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp
M /trunk/packages/graph/src/msdos/vesa.inc

* only save BP and DS when calling int 10h; mark the other registers as volatile in the asm blocks
- removed the 'ifdef FPC' around the register saving code around the int 10h calls
r40891 | nickysn | 2019-01-18 13:52:22 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp
M /trunk/packages/graph/src/msdos/vesa.inc

- removed all the '{$ifndef fpc}far;{$endif fpc}' declarations from the i8086-msdos graph unit
r40892 | nickysn | 2019-01-18 14:22:18 +0100 (Fri, 18 Jan 2019) | 2 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp
M /trunk/packages/graph/src/msdos/vesa.inc

+ use the ColorType type in the i8086-msdos graph unit, so that it compiles with
FPC_GRAPH_SUPPORTS_TRUECOLOR (not enabled yet)
r40893 | nickysn | 2019-01-18 14:32:45 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

- get rid of the '{$ifdef fpc}@{$endif}' from the i8086-msdos graph unit
r40894 | nickysn | 2019-01-18 14:46:47 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* fixed result of GetPixel320 when FPC_GRAPH_SUPPORTS_TRUECOLOR is defined
r40895 | nickysn | 2019-01-18 14:49:05 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

- removed commented out code from PutPixel320 and GetPixel320
r40896 | nickysn | 2019-01-18 16:17:43 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* cleaned up, fixed, optimized a little and enabled the assembler version of PutPixel16
r40897 | nickysn | 2019-01-18 16:48:09 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* cleaned up, fixed, optimized a little and enabled the assembler version of GetPixel16
r40898 | nickysn | 2019-01-18 20:57:51 +0100 (Fri, 18 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* refactored DirectPutPixel16, so it is strictly split into pascal and asm version; asm version not enabled yet
r40900 | nickysn | 2019-01-19 11:58:18 +0100 (Sat, 19 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* use huge memory model compatible initialization of es=SegA000 in the asm
version of DirectPutPixel16
r40901 | nickysn | 2019-01-19 12:18:39 +0100 (Sat, 19 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

- removed the pascal case code before the asm block in the asm version of
DirectPutPixel16
r40902 | nickysn | 2019-01-19 13:54:47 +0100 (Sat, 19 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* cleaned up, optimized a little, added support for all write modes
(and/or/xor/not) and enabled the asm version of the DirectPutPixel16 routine
r40903 | nickysn | 2019-01-19 16:16:49 +0100 (Sat, 19 Jan 2019) | 6 lines
Changed paths:
M /trunk/packages/graph/src/inc/graph.inc
M /trunk/packages/graph/src/inc/graphh.inc

+ introduced SetWriteModeEx to the Graph unit. Unlike SetWriteMode, it allows
setting the current write mode to any mode, such as NormalPut/CopyPut, XorPut,
OrPut, AndPut or NotPut. For comparison, SetWriteMode only allows NormalPut/
CopyPut and XorPut. Fixes Mantis #30773.
r40904 | nickysn | 2019-01-19 16:59:42 +0100 (Sat, 19 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* handle the NotPut write mode in asm instead of pascal in the asm version of
DirectPutPixel16
r40906 | nickysn | 2019-01-19 17:11:03 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* the asm version of DirectPutPixel16 convert to pure inline asm routine
r40907 | nickysn | 2019-01-19 17:20:21 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

- removed unused asm code from SetVisual200
r40909 | nickysn | 2019-01-19 17:36:54 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

+ added pure pascal version of the routine PutPixel320
r40910 | nickysn | 2019-01-19 17:38:44 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* huge memory model fix for the asm version of PutPixel320
r40911 | nickysn | 2019-01-19 17:46:30 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

+ enabled the asm version of PutPixel320
r40913 | nickysn | 2019-01-19 17:55:34 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

+ pure pascal implementation of GetPixel320
r40914 | nickysn | 2019-01-19 17:56:13 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* huge memory model fix for the asm version of the GetPixel320 routine
r40915 | nickysn | 2019-01-19 17:56:49 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

+ enabled the asm version of GetPixel320
r40916 | nickysn | 2019-01-19 17:59:15 +0100 (Sat, 19 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* do the view port adjustment in asm instead of pascal in the asm version of
GetPixel320
r40917 | nickysn | 2019-01-19 18:02:54 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* GetPixel320 converted to a pure assembler routine
r40918 | nickysn | 2019-01-19 18:24:24 +0100 (Sat, 19 Jan 2019) | 4 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* implemented the viewport adjustment in asm instead of pascal in the asm
version of the PutPixel320 routine
r40919 | nickysn | 2019-01-19 19:03:51 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* perform clipping in assembly in the PutPixel320 asm routine
r40922 | nickysn | 2019-01-19 22:27:16 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* only read the low byte of the pixel color in the asm version of PutPixel320
r40923 | nickysn | 2019-01-19 22:33:26 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* use stosb instead of mov to draw the pixel inside the asm version of PutPixel320
r40924 | nickysn | 2019-01-19 23:07:03 +0100 (Sat, 19 Jan 2019) | 3 lines
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* PutPixel320 converted to pure assembler routine
r40954 | nickysn | 2019-01-21 14:39:14 +0100 (Mon, 21 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

- removed the 32-bit asm code from the asm version of DirectPutPixel320
r40955 | nickysn | 2019-01-21 14:40:04 +0100 (Mon, 21 Jan 2019) | 1 line
Changed paths:
M /trunk/packages/graph/src/msdos/graph.pp

* huge memory model fix for the asm version of DirectPutPixel320

git-svn-id: branches/fixes_3_2@41497 -

marco 6 years ago
parent
commit
f91e313eef

File diff suppressed because it is too large
+ 164 - 336
packages/graph/src/go32v2/graph.pp


+ 114 - 195
packages/graph/src/go32v2/vesa.inc

@@ -85,24 +85,14 @@ var
     VESAPtr : ^TVESAInfo;
     st : string[4];
     regs : TDPMIRegisters;
-{$ifndef fpc}
-    ModeSel: word;
-    offs: longint;
-{$endif fpc}
     { added... }
     modelist: PmodeList;
     i: longint;
     RealSeg : word;
    begin
     { Allocate real mode buffer }
-{$ifndef fpc}
-    Ptrlong:=GlobalDosAlloc(sizeof(TVESAInfo));
-    { Get selector value }
-    VESAPtr := pointer(Ptrlong shl 16);
-{$else fpc}
     Ptrlong:=Global_Dos_Alloc(sizeof(TVESAInfo));
     New(VESAPtr);
-{$endif fpc}
     { Get segment value }
     RealSeg := word(Ptrlong shr 16);
     if not assigned(VESAPtr) then
@@ -114,11 +104,9 @@ var
     regs.es := RealSeg;
     regs.edi := $00;
     RealIntr($10, regs);
-{$ifdef fpc}
    { no far pointer support in FPC yet, so move the vesa info into a memory }
    { block in the DS slector space (JM)                                     }
     dosmemget(RealSeg,0,VesaPtr^,SizeOf(TVESAInfo));
-{$endif fpc}
     St:=Vesaptr^.signature;
     if st<>'VESA' then
      begin
@@ -126,44 +114,15 @@ var
          LogLn('No VESA detected.');
 {$endif logging}
          getVesaInfo := FALSE;
-{$ifndef fpc}
-         GlobalDosFree(word(PtrLong and $ffff));
-{$else fpc}
          If not Global_Dos_Free(word(PtrLong and $ffff)) then
            RunError(216);
          { also free the extra allocated buffer }
          Dispose(VESAPtr);
-{$endif fpc}
          exit;
      end
     else
       getVesaInfo := TRUE;
 
-{$ifndef fpc}
-    { The mode pointer buffer points to a real mode memory }
-    { Therefore steps to get the modes:                    }
-    {  1. Allocate Selector and SetLimit to max number of  }
-    {     of possible modes.                               }
-    ModeSel := AllocSelector(0);
-    SetSelectorLimit(ModeSel, 256*sizeof(word));
-
-    {  2. Set Selector linear address to the real mode pointer }
-    {     returned.                                            }
-    offs := longint(longint(VESAPtr^.ModeList) shr 16) shl 4;
-   {shouldn't the OR in the next line be a + ?? (JM)}
-    offs :=  offs OR (Longint(VESAPtr^.ModeList) and $ffff);
-    SetSelectorBase(ModeSel, offs);
-
-     { copy VESA mode information to a protected mode buffer and }
-     { then free the real mode buffer...                         }
-     Move(VESAPtr^, VESAInfo, sizeof(VESAInfo));
-     GlobalDosFree(word(PtrLong and $ffff));
-
-    { ModeList points to the mode list     }
-    { We must copy it somewhere...         }
-    ModeList := Ptr(ModeSel, 0);
-
-{$else fpc}
     { No far pointer support, so the Ptr(ModeSel, 0) doesn't work.     }
     { Immediately copy everything to a buffer in the DS selector space }
      New(ModeList);
@@ -180,7 +139,6 @@ var
      If not Global_Dos_Free(word(PtrLong and $ffff)) then
        RunError(216);
      Dispose(VESAPtr);
-{$endif fpc}
 
     i:=0;
     new(VESAInfo.ModeList);
@@ -197,41 +155,22 @@ var
 {$ifdef logging}
     LogLn(strf(i) + ' modes found.');
 {$endif logging}
-{$ifndef fpc}
-    FreeSelector(ModeSel);
-{$else fpc}
     Dispose(ModeList);
-{$endif fpc}
    end;
 
   function getVESAModeInfo(var ModeInfo: TVESAModeInfo;mode:word):boolean;
    var
     Ptr: longint;
-{$ifndef fpc}
-    VESAPtr : ^TVESAModeInfo;
-{$endif fpc}
     regs : TDPMIRegisters;
     RealSeg: word;
    begin
     { Alllocate real mode buffer }
-{$ifndef fpc}
-    Ptr:=GlobalDosAlloc(sizeof(TVESAModeInfo));
-    { get the selector value }
-    VESAPtr := pointer(longint(Ptr shl 16));
-    if not assigned(VESAPtr) then
-      RunError(203);
-{$else fpc}
     Ptr:=Global_Dos_Alloc(sizeof(TVESAModeInfo));
-{$endif fpc}
     { get the segment value }
     RealSeg := word(Ptr shr 16);
     { we have to init everything to zero, since VBE < 1.1  }
     { may not setup fields correctly.                      }
-{$ifndef fpc}
-    FillChar(VESAPtr^, sizeof(ModeInfo), #0);
-{$else fpc}
     DosMemFillChar(RealSeg, 0, sizeof(ModeInfo), #0);
-{$endif fpc}
     { setup interrupt registers }
     FillChar(regs, sizeof(regs), #0);
     { call VESA mode information...}
@@ -245,18 +184,10 @@ var
     else
       getVESAModeInfo := TRUE;
     { copy to protected mode buffer ... }
-{$ifndef fpc}
-    Move(VESAPtr^, ModeInfo, sizeof(ModeInfo));
-{$else fpc}
     DosMemGet(RealSeg,0,ModeInfo,sizeof(ModeInfo));
-{$endif fpc}
     { free real mode memory  }
-{$ifndef fpc}
-    GlobalDosFree(Word(Ptr and $ffff));
-{$else fpc}
     If not Global_Dos_Free(Word(Ptr and $ffff)) then
       RunError(216);
-{$endif fpc}
    end;
 
 {$ELSE}
@@ -391,7 +322,7 @@ end;
  {*                     8-bit pixels VESA mode routines                  *}
  {************************************************************************}
 
-  procedure PutPixVESA256(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA256(x, y : smallint; color : word);
   var
      offs : longint;
   begin
@@ -413,7 +344,7 @@ end;
        end;
   end;
 
-  procedure DirectPutPixVESA256(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA256(x, y : smallint);
   var
      offs : longint;
      col : byte;
@@ -446,7 +377,7 @@ end;
      mem[WinWriteSeg : word(offs)] := Col;
   end;
 
-  function GetPixVESA256(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
+  function GetPixVESA256(x, y : smallint): word;
   var
      offs : longint;
   begin
@@ -457,7 +388,7 @@ end;
      GetPixVESA256:=mem[WinReadSeg : word(offs)];
   end;
 
-  Procedure GetScanLineVESA256(x1, x2, y: smallint; var data); {$ifndef fpc}far;{$endif}
+  Procedure GetScanLineVESA256(x1, x2, y: smallint; var data);
   var offs: Longint;
       l, amount, bankrest, index, pixels: longint;
       curbank: smallint;
@@ -546,7 +477,7 @@ end;
     Until amount = 0;
   end;
 
-  procedure HLineVESA256(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineVESA256(x,x2,y: smallint);
 
    var Offs: Longint;
        mask, l, bankrest: longint;
@@ -869,7 +800,7 @@ end;
        end;
    end;
 
-  procedure VLineVESA256(x,y,y2: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure VLineVESA256(x,y,y2: smallint);
 
    var Offs: Longint;
        l, bankrest: longint;
@@ -1024,7 +955,7 @@ end;
        end;
    end;
 
-  procedure PatternLineVESA256(x1,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure PatternLineVESA256(x1,x2,y: smallint);
   {********************************************************}
   { Draws a horizontal patterned line according to the     }
   { current Fill Settings.                                 }
@@ -1156,12 +1087,11 @@ end;
  {************************************************************************}
  {*                    256 colors VESA mode routines  Linear mode        *}
  {************************************************************************}
-{$ifdef FPC}
 type
   pbyte = ^byte;
   pword = ^word;
 
-  procedure DirectPutPixVESA256Linear(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA256Linear(x, y : smallint);
   var
      offs : longint;
      col : byte;
@@ -1205,7 +1135,7 @@ type
        seg_move(get_ds,longint(@col),WinWriteSeg,offs+LinearPageOfs,1);
   end;
 
-  procedure PutPixVESA256Linear(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA256Linear(x, y : smallint; color : word);
   var
      offs : longint;
   begin
@@ -1230,7 +1160,7 @@ type
        seg_move(get_ds,longint(@color),WinWriteSeg,offs+LinearPageOfs,1);
   end;
 
-  function GetPixVESA256Linear(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
+  function GetPixVESA256Linear(x, y : smallint): word;
   var
      offs : longint;
      col : byte;
@@ -1277,14 +1207,13 @@ begin
     SetVESADisplayStart:=true;
 end;
 *)
-{$endif FPC}
 
 
  {************************************************************************}
  {*                    15/16bit pixels VESA mode routines                *}
  {************************************************************************}
 
-  procedure PutPixVESA32kOr64k(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA32kOr64k(x, y : smallint; color : word);
   var
      offs : longint;
      place: word;
@@ -1316,7 +1245,7 @@ end;
      memW[WinWriteSeg : place] := color;
   end;
 
-  function GetPixVESA32kOr64k(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
+  function GetPixVESA32kOr64k(x, y : smallint): word;
   var
      offs : longint;
   begin
@@ -1327,7 +1256,7 @@ end;
      GetPixVESA32kOr64k:=memW[WinReadSeg : word(offs)];
   end;
 
-  procedure DirectPutPixVESA32kOr64k(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA32kOr64k(x, y : smallint);
   var
      offs : longint;
      bank : smallint;
@@ -1372,7 +1301,7 @@ end;
      End;
   end;
 
-  procedure HLineVESA32kOr64k(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineVESA32kOr64k(x,x2,y: smallint);
 
    var Offs: Longint;
        mask, l, bankrest: longint;
@@ -1689,12 +1618,11 @@ end;
        end;
    end;
 
-{$ifdef FPC}
  {************************************************************************}
  {*                    15/16bit pixels VESA mode routines  Linear mode   *}
  {************************************************************************}
 
-  procedure PutPixVESA32kor64kLinear(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA32kor64kLinear(x, y : smallint; color : word);
   var
      offs : longint;
   begin
@@ -1715,7 +1643,7 @@ end;
        seg_move(get_ds,longint(@color),WinWriteSeg,offs+LinearPageOfs,2);
   end;
 
-  function GetPixVESA32kor64kLinear(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
+  function GetPixVESA32kor64kLinear(x, y : smallint): word;
   var
      offs : longint;
      color : word;
@@ -1730,7 +1658,7 @@ end;
      GetPixVESA32kor64kLinear:=color;
   end;
 
-  procedure DirectPutPixVESA32kor64kLinear(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA32kor64kLinear(x, y : smallint);
   var
      offs : longint;
      col : word;
@@ -1774,13 +1702,82 @@ end;
        seg_move(get_ds,longint(@col),WinWriteSeg,offs+LinearPageOfs,2);
   end;
 
-{$endif FPC}
+  procedure HLineVESA32kOr64kLinear(x,x2,y: smallint);
+  var
+    Offs: Longint;
+    hlength: smallint;
+  begin
+    { must we swap the values? }
+    if x > x2 then
+      begin
+        x := x xor x2;
+        x2 := x xor x2;
+        x:= x xor x2;
+      end;
+    { First convert to global coordinates }
+    X   := X + StartXViewPort;
+    X2  := X2 + StartXViewPort;
+    Y   := Y + StartYViewPort;
+    if ClipPixels and
+       LineClipped(x,y,x2,y,
+                   StartXViewPort,StartYViewPort,
+                   StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
+      exit;
+    {$ifdef logging2}
+    LogLn('hline '+strf(x)+' - '+strf(x2)+' on '+strf(y)+' in mode '+strf(currentwritemode));
+    {$endif logging2}
+    HLength := x2 - x + 1;
+    {$ifdef logging2}
+    LogLn('length: '+strf(hlength));
+    {$endif logging2}
+    Offs:=Longint(y)*BytesPerLine+2*x;
+    {$ifdef logging2}
+    LogLn('Offs: '+strf(offs)+' -- '+hexstr(offs,8));
+    {$endif logging2}
+    case CurrentWriteMode of
+      XorPut:
+        begin
+          if UseNoSelector then
+            seg_xorword(get_ds,PtrUInt(LFBPointer)+PtrUInt(offs)+PtrUInt(LinearPageOfs),HLength,Word(CurrentColor))
+          else
+            seg_xorword(WinWriteSeg,offs+LinearPageOfs,HLength,Word(CurrentColor));
+        end;
+      OrPut:
+        begin
+          if UseNoSelector then
+            seg_orword(get_ds,PtrUInt(LFBPointer)+PtrUInt(offs)+PtrUInt(LinearPageOfs),HLength,Word(CurrentColor))
+          else
+            seg_orword(WinWriteSeg,offs+LinearPageOfs,HLength,Word(CurrentColor));
+        end;
+      AndPut:
+        begin
+          if UseNoSelector then
+            seg_andword(get_ds,PtrUInt(LFBPointer)+PtrUInt(offs)+PtrUInt(LinearPageOfs),HLength,Word(CurrentColor))
+          else
+            seg_andword(WinWriteSeg,offs+LinearPageOfs,HLength,Word(CurrentColor));
+        end;
+      NormalPut:
+        begin
+          if UseNoSelector then
+            FillWord(Pointer(LFBPointer+offs+LinearPageOfs)^,HLength,Word(CurrentColor))
+          else
+            seg_fillword(WinWriteSeg,offs+LinearPageOfs,HLength,Word(CurrentColor));
+        end;
+      NotPut:
+        begin
+          if UseNoSelector then
+            FillWord(Pointer(LFBPointer+offs+LinearPageOfs)^,HLength,Word(not Word(CurrentColor)))
+          else
+            seg_fillword(WinWriteSeg,offs+LinearPageOfs,HLength,Word(not Word(CurrentColor)));
+        end;
+    end;
+  end;
 
  {************************************************************************}
  {*                     4-bit pixels VESA mode routines                  *}
  {************************************************************************}
 
-  procedure PutPixVESA16(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA16(x, y : smallint; color : word);
     var
      offs : longint;
      dummy : byte;
@@ -1815,7 +1812,7 @@ end;
   end;
 
 
- Function GetPixVESA16(X,Y: smallint):word; {$ifndef fpc}far;{$endif fpc}
+ Function GetPixVESA16(X,Y: smallint):word;
  Var dummy: Word;
      offset: longint;
      shift: byte;
@@ -1837,7 +1834,7 @@ end;
   end;
 
 
-  procedure DirectPutPixVESA16(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA16(x, y : smallint);
     var
      offs : longint;
      dummy : byte;
@@ -1882,7 +1879,7 @@ end;
   end;
 
 
-  procedure HLineVESA16(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineVESA16(x,x2,y: smallint);
   var
       xtmp: smallint;
       ScrOfs, BankRest: longint;
@@ -1990,7 +1987,6 @@ end;
 
 
 {$IFDEF DPMI}
-{$ifdef fpc}
    Procedure SetVESARGBAllPalette(const Palette:PaletteType);
     var
      pal: array[0..255] of palrec;
@@ -2056,7 +2052,6 @@ end;
         end;
       setallpalettedefault(palette);
     end;
-{$endif fpc}
 
    Procedure SetVESARGBPalette(ColorNum, RedValue, GreenValue,
       BlueValue : smallint);
@@ -2064,9 +2059,6 @@ end;
      pal: palrec;
      regs: TDPMIRegisters;
      Ptr: longint;
-{$ifndef fpc}
-     PalPtr : ^PalRec;
-{$endif fpc}
      RealSeg: word;
      FunctionNr : byte;   { use blankbit or normal RAMDAC programming? }
     begin
@@ -2093,25 +2085,13 @@ end;
               FunctionNr := $00;
 
             { Alllocate real mode buffer }
-{$ifndef fpc}
-            Ptr:=GlobalDosAlloc(sizeof(palrec));
-            { get the selector values }
-            PalPtr := pointer(Ptr shl 16);
-            if not assigned(PalPtr) then
-               RunError(203);
-{$else fpc}
             Ptr:=Global_Dos_Alloc(sizeof(palrec));
-{$endif fpc}
             {get the segment value}
             RealSeg := word(Ptr shr 16);
             { setup interrupt registers }
             FillChar(regs, sizeof(regs), #0);
             { copy palette values to real mode buffer }
-{$ifndef fpc}
-            move(pal, palptr^, sizeof(pal));
-{$else fpc}
             DosMemPut(RealSeg,0,pal,sizeof(pal));
-{$endif fpc}
             regs.eax := $4F09;
             regs.ebx := FunctionNr;
             regs.ecx := $01;
@@ -2121,12 +2101,8 @@ end;
             RealIntr($10, regs);
 
             { free real mode memory  }
-{$ifndef fpc}
-            GlobalDosFree(word(Ptr and $ffff));
-{$else fpc}
             If not Global_Dos_Free(word(Ptr and $ffff)) then
               RunError(216);
-{$endif fpc}
 
             if word(regs.eax) <> $004F then
               begin
@@ -2149,9 +2125,6 @@ end;
       RedValue, GreenValue, BlueValue : smallint);
    var
     pal: PalRec;
-{$ifndef fpc}
-    palptr : ^PalRec;
-{$endif fpc}
     regs : TDPMIRegisters;
     RealSeg: word;
     ptr: longint;
@@ -2168,15 +2141,7 @@ end;
         if VESAInfo.Version >= $0200 then
           Begin
             { Alllocate real mode buffer }
-{$ifndef fpc}
-            Ptr:=GlobalDosAlloc(sizeof(palrec));
-            { get the selector value }
-            PalPtr := pointer(longint(Ptr and $0000ffff) shl 16);
-            if not assigned(PalPtr) then
-               RunError(203);
-{$else fpc}
             Ptr:=Global_Dos_Alloc(sizeof(palrec));
-{$endif fpc}
             { get the segment value }
             RealSeg := word(Ptr shr 16);
             { setup interrupt registers }
@@ -2191,18 +2156,10 @@ end;
             RealIntr($10, regs);
 
            { copy to protected mode buffer ... }
-{$ifndef fpc}
-           Move(PalPtr^, Pal, sizeof(pal));
-{$else fpc}
            DosMemGet(RealSeg,0,Pal,sizeof(pal));
-{$endif fpc}
            { free real mode memory  }
-{$ifndef fpc}
-           GlobalDosFree(word(Ptr and $ffff));
-{$else fpc}
            If not Global_Dos_Free(word(Ptr and $ffff)) then
              RunError(216);
-{$endif fpc}
 
             if word(regs.eax) <> $004F then
               begin
@@ -2383,7 +2340,6 @@ Const
      else
        BytesPerLine := VESAModeInfo.BytesPerScanLine;
 
-{$ifdef FPC}
      case mode of
        m320x200x32k,
        m320x200x64k,
@@ -2399,8 +2355,8 @@ Const
            DirectPutPixel:=@DirectPutPixVESA32kor64kLinear;
            PutPixel:=@PutPixVESA32kor64kLinear;
            GetPixel:=@GetPixVESA32kor64kLinear;
+           HLine:=@HLineVESA32kOr64kLinear;
            { linear mode for lines not yet implemented PM }
-           HLine:=@HLineDefault;
            VLine:=@VLineDefault;
            GetScanLine := @GetScanLineDefault;
            PatternLine := @PatternLineDefault;
@@ -2474,7 +2430,6 @@ Const
          inc(WinShift);
          Temp:=Temp shr 1;
        end; }
-{$endif FPC}
    end;
 
   procedure SetupWindows(var ModeInfo: TVESAModeInfo);
@@ -2669,19 +2624,15 @@ Const
    asm
     mov ax,4F02h
     mov bx,mode
-{$ifdef fpc}
     push ebp
     push esi
     push edi
     push ebx
-{$endif fpc}
     int 10h
-{$ifdef fpc}
     pop ebx
     pop edi
     pop esi
     pop ebp
-{$endif fpc}
     sub ax,004Fh
     cmp ax,1
     sbb al,al
@@ -2762,21 +2713,21 @@ Const
 
 {$ENDIF}
 
- procedure Init1280x1024x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x64k;
   begin
     SetVesaMode(m1280x1024x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1280x1024x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x32k;
   begin
     SetVESAMode(m1280x1024x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1280x1024x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x256;
   begin
     SetVESAMode(m1280x1024x256);
     { Get maximum number of scanlines for page flipping }
@@ -2784,105 +2735,105 @@ Const
   end;
 
 
- procedure Init1280x1024x16; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x16;
   begin
     SetVESAMode(m1280x1024x16);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x64k;
   begin
     SetVESAMode(m1024x768x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x32k;
   begin
     SetVESAMode(m1024x768x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x256;
   begin
     SetVESAMode(m1024x768x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x16; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x16;
   begin
     SetVESAMode(m1024x768x16);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x64k;
   begin
     SetVESAMode(m800x600x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x32k;
   begin
     SetVESAMode(m800x600x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x256;
   begin
     SetVESAMode(m800x600x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x16; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x16;
   begin
     SetVesaMode(m800x600x16);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x480x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x480x64k;
   begin
     SetVESAMode(m640x480x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x480x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x480x32k;
   begin
     SetVESAMode(m640x480x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x480x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x480x256;
   begin
     SetVESAMode(m640x480x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x400x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x400x256;
   begin
     SetVESAMode(m640x400x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init320x200x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init320x200x64k;
   begin
     SetVESAMode(m320x200x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init320x200x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init320x200x32k;
   begin
     SetVESAMode(m320x200x32k);
     { Get maximum number of scanlines for page flipping }
@@ -2892,7 +2843,7 @@ Const
 
 {$IFDEF DPMI}
 
- Procedure SaveStateVESA; {$ifndef fpc}far;{$endif fpc}
+ Procedure SaveStateVESA;
  var
   PtrLong: longint;
   regs: TDPMIRegisters;
@@ -2905,19 +2856,15 @@ Const
     { Get the video mode }
     asm
       mov  ah,0fh
-{$ifdef fpc}
       push ebp
       push esi
       push edi
       push ebx
-{$endif fpc}
       int  10h
-{$ifdef fpc}
       pop ebx
       pop edi
       pop esi
       pop ebp
-{$endif fpc}
       mov  [VideoMode], al
     end ['EAX'];
     { saving/restoring video state screws up Windows (JM) }
@@ -2939,22 +2886,10 @@ Const
 {$ifdef logging}
         LogLn('allocating VESA save buffer of '+strf(64*StateSize));
 {$endif logging}
-{$ifndef fpc}
-        PtrLong:=GlobalDosAlloc(64*StateSize);  { values returned in 64-byte blocks }
-{$else fpc}
         PtrLong:=Global_Dos_Alloc(64*StateSize);  { values returned in 64-byte blocks }
-{$endif fpc}
         if PtrLong = 0 then
            RunError(203);
         SavePtr := pointer(longint(PtrLong and $0000ffff) shl 16);
-{$ifndef fpc}
-        { In FPC mode, we can't do anything with this (no far pointers)  }
-        { However, we still need to keep it to be able to free the       }
-        { memory afterwards. Since this data is not accessed in PM code, }
-        { there's no need to save it in a seperate buffer (JM)           }
-        if not assigned(SavePtr) then
-           RunError(203);
-{$endif fpc}
         RealStateSeg := word(PtrLong shr 16);
 
         FillChar(regs, sizeof(regs), #0);
@@ -2977,7 +2912,7 @@ Const
       end;
   end;
 
- procedure RestoreStateVESA; {$ifndef fpc}far;{$endif fpc}
+ procedure RestoreStateVESA;
   var
    regs:TDPMIRegisters;
   begin
@@ -2985,28 +2920,20 @@ Const
      asm
       mov  ah,00
       mov  al,[VideoMode]
-{$ifdef fpc}
       push ebp
       push esi
       push edi
       push ebx
-{$endif fpc}
       int  10h
-{$ifdef fpc}
       pop ebx
       pop edi
       pop esi
       pop ebp
-{$endif fpc}
      end ['EAX'];
      { then restore all state information }
-{$ifndef fpc}
-     if assigned(SavePtr) and (SaveSupported=TRUE) then
-{$else fpc}
      { No far pointer support, so it's possible that that assigned(SavePtr) }
      { would return false under FPC. Just check if it's different from nil. }
      if (SavePtr <> nil) and (SaveSupported=TRUE) then
-{$endif fpc}
        begin
         FillChar(regs, sizeof(regs), #0);
         { restore state, according to Ralph Brown Interrupt list }
@@ -3017,11 +2944,7 @@ Const
          regs.es := RealStateSeg;
          regs.ebx := 0;
          RealIntr($10,regs);
-{$ifndef fpc}
-         if GlobalDosFree(longint(SavePtr) shr 16)<>0 then
-{$else fpc}
          if Not(Global_Dos_Free(longint(SavePtr) shr 16)) then
-{$endif fpc}
           RunError(216);
          SavePtr := nil;
        end;
@@ -3123,7 +3046,7 @@ Const
   { between VBE versions , we will use the old method where }
   { the new pixel offset is used to display different pages }
   {******************************************************** }
- procedure SetVisualVESA(page: word); {$ifndef fpc}far;{$endif fpc}
+ procedure SetVisualVESA(page: word);
   var
    newStartVisible : word;
   begin
@@ -3143,23 +3066,19 @@ Const
       mov bx, 0000h   { set display start }
       mov cx, 0000h   { pixel zero !      }
       mov dx, [NewStartVisible]  { new scanline }
-{$ifdef fpc}
       push    ebp
       push    esi
       push    edi
       push    ebx
-{$endif}
       int     10h
-{$ifdef fpc}
       pop     ebx
       pop     edi
       pop     esi
       pop     ebp
-{$endif}
     end ['EDX','ECX','EBX','EAX'];
   end;
 
- procedure SetActiveVESA(page: word); {$ifndef fpc}far;{$endif fpc}
+ procedure SetActiveVESA(page: word);
   begin
     { video offset is in pixels under VESA VBE! }
     { This value is reset after a mode set to page ZERO = YOffset = 0 ) }

+ 104 - 33
packages/graph/src/inc/fills.inc

@@ -297,6 +297,11 @@ var
      End;
 
   s1, s2, s3 : PWordArray;                { Three buffers for scanlines                 }
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  sl1 : PLongWordArray absolute s1;
+  sl2 : PLongWordArray absolute s2;
+  sl3 : PLongWordArray absolute s3;
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
 
 
   Procedure PushPoint (x, y : smallint);
@@ -412,7 +417,7 @@ var
   end;
 
 
-  Procedure FloodFill (x, y : smallint; Border: word);
+  Procedure FloodFill (x, y : smallint; Border: ColorType);
   {********************************************************}
   { Procedure FloodFill()                                  }
   {--------------------------------------------------------}
@@ -426,7 +431,7 @@ var
    Beginx : smallint;
    d, e : Byte;
    Cont : Boolean;
-   BackupColor : Word;
+   BackupColor : ColorType;
    x1, x2, prevy: smallint;
   Begin
     GetMem(DrawnList,sizeof(PFloodLine)*((ViewHeight div YResDiv) + 1));
@@ -437,9 +442,20 @@ var
     BackupColor := CurrentColor;
     CurrentColor := FillSettings.Color;
     { MaxX is based on zero index }
-    GetMem (s1,(ViewWidth+1)*2);  { A pixel color represents a word }
-    GetMem (s2,(ViewWidth+1)*2);  { A pixel color represents a word }
-    GetMem (s3,(ViewWidth+1)*2);  { A pixel color represents a word }
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    if MaxColor > 65536 then
+    begin
+      GetMem (s1,(ViewWidth+1)*4);  { A pixel color represents a word }
+      GetMem (s2,(ViewWidth+1)*4);  { A pixel color represents a word }
+      GetMem (s3,(ViewWidth+1)*4);  { A pixel color represents a word }
+    end
+    else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    begin
+      GetMem (s1,(ViewWidth+1)*2);  { A pixel color represents a word }
+      GetMem (s2,(ViewWidth+1)*2);  { A pixel color represents a word }
+      GetMem (s3,(ViewWidth+1)*2);  { A pixel color represents a word }
+    end;
     if (not assigned(s1)) or (not assigned(s2)) or (not assigned(s3)) then
       begin
         _GraphResult := grNoFloodMem;
@@ -485,38 +501,82 @@ var
          end;
        prevy := y;
        { check the current scan line }
-       While (s1^[x]<>Border) And (x<=ViewWidth) Do Inc (x);
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+       if MaxColor > 65536 then
+       begin
+         While (sl1^[x]<>Border) And (x<=ViewWidth) Do Inc (x);
+       end
+       else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+       begin
+         While (s1^[x]<>Border) And (x<=ViewWidth) Do Inc (x);
+       end;
        d:=0;
        e:=0;
        dec(x);
        Beginx:=x;
-       REPEAT
-         { check the above line }
-         If y<ViewHeight then
-           Begin
-              Cont:=(s3^[x]<>Border) and (not AlreadyDrawn(x,y+1));
-              If (e=0) And Cont then
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+       if MaxColor > 65536 then
+       begin
+         REPEAT
+           { check the above line }
+           If y<ViewHeight then
+             Begin
+                Cont:=(sl3^[x]<>Border) and (not AlreadyDrawn(x,y+1));
+                If (e=0) And Cont then
+                  Begin
+                    PushPoint (x,y+1);
+                    e:=1;
+                  End
+                Else
+                  If (e=1) And Not Cont then e:=0;
+             End;
+          { check the line below }
+          If (y>0) then
+            Begin
+              Cont:=(sl2^[x]<>Border) and (not AlreadyDrawn(x,y-1));
+              If (d=0) And Cont then
                 Begin
-                  PushPoint (x,y+1);
-                  e:=1;
+                  PushPoint (x,y-1);
+                  d:=1;
                 End
               Else
-                If (e=1) And Not Cont then e:=0;
-           End;
-        { check the line below }
-        If (y>0) then
-          Begin
-            Cont:=(s2^[x]<>Border) and (not AlreadyDrawn(x,y-1));
-            If (d=0) And Cont then
-              Begin
-                PushPoint (x,y-1);
-                d:=1;
-              End
-            Else
-              If (d=1) And Not Cont then d:=0;
-          End;
-        Dec (x);
-       Until (x<0) Or (s1^[x]=Border);
+                If (d=1) And Not Cont then d:=0;
+            End;
+          Dec (x);
+         Until (x<0) Or (sl1^[x]=Border);
+       end
+       else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+       begin
+         REPEAT
+           { check the above line }
+           If y<ViewHeight then
+             Begin
+                Cont:=(s3^[x]<>Border) and (not AlreadyDrawn(x,y+1));
+                If (e=0) And Cont then
+                  Begin
+                    PushPoint (x,y+1);
+                    e:=1;
+                  End
+                Else
+                  If (e=1) And Not Cont then e:=0;
+             End;
+          { check the line below }
+          If (y>0) then
+            Begin
+              Cont:=(s2^[x]<>Border) and (not AlreadyDrawn(x,y-1));
+              If (d=0) And Cont then
+                Begin
+                  PushPoint (x,y-1);
+                  d:=1;
+                End
+              Else
+                If (d=1) And Not Cont then d:=0;
+            End;
+          Dec (x);
+         Until (x<0) Or (s1^[x]=Border);
+       end;
        { swap the values }
        x1:=x+1;
        x2:=BeginX;
@@ -531,9 +591,20 @@ var
        PatternLine (x1,x2,y);
      End; { end while }
 
-    System.FreeMem (s1,(ViewWidth+1)*2);
-    System.FreeMem (s2,(ViewWidth+1)*2);
-    System.FreeMem (s3,(ViewWidth+1)*2);
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    if MaxColor > 65536 then
+    begin
+      System.FreeMem (s1,(ViewWidth+1)*4);
+      System.FreeMem (s2,(ViewWidth+1)*4);
+      System.FreeMem (s3,(ViewWidth+1)*4);
+    end
+    else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    begin
+      System.FreeMem (s1,(ViewWidth+1)*2);
+      System.FreeMem (s2,(ViewWidth+1)*2);
+      System.FreeMem (s3,(ViewWidth+1)*2);
+    end;
     CleanUpDrawnList;
     System.FreeMem(DrawnList,sizeof(PFloodLine)*((ViewHeight div YResDiv) + 1));
     CurrentColor := BackUpColor;

+ 117 - 41
packages/graph/src/inc/graph.inc

@@ -52,6 +52,10 @@ type
 
   WordArray = Array [0..StdbufferSize] Of word;
   PWordArray = ^WordArray;
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  LongWordArray = Array [0..StdbufferSize] Of LongWord;
+  PLongWordArray = ^LongWordArray;
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
 
 
 const
@@ -78,8 +82,8 @@ const
 
 
 var
-  CurrentColor:     Word;
-  CurrentBkColor: Word;
+  CurrentColor:     ColorType;
+  CurrentBkColor: ColorType;
   CurrentX : smallint;   { viewport relative }
   CurrentY : smallint;   { viewport relative }
 
@@ -237,7 +241,7 @@ var
       Flag           : Boolean; { determines pixel direction in thick lines }
       NumPixels      : smallint;
       PixelCount     : smallint;
-      OldCurrentColor: Word;
+      OldCurrentColor: ColorType;
       swtmp          : smallint;
       TmpNumPixels   : smallint;
  begin
@@ -673,7 +677,8 @@ var
     TempTerm: graph_float;
     xtemp, ytemp, xp, yp, xm, ym, xnext, ynext,
       plxpyp, plxmyp, plxpym, plxmym: smallint;
-    BackupColor, TmpAngle, OldLineWidth: word;
+    BackupColor: ColorType;
+    TmpAngle, OldLineWidth: word;
     CounterClockwise : Boolean;
   Begin
    If LineInfo.ThickNess = ThickWidth Then
@@ -817,7 +822,7 @@ var
     j           : smallint;
     TmpFillPattern : byte;
     OldWriteMode : word;
-    OldCurrentColor : word;
+    OldCurrentColor : ColorType;
    begin
      { convert to global coordinates ... }
      x1 := x1 + StartXViewPort;
@@ -991,7 +996,8 @@ var
 Procedure ClearViewPortDefault; {$ifndef fpc}far;{$endif fpc}
 var
  j: smallint;
- OldWriteMode, OldCurColor: word;
+ OldWriteMode: word;
+ OldCurColor: ColorType;
  LineSets : LineSettingsType;
 Begin
   { CP is always RELATIVE coordinates }
@@ -1113,26 +1119,48 @@ end;
   Var
     x : smallint;
   Begin
-     For x:=X1 to X2 Do
-       WordArray(Data)[x-x1]:=GetPixel(x, y);
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    if MaxColor > 65536 then
+    begin
+      For x:=X1 to X2 Do
+        LongWordArray(Data)[x-x1]:=GetPixel(x, y);
+    end
+    else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    begin
+      For x:=X1 to X2 Do
+        WordArray(Data)[x-x1]:=GetPixel(x, y);
+    end;
   End;
 
 
 
 Function DefaultImageSize(X1,Y1,X2,Y2: smallint): longint; {$ifndef fpc}far;{$endif fpc}
 Begin
-  { each pixel uses two bytes, to enable modes with colors up to 64K }
-  { to work.                                                         }
-  DefaultImageSize := 12 + (((X2-X1+1)*(Y2-Y1+1))*2);
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  if MaxColor > 65536 then
+  begin
+    DefaultImageSize := 12 + (((X2-X1+1)*(Y2-Y1+1))*4);
+  end
+  else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  begin
+    { each pixel uses two bytes, to enable modes with colors up to 64K }
+    { to work.                                                         }
+    DefaultImageSize := 12 + (((X2-X1+1)*(Y2-Y1+1))*2);
+  end;
 end;
 
 Procedure DefaultPutImage(X,Y: smallint; var Bitmap; BitBlt: Word); {$ifndef fpc}far;{$endif fpc}
 type
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  ptl = array[0..{$ifdef cpu16}8191{$else}$fffffff{$endif}] of longword;
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
   pt = array[0..{$ifdef cpu16}16382{$else}$fffffff{$endif}] of word;
   ptw = array[0..2] of longint;
 var
   k: longint;
-  oldCurrentColor: word;
+  oldCurrentColor: ColorType;
   oldCurrentWriteMode, i, j, y1, x1, deltaX, deltaX1, deltaY: smallint;
 Begin
 {$ifdef logging}
@@ -1148,7 +1176,12 @@ Begin
 
   deltaX := 0;
   deltaX1 := 0;
-  k := 3 * sizeOf(Longint) div sizeOf(Word); { Three reserved longs at start of bitmap }
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  if MaxColor > 65536 then
+    k := 3 * sizeOf(Longint) div sizeOf(LongWord) { Three reserved longs at start of bitmap }
+  else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+    k := 3 * sizeOf(Longint) div sizeOf(Word); { Three reserved longs at start of bitmap }
  { check which part of the image is in the viewport }
   if clipPixels then
     begin
@@ -1177,39 +1210,75 @@ Begin
   oldCurrentColor := currentColor;
   oldCurrentWriteMode := currentWriteMode;
   currentWriteMode := bitBlt;
-  for j:=Y to Y1 do
-   Begin
-     inc(k,deltaX);
-     for i:=X to X1 do
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  if MaxColor > 65536 then
+  begin
+    for j:=Y to Y1 do
+    Begin
+      inc(k,deltaX);
+      for i:=X to X1 do
+      begin
+        currentColor := ptl(bitmap)[k];
+        directPutPixel(i,j);
+        inc(k);
+      end;
+      inc(k,deltaX1);
+    end;
+  end
+  else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  begin
+    for j:=Y to Y1 do
+    Begin
+      inc(k,deltaX);
+      for i:=X to X1 do
       begin
         currentColor := pt(bitmap)[k];
         directPutPixel(i,j);
         inc(k);
-     end;
-     inc(k,deltaX1);
-   end;
+      end;
+      inc(k,deltaX1);
+    end;
+  end;
   currentWriteMode := oldCurrentWriteMode;
   currentColor := oldCurrentColor;
 end;
 
 Procedure DefaultGetImage(X1,Y1,X2,Y2: smallint; Var Bitmap); {$ifndef fpc}far;{$endif fpc}
 type
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  ptl = array[0..{$ifdef cpu16}8191{$else}$fffffff{$endif}] of longword;
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
   pt = array[0..{$ifdef cpu16}16382{$else}$fffffff{$endif}] of word;
   ptw = array[0..2] of longint;
 var
   i,j: smallint;
   k: longint;
 Begin
-  k:= 3 * Sizeof(longint) div sizeof(word); { Three reserved longs at start of bitmap }
   i := x2 - x1 + 1;
-  for j:=Y1 to Y2 do
-   Begin
-     GetScanLine(x1,x2,j,pt(Bitmap)[k]);
-     inc(k,i);
-   end;
-   ptw(Bitmap)[0] := X2-X1+1;   { First longint  is width  }
-   ptw(Bitmap)[1] := Y2-Y1+1;   { Second longint is height }
-   ptw(bitmap)[2] := 0;       { Third longint is reserved}
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  if MaxColor > 65536 then
+  begin
+    k:= 3 * Sizeof(longint) div sizeof(longword); { Three reserved longs at start of bitmap }
+    for j:=Y1 to Y2 do
+    Begin
+      GetScanLine(x1,x2,j,ptl(Bitmap)[k]);
+      inc(k,i);
+    end;
+  end
+  else
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+  begin
+    k:= 3 * Sizeof(longint) div sizeof(word); { Three reserved longs at start of bitmap }
+    for j:=Y1 to Y2 do
+    Begin
+      GetScanLine(x1,x2,j,pt(Bitmap)[k]);
+      inc(k,i);
+    end;
+  end;
+  ptw(Bitmap)[0] := X2-X1+1;   { First longint  is width  }
+  ptw(Bitmap)[1] := Y2-Y1+1;   { Second longint is height }
+  ptw(bitmap)[2] := 0;       { Third longint is reserved}
 end;
 
 
@@ -1248,12 +1317,12 @@ end;
      NotInGraphicsMode;
    end;
 
-  function GetPixelDefault(X,Y: smallint): word;
+  function GetPixelDefault(X,Y: smallint): ColorType;
    begin
      NotInGraphicsMode;
    end;
 
-  procedure PutPixelDefault(X,Y: smallint; Color: Word);
+  procedure PutPixelDefault(X,Y: smallint; Color: ColorType);
    begin
      NotInGraphicsMode;
    end;
@@ -1272,8 +1341,8 @@ end;
 
   procedure OutTextXYDefault(x,y : smallint;const TextString : string);forward;
   procedure CircleDefault(X, Y: smallint; Radius:Word);forward;
-  procedure SetBkColorDefault(ColorNum: Word);forward;
-  function GetBkColorDefault: Word;forward;
+  procedure SetBkColorDefault(ColorNum: ColorType);forward;
+  function GetBkColorDefault: ColorType;forward;
 
 {$i palette.inc}
 
@@ -1541,7 +1610,7 @@ end;
 
 
 
-   procedure SetFillStyle(Pattern : word; Color: word);
+   procedure SetFillStyle(Pattern : word; Color: ColorType);
 
    begin
      { on invalid input, the current fill setting will be }
@@ -1559,7 +1628,7 @@ end;
    end;
 
 
-  procedure SetFillPattern(Pattern: FillPatternType; Color: word);
+  procedure SetFillPattern(Pattern: FillPatternType; Color: ColorType);
   {********************************************************}
   { Changes the Current FillPattern to a user defined      }
   { pattern and changes also the current fill color.       }
@@ -1595,7 +1664,7 @@ end;
   {     - No contour is drawn for the lines                }
   {********************************************************}
   var y               : smallint;
-      origcolor       : longint;
+      origcolor       : ColorType;
       origlinesettings: Linesettingstype;
       origwritemode   : smallint;
    begin
@@ -1706,27 +1775,27 @@ end;
 {--------------------------------------------------------------------------}
 
 
-  procedure SetColor(Color: Word);
+  procedure SetColor(Color: ColorType);
 
    Begin
      CurrentColor := Color;
    end;
 
 
-  function GetColor: Word;
+  function GetColor: ColorType;
 
    Begin
      GetColor := CurrentColor;
    end;
 
-  function GetBkColorDefault: Word;
+  function GetBkColorDefault: ColorType;
 
    Begin
      GetBkColorDefault := CurrentBkColor;
    end;
 
 
-  procedure SetBkColorDefault(ColorNum: Word);
+  procedure SetBkColorDefault(ColorNum: ColorType);
   { Background color means background screen color in this case, and it is  }
   { INDEPENDANT of the viewport settings, so we must clear the whole screen }
   { with the color.                                                         }
@@ -1752,7 +1821,7 @@ end;
    end;
 
 
-  function GetMaxColor: word;
+  function GetMaxColor: ColorType;
   { Checked against TP VGA driver - CEC }
 
    begin
@@ -1922,6 +1991,13 @@ end;
    end;
 
 
+  procedure SetWriteModeEx(WriteMode : smallint);
+   begin
+     if (WriteMode >= CopyPut) and (WriteMode <= NotPut) then
+       CurrentWriteMode := WriteMode;
+   end;
+
+
   procedure GetFillSettings(var Fillinfo:Fillsettingstype);
    begin
      Fillinfo:=Fillsettings;

+ 18 - 11
packages/graph/src/inc/graphh.inc

@@ -434,6 +434,12 @@ type
 
 
     type
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
+       ColorType = LongWord;
+{$else FPC_GRAPH_SUPPORTS_TRUECOLOR}
+       ColorType = Word;
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
+
        RGBRec = packed record
          Red: smallint;
          Green: smallint;
@@ -461,7 +467,7 @@ type
 
        FillSettingsType = record
              pattern : word;
-             color : word;
+             color : ColorType;
        end;
 
        FillPatternType = array[1..8] of byte;
@@ -518,8 +524,8 @@ TYPE
        defpixelproc = procedure(X,Y: smallint);
 
        { standard plot and get pixel                                }
-       getpixelproc = function(X,Y: smallint): word;
-       putpixelproc = procedure(X,Y: smallint; Color: Word);
+       getpixelproc = function(X,Y: smallint): ColorType;
+       putpixelproc = procedure(X,Y: smallint; Color: ColorType);
 
        { clears the viewport, also used to clear the device         }
        clrviewproc  = procedure;
@@ -589,8 +595,8 @@ TYPE
 
        CircleProc = procedure(X, Y: smallint; Radius:Word);
 
-       SetBkColorProc = procedure(ColorNum: Word);
-       GetBkColorProc = function: Word;
+       SetBkColorProc = procedure(ColorNum: ColorType);
+       GetBkColorProc = function: ColorType;
 
 
 TYPE
@@ -752,6 +758,7 @@ procedure GraphDefaults;
 procedure ClearDevice;
 procedure GetViewSettings(var viewport : ViewPortType);
 procedure SetWriteMode(WriteMode : smallint);
+procedure SetWriteModeEx(WriteMode : smallint);
 procedure GetFillSettings(var Fillinfo:Fillsettingstype);
 procedure GetFillPattern(var FillPattern:FillPatternType);
 procedure GetLineSettings(var ActiveLineInfo : LineSettingsType);
@@ -759,8 +766,8 @@ procedure InitGraph(var GraphDriver:smallint;var GraphMode:smallint;const PathTo
 procedure DetectGraph(var GraphDriver:smallint;var GraphMode:smallint);
 function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
 function RegisterBGIDriver(driver: pointer): smallint;
-procedure SetFillStyle(Pattern : word; Color: word);
-procedure SetFillPattern(Pattern: FillPatternType; Color: word);
+procedure SetFillStyle(Pattern : word; Color: ColorType);
+procedure SetFillPattern(Pattern: FillPatternType; Color: ColorType);
 Function GetDriverName: string;
  procedure MoveRel(Dx, Dy: smallint);
  procedure MoveTo(X,Y: smallint);
@@ -769,9 +776,9 @@ Function GetDriverName: string;
  function GetDirectVideo: boolean;
 
  { -------------------- Color/Palette ------------------------------- }
- function  GetColor: Word;
- procedure SetColor(Color: Word);
- function  GetMaxColor: word;
+ function  GetColor: ColorType;
+ procedure SetColor(Color: ColorType);
+ function  GetMaxColor: ColorType;
 
  procedure SetPalette(ColorNum: word; Color: shortint);
  procedure GetPalette(var Palette: PaletteType);
@@ -787,7 +794,7 @@ Function GetDriverName: string;
  procedure DrawPoly(NumPoints : word;var polypoints);
  procedure LineRel(Dx, Dy: smallint);
  procedure LineTo(X,Y : smallint);
- procedure FloodFill(x : smallint; y : smallint; Border: word);
+ procedure FloodFill(x : smallint; y : smallint; Border: ColorType);
 
  { -------------------- Circle related routines --------------------- }
  procedure GetAspectRatio(var Xasp,Yasp : word);

+ 3 - 1
packages/graph/src/inc/modes.inc

@@ -31,9 +31,11 @@
      4096: driver := D12bit;
      32768: driver := D15bit;
      65536: driver := D16bit;
-{    not yet supported
+{$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}
      65536*256: driver := D24bit;
+{    not yet supported
      65536*65536: driver := D32bit;}
+{$endif FPC_GRAPH_SUPPORTS_TRUECOLOR}
      else
        begin
          driver := maxsmallint;

File diff suppressed because it is too large
+ 250 - 383
packages/graph/src/msdos/graph.pp


+ 43 - 59
packages/graph/src/msdos/vesa.inc

@@ -217,7 +217,7 @@ end;
  {*                     8-bit pixels VESA mode routines                  *}
  {************************************************************************}
 
-  procedure PutPixVESA256(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA256(x, y : smallint; color : ColorType);
   var
      offs : longint;
   begin
@@ -239,7 +239,7 @@ end;
        end;
   end;
 
-  procedure DirectPutPixVESA256(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA256(x, y : smallint);
   var
      offs : longint;
      col : byte;
@@ -272,7 +272,7 @@ end;
      mem[WinWriteSeg : word(offs)] := Col;
   end;
 
-  function GetPixVESA256(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
+  function GetPixVESA256(x, y : smallint): ColorType;
   var
      offs : longint;
   begin
@@ -283,7 +283,7 @@ end;
      GetPixVESA256:=mem[WinReadSeg : word(offs)];
   end;
 
-  Procedure GetScanLineVESA256(x1, x2, y: smallint; var data); {$ifndef fpc}far;{$endif}
+  Procedure GetScanLineVESA256(x1, x2, y: smallint; var data);
   var offs: Longint;
       l, amount, bankrest, index, pixels: longint;
       curbank: smallint;
@@ -372,7 +372,7 @@ end;
     Until amount = 0;
   end;
 
-  procedure HLineVESA256(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineVESA256(x,x2,y: smallint);
 
    var Offs: Longint;
        mask, l, bankrest: longint;
@@ -695,7 +695,7 @@ end;
        end;
    end;
 
-  procedure VLineVESA256(x,y,y2: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure VLineVESA256(x,y,y2: smallint);
 
    var Offs: Longint;
        l, bankrest: longint;
@@ -850,7 +850,7 @@ end;
        end;
    end;
 
-  procedure PatternLineVESA256(x1,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure PatternLineVESA256(x1,x2,y: smallint);
   {********************************************************}
   { Draws a horizontal patterned line according to the     }
   { current Fill Settings.                                 }
@@ -983,7 +983,7 @@ end;
  {*                    15/16bit pixels VESA mode routines                *}
  {************************************************************************}
 
-  procedure PutPixVESA32kOr64k(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA32kOr64k(x, y : smallint; color : ColorType);
   var
      offs : longint;
      place: word;
@@ -1015,7 +1015,7 @@ end;
      memW[WinWriteSeg : place] := color;
   end;
 
-  function GetPixVESA32kOr64k(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
+  function GetPixVESA32kOr64k(x, y : smallint): ColorType;
   var
      offs : longint;
   begin
@@ -1026,7 +1026,7 @@ end;
      GetPixVESA32kOr64k:=memW[WinReadSeg : word(offs)];
   end;
 
-  procedure DirectPutPixVESA32kOr64k(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA32kOr64k(x, y : smallint);
   var
      offs : longint;
      bank : smallint;
@@ -1071,7 +1071,7 @@ end;
      End;
   end;
 
-  procedure HLineVESA32kOr64k(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineVESA32kOr64k(x,x2,y: smallint);
 
    var Offs: Longint;
        mask, l, bankrest: longint;
@@ -1393,7 +1393,7 @@ end;
  {*                     4-bit pixels VESA mode routines                  *}
  {************************************************************************}
 
-  procedure PutPixVESA16(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
+  procedure PutPixVESA16(x, y : smallint; color : ColorType);
     var
      offs : longint;
      dummy : byte;
@@ -1428,7 +1428,7 @@ end;
   end;
 
 
- Function GetPixVESA16(X,Y: smallint):word; {$ifndef fpc}far;{$endif fpc}
+ Function GetPixVESA16(X,Y: smallint):ColorType;
  Var dummy: Word;
      offset: longint;
      shift: byte;
@@ -1450,7 +1450,7 @@ end;
   end;
 
 
-  procedure DirectPutPixVESA16(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure DirectPutPixVESA16(x, y : smallint);
     var
      offs : longint;
      dummy : byte;
@@ -1495,7 +1495,7 @@ end;
   end;
 
 
-  procedure HLineVESA16(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineVESA16(x,x2,y: smallint);
   var
       xtmp: smallint;
       ScrOfs, BankRest: longint;
@@ -1933,24 +1933,16 @@ end;
    asm
     mov ax,4F02h
     mov bx,mode
-{$ifdef fpc}
+    push ds
     push bp
-    push si
-    push di
-    push bx
-{$endif fpc}
     int 10h
-{$ifdef fpc}
-    pop bx
-    pop di
-    pop si
     pop bp
-{$endif fpc}
+    pop ds
     sub ax,004Fh
     cmp ax,1
     sbb al,al
     mov res,al
-   end ['BX','AX'];
+   end ['DX','CX','BX','AX','SI','DI'];
    if not res then
      _GraphResult := GrNotDetected
    else _GraphResult := grOk;
@@ -1980,21 +1972,21 @@ end;
      GetMaxScanLines := regs.dx;
    end;
 
- procedure Init1280x1024x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x64k;
   begin
     SetVesaMode(m1280x1024x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1280x1024x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x32k;
   begin
     SetVESAMode(m1280x1024x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1280x1024x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x256;
   begin
     SetVESAMode(m1280x1024x256);
     { Get maximum number of scanlines for page flipping }
@@ -2002,105 +1994,105 @@ end;
   end;
 
 
- procedure Init1280x1024x16; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1280x1024x16;
   begin
     SetVESAMode(m1280x1024x16);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x64k;
   begin
     SetVESAMode(m1024x768x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x32k;
   begin
     SetVESAMode(m1024x768x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x256;
   begin
     SetVESAMode(m1024x768x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init1024x768x16; {$ifndef fpc}far;{$endif fpc}
+ procedure Init1024x768x16;
   begin
     SetVESAMode(m1024x768x16);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x64k;
   begin
     SetVESAMode(m800x600x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x32k;
   begin
     SetVESAMode(m800x600x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x256;
   begin
     SetVESAMode(m800x600x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init800x600x16; {$ifndef fpc}far;{$endif fpc}
+ procedure Init800x600x16;
   begin
     SetVesaMode(m800x600x16);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x480x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x480x64k;
   begin
     SetVESAMode(m640x480x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x480x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x480x32k;
   begin
     SetVESAMode(m640x480x32k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x480x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x480x256;
   begin
     SetVESAMode(m640x480x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init640x400x256; {$ifndef fpc}far;{$endif fpc}
+ procedure Init640x400x256;
   begin
     SetVESAMode(m640x400x256);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init320x200x64k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init320x200x64k;
   begin
     SetVESAMode(m320x200x64k);
     { Get maximum number of scanlines for page flipping }
     ScanLines := GetMaxScanLines;
   end;
 
- procedure Init320x200x32k; {$ifndef fpc}far;{$endif fpc}
+ procedure Init320x200x32k;
   begin
     SetVESAMode(m320x200x32k);
     { Get maximum number of scanlines for page flipping }
@@ -2109,7 +2101,7 @@ end;
 
 
 
- Procedure SaveStateVESA; {$ifndef fpc}far;{$endif fpc}
+ Procedure SaveStateVESA;
  var
   regs: Registers;
   begin
@@ -2161,7 +2153,7 @@ end;
       end;
   end;
 
- procedure RestoreStateVESA; {$ifndef fpc}far;{$endif fpc}
+ procedure RestoreStateVESA;
   var
    regs:Registers;
    SavePtrCopy: Pointer;
@@ -2202,7 +2194,7 @@ end;
   { between VBE versions , we will use the old method where }
   { the new pixel offset is used to display different pages }
   {******************************************************** }
- procedure SetVisualVESA(page: word); {$ifndef fpc}far;{$endif fpc}
+ procedure SetVisualVESA(page: word);
   var
    newStartVisible : word;
   begin
@@ -2222,23 +2214,15 @@ end;
       mov bx, 0000h   { set display start }
       mov cx, 0000h   { pixel zero !      }
       mov dx, [NewStartVisible]  { new scanline }
-{$ifdef fpc}
+      push    ds
       push    bp
-      push    si
-      push    di
-      push    bx
-{$endif}
       int     10h
-{$ifdef fpc}
-      pop     bx
-      pop     di
-      pop     si
       pop     bp
-{$endif}
-    end ['DX','CX','BX','AX'];
+      pop     ds
+    end ['DX','CX','BX','AX','SI','DI'];
   end;
 
- procedure SetActiveVESA(page: word); {$ifndef fpc}far;{$endif fpc}
+ procedure SetActiveVESA(page: word);
   begin
     { video offset is in pixels under VESA VBE! }
     { This value is reset after a mode set to page ZERO = YOffset = 0 ) }

File diff suppressed because it is too large
+ 683 - 69
packages/graph/src/ptcgraph/ptcgraph.pp


Some files were not shown because too many files changed in this diff