I am working on my custom Spritesheet version, and now that I have done the jump from old-gen to next-gen Openfl I have noticed that compiling to webGL the initialization process of a Spritesheet is incredibly slow, but it is pretty slow on canvas too. The bottleneck is the generation of the single frames with copyPixels, that extracts the bitmapData for each frame from the giant spritesheet bitmapData.
I was wondering if it is possible to instance the single frames bmd in a more efficient way (while we are waiting for a TileMap-based version of Spritesheet library that won’t need this extraction phase anymore)…
Well, I think there isn’t way to make it faster with copyPixels. I also made custom SpriteSheet parser and after loading SpriteSheet I parse all images from sheet, keep it in buffer and dispose SpriteSheet. For example: in one of my games I’m loading 22 SpriteSheets (15MB) parse it with copyPixels method and on desktop it takes 5-7 seconds for parsing, on mobile its between 10-15 sec but I think it’s OK. (I’m talking about html5 target)
webGL or canvas? I have more than 15MB of spritesheets, some ss is between 10-20MBs alone: animations are a lot, and I can’t do anything more to reduce the number of frames, I even crunch PNGs down with SuperPNG.
But who knows why copyPixels is slower when targeting webGL?
We can continue on the other topic here