> But: I added a looot of pictures into my code today. And a > lot of them > have to be decompressed the same time to be shown on a scroll area... > > Now my (embedded) system gets stuck for about 4-5 sec while it is > uncompressing the images.... :-( > > Does anyone know a trick to make the decompression of PNGs > faster? Or do > you know if jpg is faster in decompressing (didn't find an answer)? I > allready set my PNGs to lowest compression rate (because it > doesn't get > much bigger then), but that didn't speed up the process measurable...
Hard to say whether jpeg is faster decompressing than png - it can depend on your images, so the only way to know is to try it and see... There's not much that you can do to make the actual decompression much faster in either case - they already did the best they could when the wrote the libs, pretty much. What you can do, however, is make it less obvious to your user that the system is stuck. (hard way, but better) What I have done in the past is to decompress the image data in a subsidiary thread, with frequent sched_yield() calls scattered through it, and allowed the main GUI thread to continue in the foreground. This means that the GUI remains (more or less) responsive and the user does not see the freeze. You then arrange for your worker thread to signal to the fltk GUI thread when each image is decompressed and available for reading (and passing the pointer to the image data of course) and have the GUI thread load each image in turn, as it becomes available. That's more hassle than what you currently have, but if you want to keep the GUI responsive during the decompression it may be your best bet. (easy way but a bit of a hack) A more hacky option might be to try calling Fl::check() from within your png_read_data_from_mem() function - that might work, as the png lib will call png_read_data_from_mem() repeatedly so that will call Fl::check() repeatedly, which will pump the fltk events queue and keep things responding... Worth a try, anyway. -- Ian SELEX Galileo Ltd Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

