Browse Source

* fixed some Delphi7 errors

master
Bergmann89 9 years ago
parent
commit
63b9b326d9
1 changed files with 22 additions and 24 deletions
  1. +22
    -24
      glBitmap.pas

+ 22
- 24
glBitmap.pas View File

@@ -780,6 +780,13 @@ type
// - data type (e.g. ub, us, ui) // - data type (e.g. ub, us, ui)
// - number of data types // - number of data types


{$IFNDEF fpc}
QWord = System.UInt64;
PQWord = ^QWord;

PtrInt = Longint;
PtrUInt = DWord;
{$ENDIF}


TglBitmapFormat = ( TglBitmapFormat = (
tfEmpty = 0, //must be smallest value! tfEmpty = 0, //must be smallest value!
@@ -905,7 +912,7 @@ type
end; end;


TglBitmapFormatDescriptor = class(TObject) TglBitmapFormatDescriptor = class(TObject)
strict private
private
// cached properties // cached properties
fBytesPerPixel: Single; fBytesPerPixel: Single;
fChannelCount: Integer; fChannelCount: Integer;
@@ -1324,16 +1331,8 @@ uses
Math, syncobjs, typinfo Math, syncobjs, typinfo
{$IF DEFINED(GLB_SUPPORT_JPEG_READ) AND DEFINED(GLB_LAZ_JPEG)}, FPReadJPEG{$IFEND}; {$IF DEFINED(GLB_SUPPORT_JPEG_READ) AND DEFINED(GLB_LAZ_JPEG)}, FPReadJPEG{$IFEND};


type
{$IFNDEF fpc}
QWord = System.UInt64;
PQWord = ^QWord;

PtrInt = Longint;
PtrUInt = DWord;
{$ENDIF}

//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
type
TFormatDescriptor = class(TglBitmapFormatDescriptor) TFormatDescriptor = class(TglBitmapFormatDescriptor)
public public
procedure Map(const aPixel: TglBitmapPixelData; var aData: PByte; var aMapData: Pointer); virtual; abstract; procedure Map(const aPixel: TglBitmapPixelData; var aData: PByte; var aMapData: Pointer); virtual; abstract;
@@ -1724,8 +1723,8 @@ type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TbmpBitfieldFormat = class(TFormatDescriptor) TbmpBitfieldFormat = class(TFormatDescriptor)
public public
procedure SetValues(const aBPP: Integer; aMask: TglBitmapRec4ul); overload;
procedure SetValues(const aBBP: Integer; const aPrec, aShift: TglBitmapRec4ub); overload;
procedure SetCustomValues(const aBPP: Integer; aMask: TglBitmapRec4ul); overload;
procedure SetCustomValues(const aBBP: Integer; const aPrec, aShift: TglBitmapRec4ub); overload;
procedure Map(const aPixel: TglBitmapPixelData; var aData: PByte; var aMapData: Pointer); override; procedure Map(const aPixel: TglBitmapPixelData; var aData: PByte; var aMapData: Pointer); override;
procedure Unmap(var aData: PByte; out aPixel: TglBitmapPixelData; var aMapData: Pointer); override; procedure Unmap(var aData: PByte; out aPixel: TglBitmapPixelData; var aMapData: Pointer); override;
end; end;
@@ -1740,12 +1739,12 @@ type
fBitsPerPixel: Integer; fBitsPerPixel: Integer;
fColorTable: TbmpColorTable; fColorTable: TbmpColorTable;
protected protected
procedure SetValues; override; overload;
procedure SetValues; override;
public public
property ColorTable: TbmpColorTable read fColorTable write fColorTable; property ColorTable: TbmpColorTable read fColorTable write fColorTable;
property BitsPerPixel: Integer read fBitsPerPixel write fBitsPerPixel; property BitsPerPixel: Integer read fBitsPerPixel write fBitsPerPixel;


procedure SetValues(const aFormat: TglBitmapFormat; const aBPP: Integer; const aPrec, aShift: TglBitmapRec4ub); overload;
procedure SetCustomValues(const aFormat: TglBitmapFormat; const aBPP: Integer; const aPrec, aShift: TglBitmapRec4ub); overload;
procedure CalcValues; procedure CalcValues;
procedure CreateColorTable; procedure CreateColorTable;


@@ -1935,7 +1934,7 @@ begin
if (desc.IsCompressed) or (desc.glFormat = 0) then if (desc.IsCompressed) or (desc.glFormat = 0) then
exit; exit;


p := GetMem(ceil(25 * desc.BytesPerPixel)); // 5 x 5 pixel
p := GetMemory(ceil(25 * desc.BytesPerPixel)); // 5 x 5 pixel
md := desc.CreateMappingData; md := desc.CreateMappingData;
try try
tmp := p; tmp := p;
@@ -4104,7 +4103,7 @@ end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TBitfieldFormat///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //TBitfieldFormat/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.SetValues(const aBPP: Integer; aMask: TglBitmapRec4ul);
procedure TbmpBitfieldFormat.SetCustomValues(const aBPP: Integer; aMask: TglBitmapRec4ul);
var var
i: Integer; i: Integer;
begin begin
@@ -4120,7 +4119,7 @@ begin
end; end;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpBitfieldFormat.SetValues(const aBBP: Integer; const aPrec, aShift: TglBitmapRec4ub);
procedure TbmpBitfieldFormat.SetCustomValues(const aBBP: Integer; const aPrec, aShift: TglBitmapRec4ub);
begin begin
fBitsPerPixel := aBBP; fBitsPerPixel := aBBP;
fPrecision := aPrec; fPrecision := aPrec;
@@ -4178,7 +4177,7 @@ begin
end; end;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TbmpColorTableFormat.SetValues(const aFormat: TglBitmapFormat; const aBPP: Integer; const aPrec, aShift: TglBitmapRec4ub);
procedure TbmpColorTableFormat.SetCustomValues(const aFormat: TglBitmapFormat; const aBPP: Integer; const aPrec, aShift: TglBitmapRec4ub);
begin begin
fFormat := aFormat; fFormat := aFormat;
fBitsPerPixel := aBPP; fBitsPerPixel := aBPP;
@@ -5294,7 +5293,7 @@ var
Shift.g := GreenShift; Shift.g := GreenShift;
Shift.b := BlueShift; Shift.b := BlueShift;
Shift.a := AlphaShift; Shift.a := AlphaShift;
bfFormat.SetValues(BitsPerPixel, Prec, Shift);
bfFormat.SetCustomValues(BitsPerPixel, Prec, Shift);
end; end;
pSourceMD := bfFormat.CreateMappingData; pSourceMD := bfFormat.CreateMappingData;
pDestMD := FormatDesc.CreateMappingData; pDestMD := FormatDesc.CreateMappingData;
@@ -7068,7 +7067,7 @@ begin
if (fd.Format = tfEmpty) then if (fd.Format = tfEmpty) then
raise EglBitmapUnsupportedFormat.Create('no supported format found'); raise EglBitmapUnsupportedFormat.Create('no supported format found');


buf := GetMem(header.DataSize);
buf := GetMemory(header.DataSize);
aStream.Read(buf^, header.DataSize); aStream.Read(buf^, header.DataSize);
SetDataPointer(buf, fd.Format, header.Width, header.Height); SetDataPointer(buf, fd.Format, header.Width, header.Height);


@@ -7205,7 +7204,7 @@ function TglBitmap.LoadBMP(const aStream: TStream): Boolean;
aFormat := TFormatDescriptor.Get(aFormat).WithAlpha; aFormat := TFormatDescriptor.Get(aFormat).WithAlpha;


result := TbmpBitfieldFormat.Create; result := TbmpBitfieldFormat.Create;
result.SetValues(aInfo.biBitCount, aMask);
result.SetCustomValues(aInfo.biBitCount, aMask);
end; end;
end; end;


@@ -7374,7 +7373,7 @@ begin
Header.bfOffBits := Header.bfOffBits + 256 * SizeOf(Cardinal); //256 ColorTable entries Header.bfOffBits := Header.bfOffBits + 256 * SizeOf(Cardinal); //256 ColorTable entries
Converter := TbmpColorTableFormat.Create; Converter := TbmpColorTableFormat.Create;
with (Converter as TbmpColorTableFormat) do begin with (Converter as TbmpColorTableFormat) do begin
SetValues(fFormat, 1, FormatDesc.Precision, FormatDesc.Shift);
SetCustomValues(fFormat, 1, FormatDesc.Precision, FormatDesc.Shift);
CreateColorTable; CreateColorTable;
end; end;
end; end;
@@ -7955,7 +7954,7 @@ var
end; end;


Converter := TbmpBitfieldFormat.Create; Converter := TbmpBitfieldFormat.Create;
Converter.SetValues(dwRGBBitCount, glBitmapRec4ul(dwRBitMask, dwGBitMask, dwBBitMask, dwABitMask));
Converter.SetCustomValues(dwRGBBitCount, glBitmapRec4ul(dwRBitMask, dwGBitMask, dwBBitMask, dwABitMask));
end; end;
end; end;
end; end;
@@ -8337,7 +8336,6 @@ begin
glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_HEIGHT, @TempHeight); glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_HEIGHT, @TempHeight);
glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_INTERNAL_FORMAT, @TempIntFormat); glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_INTERNAL_FORMAT, @TempIntFormat);


IntFormat := tfEmpty;
FormatDesc := (TglBitmapFormatDescriptor.GetByFormat(TempIntFormat) as TFormatDescriptor); FormatDesc := (TglBitmapFormatDescriptor.GetByFormat(TempIntFormat) as TFormatDescriptor);
IntFormat := FormatDesc.Format; IntFormat := FormatDesc.Format;




Loading…
Cancel
Save