king2 Posted February 17, 2016 Report Posted February 17, 2016 I see that gwinSetText() and gwinSetStyle() function do updates always, even if values was not changed. I have tried to make my own functions, like this: void my_gwinSetText(GHandle gh, const char *text) { if (strcmp(text, gwinGetText(gh))) gwinSetText(gh, text, TRUE); } void my_gwinSetStyle(GHandle gh, const GWidgetStyle *pstyle) { if (pstyle != gwinGetStyle(gh)) gwinSetStyle(gh, pstyle); } After this I got significant increasing of GUI speed, because no need to check everything around was it changed or not, and some of my code become more readable and simple. This eliminates needs to have status of each widget in code, and allow just to set styles and text how they should be, in one loop, without determining exact widgets that was changed. If you have many widget with same type, this helps a lot. I propose to include some #define like GDISP_CHECK_SET_VALUES in main uGFX function, to check if value was actually changed instead of updating value always (and redraw widget, with huge time overhead over this check). If user do not want value to be checked automatically, he always can not enable this check. What do you think about this?
inmarket Posted February 17, 2016 Report Posted February 17, 2016 In terms of setting the style - it can actually make sense to set the style to the same style. An example is when the style is being updated and you want the widget to now reflect that changed style. Whilst this could also be done with a gwinRedraw() it also makes sense to do it this way. I will look at adding a macro for the tests you suggest.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now