[Interest] QPixmapCache considerations on ios and android
maitai
maitai at virtual-winds.org
Sun Oct 25 16:37:22 CET 2015
Thanks Elvis for your reply,
A compressed in-memory cache would be just perfect in my case.
So I can save a QPixmap in a QByteArray in let's say png format and use
a regular QCache instead of QPixmapCache...
I'll give it a shot for sure
Thanks again, I think you made my day :)
Philippe
Le 25-10-2015 16:20, Elvis Stansvik a écrit :
> 2015-10-25 15:53 GMT+01:00 maitai <maitai at virtual-winds.org>:
>> Hello,
>>
>> I have several relatively big pixmap I'd like to manage through cache.
>> Big meaning 1024x1024 at a maximum (one edge is 1024 while the other
>> is
>> less or equal). I need to keep something like 10 of those in a cache
>> system. Each image being quite heavy to paint, that would help a lot.
>>
>> I believe each pixmap uses a maximum of 1024 * 1024 * (32 / 8 byte) /
>> 1024 / 1024 = 4 Mb, right?
>>
>> QPixmapCache is eating way too much memory for that (40MB +
>> "whatever-is-needed-for-qt" on regular memory), on android and
>> especially iOS it's a no go. Plus it's kind of shared with qt own
>> needs
>> so it's hard to decide which limit to give.
>>
>> What would you advise? Saving the pixmap on disk, with a "kind of
>> cache"
>> system to limit it to a given size, last used is dropped etc? Using
>> opengl textures to store/restore img with a similar cache system?
>> Using
>> QPixmapCache anyway? Something else?
>>
>> I should add that in our case it's way faster to read the pixmap from
>> a
>> pre-saved png than to re-generate it, and that quality is ok for our
>> needs. So a disk-cache might be ok. But 40mb on a mobile device is
>> something expensive....
>
> If you used a disk cache with PNG files, the images would be
> compressed, so probably a lot less than the 4 MB per image you
> calculated above.
>
> I guess you could also try to make a compressed in-memory cache.
>
> Cheers,
> Elvis
>
>>
>> Thanks
>> Philippe Lelong
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list