AngusJohnson / Image32

An extensive 2D graphics library written in Delphi Pascal
Boost Software License 1.0
137 stars 31 forks source link

Improved PNG loading for Delphi / SVG image painting #69

Closed ahausladen closed 3 months ago

ahausladen commented 3 months ago

The 64bit Delphi compiler struggles with optimizing the PNG color+alpha loop. By moving it to an extra function, the CPU register usage is much better. The new functions also processes 4 pixels in each loop iteration, improving the speed further.

Furthermore, this patch changes the TImageElement and TFeImageElement Draw method to convert the base64 stream to a PNG once and then use the fImage field to paint it instead of doing the conversion every time the image element has to be painted.