From: DeaDDooMER Date: Mon, 22 May 2023 19:39:02 +0000 (+0300) Subject: libs: sync vampimg with d2df-sdl X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=15a213d12de831aa04871cdd05dcf79749b82161;p=d2df-editor.git libs: sync vampimg with d2df-sdl --- diff --git a/src/lib/vampimg/ImagingPcx.pas b/src/lib/vampimg/ImagingPcx.pas index b85b5d2..9379b8b 100644 --- a/src/lib/vampimg/ImagingPcx.pas +++ b/src/lib/vampimg/ImagingPcx.pas @@ -87,7 +87,6 @@ end; function TPCXFileFormat.LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray; OnlyFirstLevel: Boolean): Boolean; - var Hdr: TPCXHeader; PalID, B: Byte; diff --git a/src/lib/vampimg/ImagingTarga.pas b/src/lib/vampimg/ImagingTarga.pas index 66af5f2..921f009 100644 --- a/src/lib/vampimg/ImagingTarga.pas +++ b/src/lib/vampimg/ImagingTarga.pas @@ -197,6 +197,12 @@ begin begin // Read targa header Read(Handle, @Hdr, SizeOf(Hdr)); + Hdr.ColorMapOff := LEtoN(Hdr.ColorMapOff); + Hdr.ColorMapLength := LEtoN(Hdr.ColorMapLength); + Hdr.XOrg := LEtoN(Hdr.XOrg); + Hdr.YOrg := LEtoN(Hdr.YOrg); + Hdr.Width := LEtoN(Hdr.Width); + Hdr.Height := LEtoN(Hdr.Height); // Skip image ID info Seek(Handle, Hdr.IDLength, smFromCurrent); // Determine image format diff --git a/src/lib/vampimg/ImagingTypes.pas b/src/lib/vampimg/ImagingTypes.pas index f2fb263..add9ca6 100644 --- a/src/lib/vampimg/ImagingTypes.pas +++ b/src/lib/vampimg/ImagingTypes.pas @@ -259,7 +259,7 @@ type ifETC2PA = 223, ifDXBC6 = 224, ifDXBC7 = 225} - { PCX formats} + { PCX formats } ifMono = 250, ifIndex2 = 251, ifIndex4 = 252 diff --git a/src/lib/vampimg/ImagingUtility.pas b/src/lib/vampimg/ImagingUtility.pas index c137e1d..1fb47dd 100644 --- a/src/lib/vampimg/ImagingUtility.pas +++ b/src/lib/vampimg/ImagingUtility.pas @@ -1093,6 +1093,8 @@ begin Result := PByte(@W)^ = $FF; end; +(* Vampimp wrongly use swaps for converting big-endian to little-endian anywhere *) +{$IF DEFINED(FPC_LITTLE_ENDIAN)} function SwapEndianWord(Value: Word): Word; {$IF Defined(USE_ASM) and (not Defined(USE_INLINE))} asm @@ -1170,6 +1172,27 @@ begin end; end; {$ENDIF} +{$ELSEIF DEFINED(FPC_BIG_ENDIAN)} +function SwapEndianWord(Value: Word): Word; +begin + Result := Value +end; + +procedure SwapEndianWord(P: PWordArray; Count: LongInt); +begin +end; + +function SwapEndianLongWord(Value: LongWord): LongWord; +begin + Result := Value +end; + +procedure SwapEndianLongWord(P: PLongWord; Count: LongInt); +begin +end; +{$ELSE} + {$ERROR Unsupported endianness!} +{$ENDIF} type TCrcTable = array[Byte] of LongWord; diff --git a/src/lib/vampimg/ZLib/dzlib.pas b/src/lib/vampimg/ZLib/dzlib.pas index 05e278d..337f310 100644 --- a/src/lib/vampimg/ZLib/dzlib.pas +++ b/src/lib/vampimg/ZLib/dzlib.pas @@ -41,7 +41,7 @@ unit dzlib; -{$I ImagingOptions.inc} +{$I ../ImagingOptions.inc} interface