Flickering when redrawing the canvas. #2385
Replies: 1 comment
-
As you've been told repeatedly on Discord: posting hundreds of lines of code and asking "why doesn't this work" isn't a productive way to get help. Instead, you should be asking specific questions, and providing minimal reproduction cases (or, at the very least, significantly cut down sample code). As you've also been told repeatedly on Discord - the reason you're seeing flickering is that the approach you're taking to the problem is incorrect. The thread is the cause of the flickering, because the thread's activity isn't coordinated with the event loop. You're treating the canvas as a surface where every time you change the canvas, you need to redraw the entire canvas. That's not what the canvas does. Instead, it's a set of drawing instructions that knows how to redraw itself; if you want to change the image, you alter the properties of the existing drawing instructions. This doesn't require clearing and re-creating the canvas - it means keeping a handle to the drawing object that you want to manipulate, and altering the position/scale/whatever of that drawing object. Toga will manage the process of redrawing, double buffering etc. |
Beta Was this translation helpful? Give feedback.
-
I'm getting flickering when redrawing the canvas, any ideas on how to implement double buffering? Or maybe go about this a different way?
Beta Was this translation helpful? Give feedback.
All reactions