jbostoen / ZTStudio

A tool to read and write Zoo Tycoon 1 Graphics
GNU General Public License v3.0
9 stars 4 forks source link

Performance improvements in frames #10

Closed jbostoen closed 8 years ago

jbostoen commented 8 years ago

Cache hex of actual graphic part (frame) The graphic component (width, height, drawing instructions) should be cached. It doesn't change, unless if the palette does change after the hex has been generated.

Now in batch conversions, the PNG file is loaded - hex is generated a first time, because this is also the point when width/height/offsets are set on the clsFrame object. It's called again to write the frame. Offsets might have been changed, rendered graphics might have been updated, but unless the .PNG changed (loadPNG), the actual image should be the same....

Defining rectangle It seems like we could in most cases derive the defining rectangle from the known offsets and width/height. Strangely enough, it's not always exactly the same as the function we use for it. Sometimes the height is a little bigger when we use the new method rather than deriving it using the current method. Which one is wrong?

jbostoen commented 8 years ago

Caching: quite easy to store a cache, but at which point do we detect if the color palette on the frame's parent has been updated? (and in fact, if only a color was added, it shouldn't make a difference).

jbostoen commented 8 years ago

Build 2016.10.10 contains all the caching improvements, which result in a great performance boost!

Still open because of the difference in the defining rectangle...