Hi all! I’ve been working on a graph based synth where each node is either an oscillator or an fx, and the nodes are draggable. Every node is connected to the next / previous node with an arrow which I draw at the paint() function. At the moment, whenever a node is dragged the whole thing (pretty much) gets repainted and I’ve been trying (and failing) to optimize it.
And so, my question is: Is there a way to custom paint only a certain rectangle in a way that allows me to draw the arrows?
The code can be found here:
The simplest way to do this would be to call the repaint method with the bounds of the arrow that you want to redraw but this might be unnecessary if your arrow is really long or spans a lot of the application window as you’ll end up repainting most of the window anyway. If you are on Windows or Android then turning on OpenGL and running your application in release mode could improve performance.
Hope this helps,
Running in release mode does make things faster but I’m doing this project to improve my C++ing and general coding abilities so I was looking for a design solution.
I found a solution which is to move the arrows into the paint function of the nodes (and not the container) and things are working much faster now. I still have trouble caused by this change but I’m pretty sure I can manage it.
Thanks again and have a great week!