Fixed: crashes when adding the second image
This commit is contained in:
parent
4de0005e56
commit
72f9725251
@ -100,7 +100,7 @@ Conditionals=
|
|||||||
DebugSourceDirs=
|
DebugSourceDirs=
|
||||||
UsePackages=0
|
UsePackages=0
|
||||||
[Parameters]
|
[Parameters]
|
||||||
RunParams=ip-to-country.csv countries.csv geo.db
|
RunParams=
|
||||||
HostApplication=
|
HostApplication=
|
||||||
Launcher=
|
Launcher=
|
||||||
UseLauncher=0
|
UseLauncher=0
|
||||||
|
@ -705,6 +705,19 @@ var
|
|||||||
pMask: PByteArray;
|
pMask: PByteArray;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if not FConvert then
|
||||||
|
begin
|
||||||
|
AImage := TBitmap.Create();
|
||||||
|
AImage.Width := Self.Width;
|
||||||
|
AImage.Height := Self.Height;
|
||||||
|
AImage.Canvas.Brush.Color := clWhite;
|
||||||
|
AImage.Canvas.FillRect(Rect(0, 0, AImage.Width, AImage.Height));
|
||||||
|
|
||||||
|
AMask := TBitmap.Create();
|
||||||
|
AMask.Assign(AImage);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
// Technique used here: draw the image twice, once on the background color,
|
// Technique used here: draw the image twice, once on the background color,
|
||||||
// once on black. Loop through the two images, check if a pixel is the
|
// once on black. Loop through the two images, check if a pixel is the
|
||||||
// background color on one image and black on the other; if so then it's
|
// background color on one image and black on the other; if so then it's
|
||||||
@ -838,6 +851,9 @@ begin
|
|||||||
if csLoading in ComponentState then
|
if csLoading in ComponentState then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
if (AIndex < 0) or (AIndex >= Count) then
|
||||||
|
exit;
|
||||||
|
|
||||||
BeginUpdate();
|
BeginUpdate();
|
||||||
try
|
try
|
||||||
bmpImage := TBitmap.Create();
|
bmpImage := TBitmap.Create();
|
||||||
@ -867,7 +883,6 @@ end;
|
|||||||
|
|
||||||
procedure TX2GraphicList.RebuildImages();
|
procedure TX2GraphicList.RebuildImages();
|
||||||
var
|
var
|
||||||
bmpTemp: TBitmap;
|
|
||||||
iIndex: Integer;
|
iIndex: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -882,23 +897,8 @@ begin
|
|||||||
if not Assigned(FContainer) then
|
if not Assigned(FContainer) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if FConvert then
|
|
||||||
begin
|
|
||||||
for iIndex := 0 to FContainer.Graphics.Count - 1 do
|
for iIndex := 0 to FContainer.Graphics.Count - 1 do
|
||||||
AddImage(iIndex);
|
AddImage(iIndex);
|
||||||
end else
|
|
||||||
begin
|
|
||||||
bmpTemp := TBitmap.Create();
|
|
||||||
try
|
|
||||||
bmpTemp.Width := Self.Width;
|
|
||||||
bmpTemp.Height := Self.Height;
|
|
||||||
bmpTemp.Canvas.Brush.Color := clWhite;
|
|
||||||
bmpTemp.Canvas.FillRect(Rect(0, 0, bmpTemp.Width, bmpTemp.Height));
|
|
||||||
Add(bmpTemp, bmpTemp);
|
|
||||||
finally
|
|
||||||
FreeAndNil(bmpTemp);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
finally
|
finally
|
||||||
EndUpdate();
|
EndUpdate();
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user