2
0
Эх сурвалжийг харах

--- Merging r48428 into '.':
U packages/pasjpeg/examples/example.pas
--- Recording mergeinfo for merge of r48428 into '.':
U .
--- Merging r48431 into '.':
A packages/pasjpeg/examples/demo.lpi
--- Recording mergeinfo for merge of r48431 into '.':
G .
--- Merging r48463 into '.':
U packages/graph/src/inc/graph.tex
--- Recording mergeinfo for merge of r48463 into '.':
G .
--- Merging r48115 into '.':
U packages/fv/src/views.pas
--- Recording mergeinfo for merge of r48115 into '.':
G .

# revisions: 48428,48431,48463,48115
r48428 | florian | 2021-01-25 22:29:14 +0100 (Mon, 25 Jan 2021) | 1 line
Changed paths:
M /trunk/packages/pasjpeg/examples/example.pas

* fix demo example for delphi_stream being defined
r48431 | florian | 2021-01-26 23:00:33 +0100 (Tue, 26 Jan 2021) | 1 line
Changed paths:
A /trunk/packages/pasjpeg/examples/demo.lpi

+ lazarus project for demo
r48463 | nickysn | 2021-01-31 12:08:21 +0100 (Sun, 31 Jan 2021) | 1 line
Changed paths:
M /trunk/packages/graph/src/inc/graph.tex

* set eol-style=native and mime-type=text/plain to graph.tex
r48115 | florian | 2021-01-08 17:33:05 +0100 (Fri, 08 Jan 2021) | 1 line
Changed paths:
M /trunk/packages/fv/src/views.pas

* avoid div by zero in TView.CalcBounds.GrowI, resolves #30922

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

marco 4 жил өмнө
parent
commit
48ba8f691d

+ 2 - 1
.gitattributes

@@ -5117,7 +5117,7 @@ packages/graph/src/inc/clip.inc svneol=native#text/plain
 packages/graph/src/inc/fills.inc svneol=native#text/plain
 packages/graph/src/inc/fontdata.inc svneol=native#text/plain
 packages/graph/src/inc/graph.inc svneol=native#text/plain
-packages/graph/src/inc/graph.tex -text
+packages/graph/src/inc/graph.tex svneol=native#text/plain
 packages/graph/src/inc/graphh.inc svneol=native#text/plain
 packages/graph/src/inc/gtext.inc svneol=native#text/plain
 packages/graph/src/inc/makefile.inc svneol=native#text/plain
@@ -8064,6 +8064,7 @@ packages/pasjpeg/examples/cderror.pas svneol=native#text/plain
 packages/pasjpeg/examples/cdjpeg.pas svneol=native#text/plain
 packages/pasjpeg/examples/cjpeg.pas svneol=native#text/plain
 packages/pasjpeg/examples/cjpeg.res svneol=native#text/plain
+packages/pasjpeg/examples/demo.lpi svneol=native#text/plain
 packages/pasjpeg/examples/demo.pas svneol=native#text/plain
 packages/pasjpeg/examples/demo.res svneol=native#text/plain
 packages/pasjpeg/examples/djpeg.pas svneol=native#text/plain

+ 2 - 1
packages/fv/src/views.pas

@@ -1899,7 +1899,8 @@ VAR S, D: Sw_Integer; Min, Max: TPoint;
    PROCEDURE GrowI (Var I: Sw_Integer);
    BEGIN
      If (GrowMode AND gfGrowRel = 0) Then Inc(I, D)
-       Else I := (I * S + (S - D) SHR 1) DIV (S - D); { Calc grow value }
+       Else If  S = D then I := 1
+         Else I := (I * S + (S - D) SHR 1) DIV (S - D); { Calc grow value }
    END;
 
 BEGIN

+ 53 - 0
packages/pasjpeg/examples/demo.lpi

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="12"/>
+    <General>
+      <Flags>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+        <MainUnitHasScaledStatement Value="False"/>
+        <UseDefaultCompilerOptions Value="True"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <Title Value="demo"/>
+      <UseAppBundle Value="False"/>
+      <ResourceType Value="res"/>
+    </General>
+    <BuildModes>
+      <Item Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <UseFileFilters Value="True"/>
+    </PublishOptions>
+    <RunParams>
+      <FormatVersion Value="2"/>
+    </RunParams>
+    <Units>
+      <Unit>
+        <Filename Value="demo.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="Demo"/>
+      </Unit>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="11"/>
+    <Target>
+      <Filename Value="demo"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <OtherUnitFiles Value="../src"/>
+      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions>
+      <Item>
+        <Name Value="ECompilerAbort"/>
+      </Item>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 38 - 2
packages/pasjpeg/examples/example.pas

