POV-Ray / povray

The Persistence of Vision Raytracer: http://www.povray.org/
GNU Affero General Public License v3.0
1.35k stars 282 forks source link

Cache Images for faster parsing subsequent images (or frames in animation) #396

Closed mlsomers closed 4 years ago

mlsomers commented 4 years ago

Loading large images during parsing can take ages. When rendering animations these images are reloaded before rendering each frame.

With this solution the images are only loaded once and cached for reuse when parsing the next frame. This can dramatically decrease parsing time.

Be free to point out any errors, this is my first serious C++ code written ever (normally I do C#). The code has been tested and I don't see any significant memory leakage, in fact I am already using this in production (and it is saving lots of resources!).

I asked for this feature in issue #395 , instead of waiting for it I embarked on this rewarding quest.

mlsomers commented 4 years ago

Finally passes all checks, but there is one TODO: Somehow I missed the ImageData wrapper around Image. The wrapper should be deleted but not the child Image... These wrappers are currently leaking (in my case insignificant, but I'll still try to solve this).

mlsomers commented 4 years ago

Since I cannot isolate these changes from other pull requests from my master branch, I'll open a new pull request from a different branch.