diff --git a/SynZip.pas b/SynZip.pas index f59fe1c..dbfdea3 100755 --- a/SynZip.pas +++ b/SynZip.pas @@ -162,9 +162,22 @@ - unit fixed and tested with Delphi XE2 (and up) 64-bit compiler } +{$ifdef DARWIN} + {$ifdef CPUAARCH64} + //Apple's provided zlib just as fast as CloudFlare + //{$define USEZLIBSSE} + {$ELSE} + {$define USEZLIBSSE} + {$ENDIF} +{$endif} +{$ifdef LINUX} + {$define USEZLIBSSE} +{$endif} {$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 + + {$ifdef MSWINDOWS} {$define USEZLIBSSE} {$endif} @@ -180,7 +193,7 @@ {$ifdef MSWINDOWS} // avoid link to zlib1.dll {.$define USEPASZLIB} // paszlib makes Z_BUF_ERROR with bits = -MAX_WBITS {$ifdef Win32} - {.$define USEZLIBSSE} // SynZLibSSE static .o files for FPC + Win32 fails + {.$define libz} // SynZLibSSE static .o files for FPC + Win32 fails {$endif} {$ifdef Win64} {.$define USEEXTZLIB} // use zlib-64.dll as in \fpc-win64 sub-folder @@ -190,7 +203,11 @@ {$ifdef ANDROID} {$define USEPASZLIB} // Alf: problem with external zlib.so under Android {$else} + {$ifdef USEZLIBSSE} + {.$define USEEXTZLIB} + {$ELSE} {$define USEEXTZLIB} + {$ENDIF} {$endif} {$endif} {$else} @@ -5034,16 +5051,72 @@ function get_crc_table: pointer; cdecl; {$LINK static\i386-win32\crc32.o} {$linklib static\i386-win32\libmsvcrt.a} {$endif} + {$ifdef LINUX}{$ifndef DARWIN} + {$ifdef USEZLIBSSE} + {$L .\x86_64-linux\adler32.o} + {$L .\x86_64-linux\adler32_simd.o} + {$L .\x86_64-linux\crc32.o} + {$L .\x86_64-linux\crc32_simd.o} + {$L .\x86_64-linux\deflate.o} + {$L .\x86_64-linux\inffast.o} + {$L .\x86_64-linux\inffast_chunk.o} + {$L .\x86_64-linux\inflate.o} + {$L .\x86_64-linux\inftrees.o} + {$L .\x86_64-linux\trees.o} + {$L .\x86_64-linux\zutil.o} + {$ENDIF} + {$ENDIF}{$ENDIF} + {$ifdef DARWIN} + {$ifdef USEZLIBSSE} + {$ifdef CPUAARCH64} + {$L .\aarch64-darwin\adler32.o} + {$L .\aarch64-darwin\adler32_simd.o} + {$L .\aarch64-darwin\crc32.o} + //{$L .\aarch64-darwin\crc32_simd.o} + {$L .\aarch64-darwin\deflate.o} + {$L .\aarch64-darwin\inffast.o} + //{$L .\aarch64-darwin\inffast_chunk.o} + {$L .\aarch64-darwin\inflate.o} + {$L .\aarch64-darwin\inftrees.o} + {$L .\aarch64-darwin\trees.o} + {$L .\aarch64-darwin\zutil.o} + {$ELSE} + {$L .\x86_64-darwin\adler32.o} + {$L .\x86_64-darwin\adler32_simd.o} + {$L .\x86_64-darwin\crc32.o} + {$L .\x86_64-darwin\crc32_simd.o} + {$L .\x86_64-darwin\deflate.o} + {$L .\x86_64-darwin\inffast.o} + {$L .\x86_64-darwin\inffast_chunk.o} + {$L .\x86_64-darwin\inflate.o} + {$L .\x86_64-darwin\inftrees.o} + {$L .\x86_64-darwin\trees.o} + {$L .\x86_64-darwin\zutil.o} + {$ENDIF} + {$ENDIF} + {$ENDIF} {$ifdef WIN64} {$ifdef USEZLIBSSE} - {$L ..\static\x86_64-win64\sse\inffast.o} + (*{$L ..\static\x86_64-win64\sse\inffast.o} {$L ..\static\x86_64-win64\sse\inftrees.o} {$L ..\static\x86_64-win64\sse\inflate.o} {$L ..\static\x86_64-win64\sse\deflate.o} {$L ..\static\x86_64-win64\sse\trees.o} {$L ..\static\x86_64-win64\sse\adler32.o} {$L ..\static\x86_64-win64\sse\crc32.o} - {$L ..\static\x86_64-win64\sse\zutil.o} + {$L ..\static\x86_64-win64\sse\zutil.o} *) + {$L .\x86_64-win64\adler32_simd.o} + {$L .\x86_64-win64\crc32_simd.o} + {$L .\x86_64-win64\inffast_chunk.o} + {$L .\x86_64-win64\inffast.o} + {$L .\x86_64-win64\inftrees.o} + {$L .\x86_64-win64\inflate.o} + {$L .\x86_64-win64\deflate.o} + {$L .\x86_64-win64\trees.o} + {$L .\x86_64-win64\adler32.o} + {$L .\x86_64-win64\crc32.o} + {$L .\x86_64-win64\zutil.o} + {$else USEZLIBSSE} {$L static\x86_64-win64\inffast.o} {$L static\x86_64-win64\inftrees.o} diff --git a/backup/define_types.pas b/backup/define_types.pas deleted file mode 100755 index d41e6d3..0000000 --- a/backup/define_types.pas +++ /dev/null @@ -1,646 +0,0 @@ -unit define_types; -{$IFDEF Darwin} -{$modeswitch objectivec1} -{$ENDIF} -interface - - -{$ifndef isTerminalApp} - uses graphics; -{$endif} - -const - kVers = 'v1.0.20201028'; - NaN : double = 1/0; - kTab = chr(9); - kCR = chr (13); - kDel = #127 ; // Delete - kBS = #8 ; // Backspace - kUNIXeoln = chr(10); - {$IFDEF UNIX} //end of line - kEOLN = kUNIXeoln; //Windows CRLF ; - {$ELSE} - kEOLN = #13#10; //Windows CRLF - {$ENDIF} - -type - TRGBA = packed record //Next: analyze Format Header structure - R,G,B,A : byte; - end; - {$ifdef isTerminalApp} - TColor = -$7FFFFFFF-1..$7FFFFFFF; - TLUT = array [0..255] of TRGBA; - {$endif} - TPoint4f = packed record - X: single; - Y: single; - Z: single; - W: single - end; - TPoint3f = packed record - X: single; - Y: single; - Z: single - end; - TPoint3i = packed record - X: longint; //ensure 32-bit for simple GIfTI writing - Y: longint; - Z: longint; - end; - TFaces = array of TPoint3i; - TVertices = array of TPoint3f; - TVertexRGBA = array of TRGBA; - TBools = array of boolean; - TInts = array of integer; - TUInt8s = array of uint8; - TInt16s = array of int16; - TUInt16s = array of uint16; - TInt32s = array of int32; - TFloats = array of single; - TDoubles = array of double; - TMat33 = array [1..3, 1..3] of single; - TMat44 = array [1..4, 1..4] of single; - TFByte = File of Byte; - TStrRA = Array of String; - TUnitRect = record - L,T,R,B: single; - end; - function ParseFileName(Filename: string): string; -procedure FilenameParts (lInName: string; out lPath,lName,lExt: string); -procedure SensibleUnitRect (var U: TUnitRect); -procedure SortSingle(var lLo,lHi: single); -function RealToStr(lR: double; lDec: integer): string; -function RGBA(lR,lG,lB,lA: byte): TRGBA; -function CreateUnitRect (L,T,R,B: single) : TUnitRect; -procedure IntBound (var lVal: integer; lMin, lMax: integer); -function UnitBound (lS: single): single; -//procedure ReadLnBin(var f: TFByte; var s: string); -function ReadLnBin(var f: TFByte; var s: string): boolean; inline; -procedure SwapSingle(var s : single); -procedure SwapDouble(var d : double); -procedure SwapLongInt(var s : LongInt); -procedure SwapLongWord(var s : LongWord); -function asPt4f(x,y,z,w: single): TPoint4f; -function asSingle(i : longint): single; overload; -function asSingle(b0,b1,b2,b3: byte): single; overload; -function asInt(s : single): longint; -function StrToFloatX(Const S : String) : Extended; -function specialsingle (var s:single): boolean; //isFinite -function ExtractFileExtGzUpper(FileName: string): string; -function FileExistsF(fnm: string): boolean; //returns false if file exists but is directory -function FSize (lFName: String): longint; -function ChangeFileExtX( lFilename: string; lExt: string): string; -function ReadNumBin(var f: TFByte): string; //read next ASCII number in binary file -function float2str(Avalue:double; ADigits:integer):string; //e.g x:single=2.6; floattostrf(x,8,4); -function DefaultToHomeDir(FileName: string; Force: boolean = false): string; //set path to home if not provided -function UpCaseExt(lFileName: string): string; // "file.gii.dset" -> ".DSET" -function UpCaseExt2(lFileName: string): string; // "file.gii.dset" -> ".GII.DSET" -{$ifdef isTerminalApp} -function RGBToColor(R, G, B: Byte): TColor; -procedure ShowMessage(msg: string); -function Red(rgb: TColor): BYTE; -function Green(rgb: TColor): BYTE; -function Blue(rgb: TColor): BYTE; -{$else} -function asRGBA(clr: TColor): TRGBA; -{$endif} -procedure Xswap4r ( var s:single); - -implementation - -uses - {$IFDEF UNIX} BaseUnix, {$ELSE} windows, shlobj, {$ENDIF} - {$IFDEF Darwin}CocoaAll,{$ENDIF} - fileutil, sysutils, math; - -procedure Xswap4r ( var s:single); -type - swaptype = packed record - case byte of - 0:(Word1,Word2 : word); //word is 16 bit - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; - outguy:swaptype; -begin - inguy := @s; //assign address of s to inguy - outguy.Word1 := swap(inguy^.Word2); - outguy.Word2 := swap(inguy^.Word1); - inguy^.Word1 := outguy.Word1; - inguy^.Word2 := outguy.Word2; -end; - -function UpCaseExt(lFileName: string): string; // "file.gii.dset" -> ".GII.DSET" -var - fnm : string; -begin - result := UpperCase(ExtractFileExt(lFileName)); -end; - - -function UpCaseExt2(lFileName: string): string; // "file.gii.dset" -> ".GII.DSET" -var - fnm : string; -begin - result := UpperCase(ExtractFileExt(lFileName)); - fnm := ExtractFileNameWithoutExt(lFileName); - result := UpperCase(ExtractFileExt(fnm))+ result; -end; - -function StrToFloatX(Const S : String) : Extended; -//like StrToFloat but accepts either decimal separator: '1.23' or '1,23' -var - fmt: TFormatSettings; -begin - fmt := DefaultFormatSettings; - fmt.DecimalSeparator := '.'; - if TryStrToFloat(s, result, fmt) then - exit; - fmt.DecimalSeparator := ','; - result := StrToFloat(S,fmt); -end; - -function FileExistsF(fnm: string): boolean; //returns false if file exists but is directory -begin - result := FileExists(fnm); - if result = false then exit; - result := not DirectoryExists(fnm); - {$IFDEF UNIX} - if result = false then exit; - //showmessage(fnm + inttostr( fpAccess (fnm,R_OK))); - if fpAccess(fnm,R_OK) < 0 then - result := false; - {$ENDIF} -end; - -function HomeDir: string; //set path to home if not provided -{$IFDEF UNIX} -begin - result := expandfilename('~/'); -end; -{$ELSE} -var - SpecialPath: PWideChar; -begin - Result := ''; - SpecialPath := WideStrAlloc(MAX_PATH); - try - FillChar(SpecialPath^, MAX_PATH, 0); - if SHGetSpecialFolderPathW(0, SpecialPath, CSIDL_PERSONAL, False) then - Result := SpecialPath+pathdelim; - finally - StrDispose(SpecialPath); - end; -end; -{$ENDIF} - -function DefaultToHomeDir(FileName: string; Force: boolean = false ): string; //set path to home if not provided -var - p,n,x: string; -begin - result := FileName; - FilenameParts (Filename, p,n,x); - if (not Force) and (p <> '') and (DirectoryExists(p)) then exit; - {$IFDEF LCLCocoa} - //p := HomeDir; //set path to home if not provided - p := NSTemporaryDirectory.UTF8String; - {$ELSE} - p := HomeDir; //set path to home if not provided - {$ENDIF} - result := p+n+x; -end; - -{$IFDEF oldFloat2Str} -function float2str(Avalue:double; ADigits:integer):string; //e.g x:single=2.6; floattostrf(x,8,4); -begin - result := FloatToStrF(Avalue, ffFixed,7,ADigits); -end; -{$ELSE} -function float2str(Avalue:double; ADigits:integer):string; //e.g x:single=2.6; floattostrf(x,8,4); -//http://stackoverflow.com/questions/5650051/how-to-keep-2-decimal-places-in-delphi -var v:double; p:integer; e:string; -begin -if abs(Avalue)<1 then -begin - result:=floatTostr(Avalue); - p:=pos('E',result); - if p>0 then - begin - e:=copy(result,p,length(result)); - setlength(result,p-1); - v:=RoundTo(StrToFloat(result),-Adigits); - result:=FloatToStr(v)+e; - end else - result:=FloatToStr(RoundTo(Avalue,-Adigits)); -end -else - result:=FloatToStr(RoundTo(Avalue,-Adigits)); -end; -{$ENDIF} - -{$ifdef isTerminalApp} -function Blue(rgb: TColor): BYTE; -begin - Result := (rgb shr 16) and $000000ff; -end; - -function Green(rgb: TColor): BYTE; -begin - Result := (rgb shr 8) and $000000ff; -end; - -function Red(rgb: TColor): BYTE; -begin - Result := rgb and $000000ff; -end; -function RGBToColor(R, G, B: Byte): TColor; -begin -Result := (B shl 16) or (G shl 8) or R; -end; - -procedure ShowMessage(msg: string); -begin - writeln(msg); -end; -{$else} -function asRGBA(clr: TColor): TRGBA; -begin - result.R := red(clr); - result.G := green(clr); - result.B := blue(clr); - result.A := 255; -end; -{$endif} - -function ReadNumBin(var f: TFByte): string; //read next ASCII number in binary file -var - bt : Byte; - ch : Char; -begin - result := ''; - while (not EOF(f)) do begin - Read(f,bt); - ch := Chr(bt); - if ch in ['-','.','E','e','0'..'9'] then - result := result + ch - else if length(result) > 0 then - exit; - end; -end; - -function asPt4f(x,y,z,w: single): TPoint4f; -begin - result.x := x; - result.y := y; - result.z := z; - result.w := w; -end; - -function ChangeFileExtX( lFilename: string; lExt: string): string; -//sees .nii.gz as single extension -var - lPath,lName,lOrigExt: string; -begin - FilenameParts (lFilename, lPath,lName,lOrigExt); - result := lPath+lName+lExt; -end; - -function FSize (lFName: String): longint; -var F : File Of byte; -begin - result := 0; - if not fileexistsF(lFName) then exit; - FileMode := fmOpenRead; - Assign (F, lFName); - Reset (F); - result := FileSize(F); - Close (F); -end; - -function ParseFileName(Filename: string): string; -var - lPath,lName,lExt: string; -begin - FilenameParts (FileName, lPath,lName,lExt); - result := (lName); -end; - -function ExtractFileExtGzUpper(FileName: string): string; -//the file 'img.nii.gz' returns '.NII.GZ', not just '.gz' -var - lPath,lName,lExt: string; -begin - //result := UpperCase(ExtractFileExt(FileName)); - - FilenameParts (FileName, lPath,lName,lExt); - result := UpperCase(lExt); -end; - -procedure IntBound (var lVal: integer; lMin, lMax: integer); -begin - if lVal < lMin then lVal := lMin; - if lVal > lMax then lVal := lMax; -end; - -function specialsingle (var s:single): boolean; -//returns true if s is Infinity, NAN or Indeterminate -//4byte IEEE: msb[31] = signbit, bits[23-30] exponent, bits[0..22] mantissa -//exponent of all 1s = Infinity, NAN or Indeterminate -const kSpecialExponent = 255 shl 23; -var Overlay: LongInt absolute s; -begin - if ((Overlay and kSpecialExponent) = kSpecialExponent) then - RESULT := true - else - RESULT := false; -end; - -function asSingle(i : longint): single; overload; -type - swaptype = packed record - case byte of - 0:(Lng : longint); - 1:(Sngl : single); - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; -begin - inguy := @i; //assign address of s to inguy - result := inguy^.Sngl; -end; // asSingle() - -function asSingle(b0,b1,b2,b3: byte): single; overload; -type - swaptype = packed record - case byte of - 0:(b0,b1,b2,b3 : byte); - 1:(Sngl : single); - end; - //swaptypep = ^swaptype; -var - //inguy:swaptypep; - outguy:swaptype; -begin //should work with both little and big endian, as order is same - outguy.b0 := b0; - outguy.b1 := b1; - outguy.b2 := b2; - outguy.b3 := b3; - result := outguy.Sngl; -end; // asSingle() - -function asInt(s : single): longint; -type - swaptype = packed record - case byte of - 0:(Lng : longint); - 1:(Sngl : single); - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; -begin - inguy := @s; //assign address of s to inguy - result := inguy^.Lng; -end; // asInt() - -procedure SwapDouble(var d : double); -type - swaptype = packed record - case byte of - 0:(Word1,Word2,Word3,Word4 : word); //word is 16 bit - 1:(float:double); - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; - outguy:swaptype; -begin - inguy := @d; //assign address of s to inguy - outguy.Word1 := swap(inguy^.Word4); - outguy.Word2 := swap(inguy^.Word3); - outguy.Word3 := swap(inguy^.Word2); - outguy.Word4 := swap(inguy^.Word1); - try - d:=outguy.float; - except - d := 0; - exit; - end; -end; //func SwapDouble - -procedure SwapSingle(var s : single); -type - swaptype = packed record - case byte of - 0:(Word1,Word2 : word); - 1:(Sngl : single); - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; - outguy:swaptype; -begin - inguy := @s; //assign address of s to inguy - outguy.Word1 := swap(inguy^.Word2); - outguy.Word2 := swap(inguy^.Word1); - s := outguy.Sngl; -end; // SwapSingle() - -procedure SwapLongInt(var s : LongInt); -type - swaptype = packed record - case byte of - 0:(Word1,Word2 : word); //word is 16 bit - 1:(Long:LongInt); - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; - outguy:swaptype; -begin - inguy := @s; //assign address of s to inguy - outguy.Word1 := swap(inguy^.Word2); - outguy.Word2 := swap(inguy^.Word1); - s := outguy.Long; -end; // SwapLongInt() - -procedure SwapLongWord(var s : LongWord); -type - swaptype = packed record - case byte of - 0:(Word1,Word2 : word); //word is 16 bit - 1:(Long:LongWord); - end; - swaptypep = ^swaptype; -var - inguy:swaptypep; - outguy:swaptype; -begin - inguy := @s; //assign address of s to inguy - outguy.Word1 := swap(inguy^.Word2); - outguy.Word2 := swap(inguy^.Word1); - s := outguy.Long; -end; // SwapLongWord() - -{$IFDEF SLOWREADLNBIN} -procedure ReadLnBin(var f: TFByte; var s: string); -const - kEOLN = $0A; -var - bt : Byte; -begin - s := ''; - while (not EOF(f)) do begin - Read(f,bt); - if bt = kEOLN then exit; - s := s + Chr(bt); - end; -end; -{$ELSE} -function ReadLnBin(var f: TFByte; var s: string): boolean; inline; -const - kEOLN = $0A; -var - bt : Byte; -begin - s := ''; - //while (not EOF(f)) do begin //<- half the speed! - while (true) do begin - try - Read(f,bt); - except - exit(false); - end; - if bt = kEOLN then exit(true); - s := s + Chr(bt); - end; -end; -{$ENDIF} - -function RGBA(lR,lG,lB,lA: byte): TRGBA; -//set red,green,blue and alpha of a Quad -begin - result.r := lR; - result.g := lG; - result.b := lB; - result.a := lA; -end; - -function RealToStr(lR: double; lDec: integer): string; -begin - result := FloatToStrF(lR, ffFixed,7,lDec); -end; - -procedure FilenameParts (lInName: string; out lPath,lName,lExt: string); -var - lX: string; -begin - lPath := ExtractFilePath(lInName); - lName := ExtractFileName(lInName); - lExt := ExtractFileExt(lInName); - if lExt = '' then exit; - Delete(lName, length(lName)-length(lExt)+1, length(lExt)); //nam.ext -> nam - lX := lExt; - if UpperCase(lX) <> '.GZ' then exit; - lExt := ExtractFileExt(lName); - Delete(lName, length(lName)-length(lExt)+1, length(lExt)); //nam.ext -> nam - lExt := lExt + lX; - //showmessage(lName+':'+lExt); -end; - -(*function FilenameParts (lInName: string; var lPath,lName,lExt: string): boolean; -var - lLen,lPos,lExtPos,lPathPos: integer; -begin - result := false; - lPath := ''; - lName := ''; - lExt := ''; - lLen := length(lInName); - if lLen < 1 then exit; - //next find final pathdelim - lPathPos := lLen; - while (lPathPos > 0) and (lInName[lPathPos] <> '\') and (lInName[lPathPos] <> '/') do - dec(lPathPos); - if (lInName[lPathPos] = '\') or (lInName[lPathPos] = '/') then begin - for lPos := 1 to lPathPos do - lPath := lPath + lInName[lPos]; - end; - // else - // dec(lPathPos); - inc(lPathPos); - //next find first ext - lExtPos := 1; - while (lExtPos <= lLen) and (lInName[lExtPos] <> '.') do - inc(lExtPos); - if (lInName[lExtPos] = '.') then begin - for lPos := lExtPos to lLen do - lExt := lExt + lInName[lPos]; - end; - // else - // inc(lExtPos); - dec(lExtPos); - //next extract filename - //fx(lPathPos,lExtPos); - - if (lPathPos <= lExtPos) then - for lPos := lPathPos to lExtPos do - lName := lName + lInName[lPos]; - result := true; -end; *) - -procedure SortSingle(var lLo,lHi: single); -var lSwap: single; -begin - if lLo > lHi then begin - lSwap := lLo; - lLo := lHi; - lHi := lSwap; - end; //if Lo>Hi -end; //proc SortSingle - -function UnitBound (lS: single): single; -begin - if lS < 0 then - result := 0 - else if lS > 1 then - result := 1 - else - result := lS; -end; - -procedure SensibleUnitRect (var U: TUnitRect); -begin - U.L := UnitBound(U.L); - U.T := UnitBound(U.T); - U.R := UnitBound(U.R); - U.B := UnitBound(U.B); - //left should be lower value than right - SortSingle(U.L,U.R); - if U.L = U.R then begin - if U.R < 0.1 then - U.R := 0.1 - else - U.L := U.R -0.1; - end; - //bottom should lower value than top - SortSingle(U.B,U.T); - if U.B = U.T then begin - if U.T < 0.1 then - U.T := 0.1 - else - U.B := U.T -0.1; - end; -end; - -function CreateUnitRect (L,T,R,B: single) : TUnitRect; -begin - result.L := UnitBound(L); - result.T := UnitBound(T); - result.R := UnitBound(R); - result.B := UnitBound(B); -end; - -end. diff --git a/backup/surfice.lps b/backup/surfice.lps deleted file mode 100644 index c2ec00b..0000000 --- a/backup/surfice.lps +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mainunit.lfm b/mainunit.lfm index 1e2fc1e..5f78434 100755 --- a/mainunit.lfm +++ b/mainunit.lfm @@ -1,7 +1,7 @@ object GLForm1: TGLForm1 - Left = 371 + Left = 436 Height = 705 - Top = 75 + Top = 34 Width = 1004 AllowDropFiles = True Caption = 'Surf Ice' diff --git a/mainunit.pas b/mainunit.pas index 4cb023a..2772bfb 100755 --- a/mainunit.pas +++ b/mainunit.pas @@ -4273,9 +4273,8 @@ procedure TGLForm1.OverlayInvert(lOverlay: integer; lInvert: boolean); gMesh.RH.overlay[lOverlay].LUT[0].A := tmp[0].A; gMesh.RH.overlay[lOverlay].LUT[255].A := tmp[255].A; end else - gMesh.RH.overlay[lOverlay].LUT := UpdateTransferFunction (gMesh.RH.Overlay[lOverlay].LUTindex, gMesh.RH.Overlay[lOverlay].LUTinvert); + gMesh.RH.overlay[lOverlay].LUT := UpdateTransferFunction (gMesh.RH.Overlay[lOverlay].LUTindex, lInvert); gMesh.RH.Overlay[lOverlay].LUTinvert := lInvert; -//FUBAR {$ENDIF} if gMesh.Overlay[lOverlay].LUTindex < 0 then begin tmp := gMesh.overlay[lOverlay].LUT; @@ -4285,7 +4284,7 @@ procedure TGLForm1.OverlayInvert(lOverlay: integer; lInvert: boolean); gMesh.overlay[lOverlay].LUT[0].A := tmp[0].A; gMesh.overlay[lOverlay].LUT[255].A := tmp[255].A; end else - gMesh.overlay[lOverlay].LUT := UpdateTransferFunction (gMesh.Overlay[lOverlay].LUTindex, gMesh.Overlay[lOverlay].LUTinvert); + gMesh.overlay[lOverlay].LUT := UpdateTransferFunction (gMesh.Overlay[lOverlay].LUTindex, lInvert); gMesh.Overlay[lOverlay].LUTinvert := lInvert; UpdateLayerBox(false); OverlayTimerStart; @@ -6316,6 +6315,12 @@ procedure TGLForm1.DepthLabelClick(Sender: TObject); procedure TGLForm1.DisplayMenuClick(Sender: TObject); begin + if (ScriptMemo.Focused) and ((Sender as TMenuItem).tag = 3) then begin + if (ScriptMemo.SelLength < 1) then + ScriptMemo.SelectAll(); + ScriptMemo.CopyToClipboard; + exit; + end; case (Sender as TMenuItem).tag of 0: gAzimuth := 270; //left 1: gAzimuth := 90; //right @@ -6404,6 +6409,7 @@ procedure TGLForm1.OVERLAYCOLORNAME(lOverlay: integer; lFilename: string); lLUTIndex := ComboBoxName2Index(LayerColorDrop, lFilename, OK); if (not OK) and (fileexists(lFilename)) then begin gMesh.overlay[lOverlay].LUT := UpdateTransferFunction (lFilename, gMesh.Overlay[lOverlay].LUTinvert); + gMesh.overlay[lOverlay].LUTindex:= -lOverlay; //custom gnLUT := -1; //refresh colorbar GLForm1.GLBoxRequestUpdate(nil); //UpdateClrBar(); diff --git a/mesh.pas b/mesh.pas index 9a31db2..3773849 100755 --- a/mesh.pas +++ b/mesh.pas @@ -864,7 +864,6 @@ function ExtractGz(fnm: string; var mStream : TMemoryStream; magic: word = 0): b end; {$ENDIF} - //{$IFDEF COREGL} function mixRGBA(c1, c2: TRGBA; frac2: single): TRGBA; var diff --git a/opts.inc b/opts.inc index 1d98424..abb8268 100755 --- a/opts.inc +++ b/opts.inc @@ -12,4 +12,5 @@ //{$DEFINE HEMISSAO} //for hemispherical SSAO - requires shaders that save surface normal - see hemiAO3 and hemiAO {$DEFINE CTM} //support OpenCTM format, requires LZMA decoding //{$DEFINE TUBES} -{$DEFINE MATCAP} \ No newline at end of file +{$DEFINE MATCAP} +//{$DEFINE TIMER} //report load times diff --git a/surfice.app/Contents/Resources/script/startup.py b/surfice.app/Contents/Resources/script/startup_2020.py similarity index 100% rename from surfice.app/Contents/Resources/script/startup.py rename to surfice.app/Contents/Resources/script/startup_2020.py diff --git a/surfice.lpi b/surfice.lpi index 28e4e59..8056ae1 100644 --- a/surfice.lpi +++ b/surfice.lpi @@ -100,7 +100,7 @@ - + diff --git a/surfice.lps b/surfice.lps index 23baf50..93e31c1 100644 --- a/surfice.lps +++ b/surfice.lps @@ -7,10 +7,9 @@ - + - @@ -19,8 +18,8 @@ - - + + @@ -29,11 +28,10 @@ - + - @@ -55,35 +53,34 @@ - + - - + - - - - + + + + - - - + + + @@ -98,11 +95,9 @@ - - - + + - @@ -115,28 +110,27 @@ - - + + + - + - - - - + + + - @@ -187,11 +181,10 @@ - + - @@ -227,11 +220,10 @@ - + - @@ -252,10 +244,9 @@ - + - @@ -267,134 +258,133 @@ - + - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/trackshrink b/trackshrink deleted file mode 100755 index ce855cf..0000000 Binary files a/trackshrink and /dev/null differ diff --git a/tracktion b/tracktion deleted file mode 100755 index 0a78190..0000000 Binary files a/tracktion and /dev/null differ diff --git a/x86_64-darwin/README.txt b/x86_64-darwin/README.txt new file mode 100755 index 0000000..bea49c9 --- /dev/null +++ b/x86_64-darwin/README.txt @@ -0,0 +1,9 @@ +CloudFlare zlib 29 Sept 2020 +Compiled By Chris Rorden +https://github.com/cloudflare/zlib + +./configure +edit makefile for "-mmacosx-version-min=10.8" + CFLAGS= -mmacosx-version-min=10.8 -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +make + diff --git a/x86_64-darwin/adler32.o b/x86_64-darwin/adler32.o new file mode 100644 index 0000000..8110ff4 Binary files /dev/null and b/x86_64-darwin/adler32.o differ diff --git a/x86_64-darwin/adler32_simd.o b/x86_64-darwin/adler32_simd.o new file mode 100644 index 0000000..e3ab0c8 Binary files /dev/null and b/x86_64-darwin/adler32_simd.o differ diff --git a/x86_64-darwin/crc32.o b/x86_64-darwin/crc32.o new file mode 100644 index 0000000..eff3d9f Binary files /dev/null and b/x86_64-darwin/crc32.o differ diff --git a/x86_64-darwin/crc32_simd.o b/x86_64-darwin/crc32_simd.o new file mode 100644 index 0000000..bea86b1 Binary files /dev/null and b/x86_64-darwin/crc32_simd.o differ diff --git a/x86_64-darwin/deflate.o b/x86_64-darwin/deflate.o new file mode 100644 index 0000000..d0770f8 Binary files /dev/null and b/x86_64-darwin/deflate.o differ diff --git a/x86_64-darwin/inffast.o b/x86_64-darwin/inffast.o new file mode 100644 index 0000000..81d164b Binary files /dev/null and b/x86_64-darwin/inffast.o differ diff --git a/x86_64-darwin/inffast_chunk.o b/x86_64-darwin/inffast_chunk.o new file mode 100644 index 0000000..d9ff386 Binary files /dev/null and b/x86_64-darwin/inffast_chunk.o differ diff --git a/x86_64-darwin/inflate.o b/x86_64-darwin/inflate.o new file mode 100644 index 0000000..723440b Binary files /dev/null and b/x86_64-darwin/inflate.o differ diff --git a/x86_64-darwin/inftrees.o b/x86_64-darwin/inftrees.o new file mode 100644 index 0000000..096e533 Binary files /dev/null and b/x86_64-darwin/inftrees.o differ diff --git a/x86_64-darwin/trees.o b/x86_64-darwin/trees.o new file mode 100644 index 0000000..9da281c Binary files /dev/null and b/x86_64-darwin/trees.o differ diff --git a/x86_64-darwin/zutil.o b/x86_64-darwin/zutil.o new file mode 100644 index 0000000..f7cd64f Binary files /dev/null and b/x86_64-darwin/zutil.o differ diff --git a/x86_64-linux/adler32.o b/x86_64-linux/adler32.o new file mode 100644 index 0000000..de62df0 Binary files /dev/null and b/x86_64-linux/adler32.o differ diff --git a/x86_64-linux/adler32_simd.o b/x86_64-linux/adler32_simd.o new file mode 100644 index 0000000..97b105f Binary files /dev/null and b/x86_64-linux/adler32_simd.o differ diff --git a/x86_64-linux/crc32.o b/x86_64-linux/crc32.o new file mode 100644 index 0000000..55ba702 Binary files /dev/null and b/x86_64-linux/crc32.o differ diff --git a/x86_64-linux/crc32_simd.o b/x86_64-linux/crc32_simd.o new file mode 100644 index 0000000..1977d13 Binary files /dev/null and b/x86_64-linux/crc32_simd.o differ diff --git a/x86_64-linux/deflate.o b/x86_64-linux/deflate.o new file mode 100644 index 0000000..51ab6c2 Binary files /dev/null and b/x86_64-linux/deflate.o differ diff --git a/x86_64-linux/inffast.o b/x86_64-linux/inffast.o new file mode 100644 index 0000000..bf7d34a Binary files /dev/null and b/x86_64-linux/inffast.o differ diff --git a/x86_64-linux/inffast_chunk.o b/x86_64-linux/inffast_chunk.o new file mode 100644 index 0000000..310861f Binary files /dev/null and b/x86_64-linux/inffast_chunk.o differ diff --git a/x86_64-linux/inflate.o b/x86_64-linux/inflate.o new file mode 100644 index 0000000..8cb2984 Binary files /dev/null and b/x86_64-linux/inflate.o differ diff --git a/x86_64-linux/inftrees.o b/x86_64-linux/inftrees.o new file mode 100644 index 0000000..64740ee Binary files /dev/null and b/x86_64-linux/inftrees.o differ diff --git a/x86_64-linux/trees.o b/x86_64-linux/trees.o new file mode 100644 index 0000000..72f0ff5 Binary files /dev/null and b/x86_64-linux/trees.o differ diff --git a/x86_64-linux/zutil.o b/x86_64-linux/zutil.o new file mode 100644 index 0000000..45b3953 Binary files /dev/null and b/x86_64-linux/zutil.o differ diff --git a/x86_64-win64/README.txt b/x86_64-win64/README.txt new file mode 100755 index 0000000..eb15d06 --- /dev/null +++ b/x86_64-win64/README.txt @@ -0,0 +1,29 @@ +CloudFlare zlib 29 Sept 2020 +Compiled By Chris Rorden +https://github.com/cloudflare/zlib +gcc version 8.1.0 + +gcc -O3 -c -o adler32.o adler32.c +gcc -O3 -c -o crc32.o crc32.c +gcc -O3 -c -o deflate.o deflate.c -msse4 +gcc -O3 -c -o inffast.o inffast.c +gcc -O3 -c -o inflate.o inflate.c +gcc -O3 -c -o inftrees.o inftrees.c +gcc -O3 -c -o trees.o trees.c +gcc -O3 -c -o zutil.o zutil.c +gcc -O3 -c -o adler32_simd.o adler32_simd.c +gcc -O3 -c -o crc32_simd.o crc32_simd.c +gcc -O3 -c -o inffast_chunk.o inffast_chunk.c + + +gcc -O3 -c -o adler32.o adler32.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o crc32.o crc32.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o deflate.o deflate.c -msse4 -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o inffast.o inffast.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o inflate.o inflate.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o inftrees.o inftrees.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o trees.o trees.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o zutil.o zutil.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o adler32_simd.o adler32_simd.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o crc32_simd.o crc32_simd.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN +gcc -O3 -c -o inffast_chunk.o inffast_chunk.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN diff --git a/x86_64-win64/adler32.o b/x86_64-win64/adler32.o new file mode 100755 index 0000000..040fc90 Binary files /dev/null and b/x86_64-win64/adler32.o differ diff --git a/x86_64-win64/adler32_simd.o b/x86_64-win64/adler32_simd.o new file mode 100755 index 0000000..7859e55 Binary files /dev/null and b/x86_64-win64/adler32_simd.o differ diff --git a/x86_64-win64/crc32.o b/x86_64-win64/crc32.o new file mode 100755 index 0000000..615fe1c Binary files /dev/null and b/x86_64-win64/crc32.o differ diff --git a/x86_64-win64/crc32_simd.o b/x86_64-win64/crc32_simd.o new file mode 100755 index 0000000..6b0e224 Binary files /dev/null and b/x86_64-win64/crc32_simd.o differ diff --git a/x86_64-win64/deflate.o b/x86_64-win64/deflate.o new file mode 100755 index 0000000..1dcbf75 Binary files /dev/null and b/x86_64-win64/deflate.o differ diff --git a/x86_64-win64/inffast.o b/x86_64-win64/inffast.o new file mode 100755 index 0000000..d133793 Binary files /dev/null and b/x86_64-win64/inffast.o differ diff --git a/x86_64-win64/inffast_chunk.o b/x86_64-win64/inffast_chunk.o new file mode 100755 index 0000000..aec7f55 Binary files /dev/null and b/x86_64-win64/inffast_chunk.o differ diff --git a/x86_64-win64/inflate.o b/x86_64-win64/inflate.o new file mode 100755 index 0000000..e246905 Binary files /dev/null and b/x86_64-win64/inflate.o differ diff --git a/x86_64-win64/inftrees.o b/x86_64-win64/inftrees.o new file mode 100755 index 0000000..a5fc84f Binary files /dev/null and b/x86_64-win64/inftrees.o differ diff --git a/x86_64-win64/trees.o b/x86_64-win64/trees.o new file mode 100755 index 0000000..693bfeb Binary files /dev/null and b/x86_64-win64/trees.o differ diff --git a/x86_64-win64/zutil.o b/x86_64-win64/zutil.o new file mode 100755 index 0000000..3379efa Binary files /dev/null and b/x86_64-win64/zutil.o differ