giovedì 2 dicembre 2010

MapCacheManager...

Ok all,
what is going on here?

Well, after some initial tests on the device i am please to announce that the new map algorytm is pretty good and maps are displayer FAST. But there is a caveat: only after the chunks have been cached... Creating a new uncached chunk is simply so slow to not be usable for maps even as big as 3000x3000px.

This brought me to think that caching must be forced and pre-caching must be done at image loading time. So i have added a MapCacheManager class which is a QThread and will take care of all the chunk cache management.

During caching, a nice wait dialog will be shown on screen with a progress bar so the user know the phone is not hung...

Update: Of course, it could NOT be so simple. QImageReader, the backbone of my image-reading processing, cannot run into a Thread (i guess because it uses QImage, whatever...). I am so pissed off! But something good can come out of this: i am trying to use libjpeg instead! This of course will limit the map file formats to JPEG (now anything supported by Qt is accepted), but the benefits should be a much faster loading times and more accurate optimizations... So, why not? I am giving it a try.

I hope i do not have to go back to the nice-and-plain long loop with event's loop calls in the middle...

Update: i managed to compile libjpeg quite easily... I am now reworking the MapCacheManager and LayerMap classes to accomodate for it. I also got rid of ALL the QImageReader usage! But one drawback is also that i cannot use the handy painter.drawImage with embedded image-scaling facilities...

What i am going to do is try to implement the same stuff using libjpeg scaled loading capability AND some ol'good memory copies...

Update: i am a bit spent today... Wow, i have been coding on this dynamic maps stuff for one week now! And it was supposed to be simple... Anyway, the matter is now to implement properly MapCacheManager. We want to popup wait dialogs only when rebuilding the cache! Also, i sincerely hope that with the use of libjpeg the speedup will be such that we can, hopefully, even drop the caching. We will see.

Nessun commento:

Posta un commento