mirror of
https://github.com/moparisthebest/Simba
synced 2024-12-25 00:39:04 -05:00
Fixed a lil bug in the FontCopy function, and added new method to the bitmap manager -> GetNewIndex.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@458 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
d20f973f61
commit
691bddcde6
@ -96,6 +96,7 @@ type
|
|||||||
FreeSpots : Array of integer;
|
FreeSpots : Array of integer;
|
||||||
BmpArray : TMufasaBmpArray;
|
BmpArray : TMufasaBmpArray;
|
||||||
BmpsCurr,BmpsHigh,FreeSpotsHigh,FreeSpotsLen : integer;
|
BmpsCurr,BmpsHigh,FreeSpotsHigh,FreeSpotsLen : integer;
|
||||||
|
function GetNewIndex : integer;
|
||||||
public
|
public
|
||||||
function GetBMP(Index : integer) : TMufasaBitmap;
|
function GetBMP(Index : integer) : TMufasaBitmap;
|
||||||
property Bmp[Index : integer]: TMufasaBitmap read GetBMP;
|
property Bmp[Index : integer]: TMufasaBitmap read GetBMP;
|
||||||
@ -164,6 +165,24 @@ end;
|
|||||||
|
|
||||||
{ TMBitmaps }
|
{ TMBitmaps }
|
||||||
|
|
||||||
|
function TMBitmaps.GetNewIndex: integer;
|
||||||
|
begin
|
||||||
|
if BmpsCurr < BmpsHigh then
|
||||||
|
begin;
|
||||||
|
inc(BmpsCurr);
|
||||||
|
Result := BmpsCurr;
|
||||||
|
end else if (FreeSpotsHigh > -1) then
|
||||||
|
begin;
|
||||||
|
Result := FreeSpots[FreeSpotsHigh];
|
||||||
|
dec(FreeSpotsHigh);
|
||||||
|
end else
|
||||||
|
begin;
|
||||||
|
SetLength(BmpArray, BmpsHigh + 6);
|
||||||
|
BmpsHigh := BmpsHigh + 5;
|
||||||
|
inc(BmpsCurr);
|
||||||
|
Result := BmpsCurr;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMBitmaps.GetBMP(Index: integer): TMufasaBitmap;
|
function TMBitmaps.GetBMP(Index: integer): TMufasaBitmap;
|
||||||
begin
|
begin
|
||||||
@ -177,21 +196,7 @@ end;
|
|||||||
|
|
||||||
function TMBitmaps.CreateBMP(w,h : integer): Integer;
|
function TMBitmaps.CreateBMP(w,h : integer): Integer;
|
||||||
begin
|
begin
|
||||||
if BmpsCurr < BmpsHigh then
|
result := GetNewIndex;
|
||||||
begin;
|
|
||||||
inc(BmpsCurr);
|
|
||||||
Result := BmpsCurr;
|
|
||||||
end else if (FreeSpotsHigh > -1) then
|
|
||||||
begin;
|
|
||||||
Result := FreeSpots[FreeSpotsHigh];
|
|
||||||
dec(FreeSpotsHigh);
|
|
||||||
end else
|
|
||||||
begin;
|
|
||||||
SetLength(BmpArray, BmpsHigh + 6);
|
|
||||||
BmpsHigh := BmpsHigh + 5;
|
|
||||||
inc(BmpsCurr);
|
|
||||||
Result := BmpsCurr;
|
|
||||||
end;
|
|
||||||
BmpArray[Result] := TMufasaBitmap.Create;
|
BmpArray[Result] := TMufasaBitmap.Create;
|
||||||
BmpArray[Result].SetSize(w,h);
|
BmpArray[Result].SetSize(w,h);
|
||||||
BmpArray[Result].Index:= Result;
|
BmpArray[Result].Index:= Result;
|
||||||
@ -199,21 +204,7 @@ end;
|
|||||||
|
|
||||||
function TMBitmaps.AddBMP(_bmp: TMufasaBitmap): Integer;
|
function TMBitmaps.AddBMP(_bmp: TMufasaBitmap): Integer;
|
||||||
begin
|
begin
|
||||||
if BmpsCurr < BmpsHigh then
|
Result := GetNewIndex;
|
||||||
begin;
|
|
||||||
inc(BmpsCurr);
|
|
||||||
Result := BmpsCurr;
|
|
||||||
end else if (FreeSpotsHigh > -1) then
|
|
||||||
begin;
|
|
||||||
Result := FreeSpots[FreeSpotsHigh];
|
|
||||||
dec(FreeSpotsHigh);
|
|
||||||
end else
|
|
||||||
begin;
|
|
||||||
SetLength(BmpArray, BmpsHigh + 6);
|
|
||||||
BmpsHigh := BmpsHigh + 5;
|
|
||||||
inc(BmpsCurr);
|
|
||||||
Result := BmpsCurr;
|
|
||||||
end;
|
|
||||||
BmpArray[Result] := _bmp;
|
BmpArray[Result] := _bmp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := TMFont.Create;
|
Result := TMFont.Create;
|
||||||
Result.Name := Self.Name;
|
Result.Name := Self.Name;
|
||||||
Move(Self.Data.ascii[0], Self.Data.ascii[0], length(Self.Data.ascii) * SizeOf(Integer));
|
Move(Self.Data.ascii[0], Result.Data.ascii[0], length(Self.Data.ascii) * SizeOf(TocrGlyphMetric));
|
||||||
l := Length(Self.Data.Pos);
|
l := Length(Self.Data.Pos);
|
||||||
SetLength(Result.Data.pos, l);
|
SetLength(Result.Data.pos, l);
|
||||||
for i := 0 to l - 1 do
|
for i := 0 to l - 1 do
|
||||||
@ -204,7 +204,6 @@ begin
|
|||||||
if Shadow then
|
if Shadow then
|
||||||
F.Name := F.Name + '_s';
|
F.Name := F.Name + '_s';
|
||||||
f.Data := ocrdata;
|
f.Data := ocrdata;
|
||||||
|
|
||||||
Fonts.Add(f);
|
Fonts.Add(f);
|
||||||
{$IFDEF FONTDEBUG}
|
{$IFDEF FONTDEBUG}
|
||||||
writeln('Loaded Font ' + f.Name);
|
writeln('Loaded Font ' + f.Name);
|
||||||
|
Loading…
Reference in New Issue
Block a user