@@ -1,3 +1,8 @@
+{$IFDEF FPC}
+{$MODE DELPHI}
+{$GOTO ON}
+{$DEFINE DELPHI_STREAM}
+{$ENDIF}
 Unit example;
 
 { This file illustrates how to use the IJG code as a subroutine library
@@ -37,6 +42,10 @@ function read_JPEG_file (filename : string) : boolean;
 
 implementation
 
+{$ifdef delphi_stream}
+  uses
+    Classes;
+{$endif delphi_stream}
 { <setjmp.h> is used for the optional error recovery mechanism shown in
   the second part of the example. }
 
@@ -93,7 +102,11 @@ var
 
   jerr : jpeg_error_mgr;
   { More stuff }
+{$ifdef delphi_stream}
+  outfile : TFileStream;
+{$else delphi_stream}
   outfile : FILE;               { target file }
+{$endif delphi_stream}
   row_pointer : array[0..0] of JSAMPROW ;       { pointer to JSAMPLE row[s] }
   row_stride : int;             { physical row width in image buffer }
 begin
@@ -117,7 +130,9 @@ begin
     stdio stream.  You can also write your own code to do something else.
     VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
     requires it in order to write binary files. }
-
+{$ifdef delphi_stream}
+  outfile := TFileStream.Create(filename, fmCreate);
+{$else delphi_stream}
   Assign(outfile, filename);
   {$push}{$I-}
   ReWrite(outfile, 1);
@@ -127,6 +142,7 @@ begin
     WriteLn(output, 'can''t open ', filename);
     Halt(1);
   end;
+{$endif delphi_stream}
   jpeg_stdio_dest(@cinfo, @outfile);
 
   { Step 3: set parameters for compression }
@@ -179,7 +195,11 @@ begin
 
   jpeg_finish_compress(@cinfo);
   { After finish_compress, we can close the output file. }
+{$ifdef delphi_stream}
+  outfile.Free;
+{$else delphi_stream}
   system.close(outfile);
+{$endif delphi_stream}
 
   { Step 7: release JPEG compression object }
 
@@ -321,7 +341,11 @@ var
 
   jerr  : my_error_mgr;
   { More stuff }
-  infile : FILE;                { source file }
+{$ifdef delphi_stream}
+  infile : TFileStream;
+{$else delphi_stream}
+  infile : FILE;               { target file }
+{$endif delphi_stream}
   buffer : JSAMPARRAY;          { Output row buffer }
   row_stride : int;             { physical row width in output buffer }
 begin
@@ -331,6 +355,9 @@ begin
     VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
     requires it in order to read binary files. }
 
+{$ifdef delphi_stream}
+  infile := TFileStream.Create(filename, fmOpenRead);
+{$else delphi_stream}
   Assign(infile, filename);
   {$push}{$I-}
   Reset(infile, 1);
@@ -341,6 +368,7 @@ begin
     read_JPEG_file := FALSE;
     exit;
   end;
+{$endif delphi_stream}
 
   { Step 1: allocate and initialize JPEG decompression object }
 
@@ -356,7 +384,11 @@ begin
     { Nomssi: if we get here, we are in trouble, because e.g. cinfo.mem
               is not guaranted to be NIL }
     jpeg_destroy_decompress(@cinfo);
+{$ifdef delphi_stream}
+    infile.Free;
+{$else delphi_stream}
     system.close(infile);
+{$endif delphi_stream}
     read_JPEG_file := FALSE;
     exit;
   end;
@@ -440,7 +472,11 @@ begin
     Here we postpone it until after no more JPEG errors are possible,
     so as to simplify the setjmp error logic above.  (Actually, I don't
     think that jpeg_destroy can do an error exit, but why assume anything...) }
+{$ifdef delphi_stream}
+  infile.Free;
+{$else delphi_stream}
   system.close(infile);
+{$endif delphi_stream}
 
   { At this point you may want to check to see whether any corrupt-data
     warnings occurred (test whether jerr.pub.num_warnings is nonzero). }