Pulsing icon delayed by 5 seconds
Pulsing icon delayed by 5 seconds
SugarLabs bug #2080 was raised because whenever an activity is started in sugar OS , we get to see a few seconds delay after clicking on the activity icon on the home screen and before the appearance of the pulsing icon animation. The delay also seems to be directly proportional to the complexity of the icon of the activity.
Proposed solutions and their End Results
FIX # 1
Tried to reduce the time laag by increasing the duration between the occurrence of two consecutive frames of the pulsing icon animation.
Result: This approach can be used to fix the case of an animation which has more than required FPS and hence couldbe smoothed out using this measure, but it did nothing to solve the main problem of reducing the preanimation delay.
FIX # 2
Tried to use the concept of “Frame Skipping” ( a concept commonly used in video games to improve the performance of the game).
Result: This approach couldbe used to fix the case of a laggy animation which runs on low FPS , but it can be used only after the animation starts so it doesnt help in improving the launch time of the pulsing icon animation.
FIX # 3
Tried to tweak the nature of animation by changing the animation to a ZOOM IN animation only from a ZOOM IN and ZOOM OUT animation. i.e. Tried to alter the pulsing nature by restricting the animation by both ZOOMING OUT and ZOOMING IN to only ZOOMING IN.
Result: This approached completely changed the appearance of the pulsing icon but still didnt provide good enough delay reduction.
FIX # 4
Tried to stop the first frame of the animation from being filled with colors , so that upon starting the animation we would get to see a raw grayscale svg icon of the activity for the first frame only and then it would be seamlessly continued with the pulsing icon animation. The patch could be found here.
Result : The idea was to reduce the rendering time of the first frame so as to speed up the appearance of the first frame of the animation and hence reduce the delay. This fix seems to work as per expectations and has reduced the delay time by more than 50% as noted in the logs and reported by the community.We can see the below attached screenshots showing the visual effects, after the application of the patch on an XO-1.5
The screenshots sequentially show the frames of the pulsing icon animation after the application of the above fix
FIX # 5
Here the idea was suggested and implemented by Martin dengler <email@example.com>. We can find his patch here.
Here the idea was to replace the calls to set_stroke_color() and set_fill_color() with set_xo_color(), which does both and then calls _emit_paint_needed_icon_area() which effectively halves the no. of render_cairo() calls hence reducing the workload for the pulsing icon operation by nearly 50%.
Result : The applied patch reduces the delay by more then 60%, as confirmed by the community, but it's worth a note that the zoom in effect is still lost for most svg icons, only for the very simple icons effect is visible (Log icon is simple enough to show it, Distance icon is not quick enough).We can see the below attached screenshots showing the visual effects, after the application of the patch on an XO-1.5
The screenshots sequentially show the frames of the pulsing icon animation after the application of the above fix.