Memory model in new Animator classes
Adenilson Cavalcanti
savagobr at yahoo.com
Mon Oct 19 15:21:09 CEST 2009
Friends
I'm writing to ask for ideas concerning the new plasma::Animator based on Qt 4.6 animation api.
The current design works like this:
- create the animation object
- set the animated widget
- add the animation to an animation group (multiple animation objects are allowed as also the group can be linear or parallel)
- connect a signal to its start slot
The only problem is that internally it will create all the animation objects and later destroy them *every* single time that the animation runs. This design saves memory (or not, read more about it below) but probably is expensive in processing time.
Another issue is that once the animation is destroyed, the previous state of the animated object is lost. To give one example:
- Say that in plasma-netbook we want to have a grow/shrink animation of selected icons. The current design requires to create 2 animations (grow, shrink) and create/destroy it every time that the mouse hover happens. It also requires to know what was the size factor used in the first animation (or the shrink animation will not return the animated object to its initial state).
If we were able to maintain the animation object 'alive', it could be done using only 1 animation object (i.e. grow) and rewinding the animation back when the mouse is moved out of the selected icon.
I think that there are 2 issues to address in the design:
- make possible to reuse the animation objects
- make possible to store/restore the animated object states
I'm planning to work on it this week but I would appreciate comments, ideas and user cases about it before writing the code.
Best regards
Adenilson Cavalcanti
a.k.a. Savago
More information about the Plasma-devel
mailing list