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
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
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;