I have restarted work on my PNGview add-in, and after finally making it display PNGs correctly, now it also supports JPEG.
It doesn't work right with images much larger than 7KB because of two things: one, the default heap size for the add-ins isn't very big (and the PNG decoder requires lots of RAM), and second, it doesn't seem to 'free' all the memory it 'malloc's, even though I can't see where in the code the memory leak is exactly.
The PNG decoder may fail after decoding the same image many times: it displays a nice message with a LodePNG error code. The JPEG decoder fails more often, and in a less soft way: it causes a system error, caused by a TLB error. I don't see how the JPEG decoder can be accessing memory where it shouldn't, except for one thing: as it reads the file (it's configured for reading 1024 bytes at a time), it grows in the heap and at some point exceeds it.
I'd like to confirm this and how to fix it, but I don't know how...
There's a README file in the package which says more or less the same as what I wrote here. I don't provide any G3A or any sort of binary, and it'll probably be this way even on the release versions (because of the points expressed on the original PNGview thread). It's your responsibility to compile and run the code.
I recommend you read the messages in the About screens (press F6 after starting the compiled add-in, or read them in the source code). It explicitly says I take no responsibility for anything less appropriate people may do with this add-in.
Source code for development build number 52 of Image Viewer:
http://tny.im/dl/casioprizm/ImageViewer.zip
Help me debug, please!
It doesn't work right with images much larger than 7KB because of two things: one, the default heap size for the add-ins isn't very big (and the PNG decoder requires lots of RAM), and second, it doesn't seem to 'free' all the memory it 'malloc's, even though I can't see where in the code the memory leak is exactly.
The PNG decoder may fail after decoding the same image many times: it displays a nice message with a LodePNG error code. The JPEG decoder fails more often, and in a less soft way: it causes a system error, caused by a TLB error. I don't see how the JPEG decoder can be accessing memory where it shouldn't, except for one thing: as it reads the file (it's configured for reading 1024 bytes at a time), it grows in the heap and at some point exceeds it.
I'd like to confirm this and how to fix it, but I don't know how...
There's a README file in the package which says more or less the same as what I wrote here. I don't provide any G3A or any sort of binary, and it'll probably be this way even on the release versions (because of the points expressed on the original PNGview thread). It's your responsibility to compile and run the code.
I recommend you read the messages in the About screens (press F6 after starting the compiled add-in, or read them in the source code). It explicitly says I take no responsibility for anything less appropriate people may do with this add-in.
Source code for development build number 52 of Image Viewer:
http://tny.im/dl/casioprizm/ImageViewer.zip
Help me debug, please!