View Issue Details

IDProjectCategoryView StatusLast Update
0035963LazarusOtherpublic2019-08-14 12:21
ReporterWOTAGamingAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformWindowsOSWindowsOS Version7, 10
Product Version2.0.4Product Build 
Target VersionFixed in Version 
Summary0035963: Cannot create certain amount of TPortableNetworkGrapic instances
DescriptionI'm developing game that use many PNGs sprites for drawing on TCanvas. I have array of 32 tilelists which are I am cutting into small tiles to 512 from every of them. I have PNGs besides those.
I use TLazIntfImage as intermediary to create and fill PNG object. And upon reaching some certain quantity of sprites inside TPortableNetworkGrapic.LoadFromIntfImage and then TLazIntfImage.CreateBitmaps program raise an silent error 'Failed to create handles'. Silent means application just freezes, but I find error in this point. CreateBitmaps sets new handla as 0.

When I use another method (not cutting pics into sprites and use TCanvas.ClipRect instead of TCanvas.Draw) it works, because I decrease amount of pictures. But this method decreases FPS, so I cant use it everywhere.
Steps To ReproduceTry to create so many PNGs as possible through converting from TLazIntfImage.
TagsPNGImageException
Fixed in Revision
LazTarget
WidgetsetWin32/Win64
Attached Files

Activities

WOTAGaming

2019-08-14 12:15

reporter   ~0117668

Last edited: 2019-08-14 12:21

View 2 revisions

I've just tested and found that only 9966 PNGs I can to create.

Testing procedure

procedure TForm1.Button1Click(Sender: TObject);
var
  LImage:TLazIntfImage;
  PNGs:array of TPortableNetworkGraphic;

  i:integer;
begin
 LImage:=TLazIntfImage.Create(0,0,[riqfRGB,riqfAlpha]);
 LImage.SetSize(32,32);

 SetLength(PNGs,0);

 Memo.Lines.Clear;

 while true do
  begin
   SetLength(PNGs,Length(PNGs)+1);
   PNGs[Length(PNGs)-1]:=TPortableNetworkGraphic.Create;

   Memo.Lines.Add(IntToStr(Length(PNGs)));
   Memo.Lines.SaveToFile('q.txt');

   PNGs[Length(PNGs)-1].LoadFromIntfImage(LImage);
  end;
end;

Issue History

Date Modified Username Field Change
2019-08-14 11:45 WOTAGaming New Issue
2019-08-14 11:51 WOTAGaming Tag Attached: PNGImageException
2019-08-14 12:15 WOTAGaming Note Added: 0117668
2019-08-14 12:21 WOTAGaming Note Edited: 0117668 View Revisions