View Issue Details

IDProjectCategoryView StatusLast Update
0034661FPCPackagespublic2018-12-09 10:04
ReporterPavel KudrnaAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWindowsOS Version
Product Version3.0.4Product Build 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034661: Mode 1024x768 does not work in Graph unit
DescriptionThe MaxY value in

packages\graph\src\win32\graph.pp line 2193 is specified as

          mode.MaxY := 768;

but the correct value should be one less, i.e. 767.

The test program below gives "Error number -10, error text: Invalid graphics mode." for grMode value m1024x768 but works well m800x600 and m640x480.

After the suggested change in graph.pp the mode m1024x768 is accepted.
Steps To ReproduceProgram Test1024x768;
Var grDriver,grMode,grError: SmallInt;
BEGIN
 grDriver:=D8bit;
 grMode:=m1024x768; // fails bust both m640x480 and m800x600 work well

 InitGraph(grDriver,grMode,'');
 grError:=GraphResult;
 if grError<>GrOk then WriteLn( 'InitGraph error number ', grError,
                                ', error text: ', GraphErrorMsg(grError) '.'
                              );
  Write(); ReadLn;
END.
Additional InformationI suggest to write all the MaxX and MaxY constants in graph.pp this way:
mode.MaxX := 1024-1;
mode.MaxY := 768-1;

Another minor problem is that the mode names are often longer than 18
characters specified for ModeName item in
packages\graph\src\inc\graphh.inc line 622:
      ModeName: String[18];
and are truncated.

E.g. in line 2220 in graph.pp the constant is 25 characters:
mode.ModeName:='1280 x 1024 x 16 Win32GUI';

Probably the string space should be increased rather than to shorten most of the mode name strings.
Tagsgraph, win32, win64
Fixed in Revision40511
FPCOldBugId
FPCTarget
Attached Files

Activities

rd0x

2018-12-08 10:49

reporter   ~0112446

Last edited: 2018-12-08 10:51

View 2 revisions

It does also fail on Free Pascal Compiler version 3.2.0-beta-r40301 [2018/12/01] for x86_64 (Win64).
But your code above doesn't work for me, so I changed it to:

Program Test1024x768;

uses graph, SysUtils;

Var grDriver,grMode,grError: SmallInt;
BEGIN
 grDriver:=D8bit;
 grMode:=m1024x768; // fails bust both m640x480 and m800x600 work well

 InitGraph(grDriver,grMode,'');
 grError:=GraphResult;
 if grError<>GrOk then
    WriteLn('InitGraph error number :' + IntToStr(grError) + ', error text: ' + GraphErrorMsg(grError) + '.');
  Write();
  ReadLn;
END.

Tested with fpc file.pas and fpc -MDelphi file.pas

BrunoK

2018-12-08 12:31

reporter   ~0112448

@Pavel Kudrna

I confirm that rd0x program fails.

It would be more consistent to change line 2193 of graph.pp (mode.MaxY := 768;) to

mode.MaxY := 767;

so the coding style of setting up MaxX, MaxY conforms to the other modes initialization in queryadapterinfo

jamie philbrook

2018-12-08 17:30

reporter   ~0112453

Its only the 256 color mode of that RES has the issue when enumerating the
list.
 It could be fixed easy I guess at coding time with an overwrite.

 Overwrite the MaxX within the QueryList before initiating the video mode until
this gets fixed..

Michael Van Canneyt

2018-12-09 10:04

administrator   ~0112460

Fixed the maxY, increased modename length to 32.

Issue History

Date Modified Username Field Change
2018-12-07 19:01 Pavel Kudrna New Issue
2018-12-07 22:58 Pavel Kudrna Tag Attached: graph
2018-12-07 22:58 Pavel Kudrna Tag Attached: win32
2018-12-07 22:58 Pavel Kudrna Tag Attached: win64
2018-12-08 10:49 rd0x Note Added: 0112446
2018-12-08 10:51 rd0x Note Edited: 0112446 View Revisions
2018-12-08 12:31 BrunoK Note Added: 0112448
2018-12-08 17:30 jamie philbrook Note Added: 0112453
2018-12-09 10:04 Michael Van Canneyt Fixed in Revision => 40511
2018-12-09 10:04 Michael Van Canneyt Note Added: 0112460
2018-12-09 10:04 Michael Van Canneyt Status new => resolved
2018-12-09 10:04 Michael Van Canneyt Fixed in Version => 3.3.1
2018-12-09 10:04 Michael Van Canneyt Resolution open => fixed
2018-12-09 10:04 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-12-09 10:04 Michael Van Canneyt Target Version => 3.2.0