I recently started to use DPF for some of my projects which in turn use pugl. I run into issues with cairo under windows.
Widgets tend to black out after a short while and there is now way to repaint them other then restart the host.
This is the original issue reported on DPF:
DISTRHO/DPF#437
So I gone check what happens and end up with this patch.
https://github.com/brummer10/ToneTwistPlugs/blob/main/pugl.patch
It create a cairo_image_surface on puglWinCairoEnter and provide the cairo_t* pointer for it as DrawContext instead using a HBITMAP. Now all cairo drawings happen outside WM_PAINT. Then, on puglWinCairoLeave we do the paint (BeginPaint -> create win32 surface, copy the image surface over, destroy anything and EndPaint.) I tested this on windows11 and it works perfect. Surly it could be optimized as we didn't relay need to create and destroy the cairo_image_surface on each WM_PAINT, this is only necessary on resize, otherwise we could reuse it. Just I can't see were resizing is handled in the win_cairo source.
I recently started to use DPF for some of my projects which in turn use pugl. I run into issues with cairo under windows.
Widgets tend to black out after a short while and there is now way to repaint them other then restart the host.
This is the original issue reported on DPF:
DISTRHO/DPF#437
So I gone check what happens and end up with this patch.
https://github.com/brummer10/ToneTwistPlugs/blob/main/pugl.patch
It create a cairo_image_surface on puglWinCairoEnter and provide the cairo_t* pointer for it as DrawContext instead using a HBITMAP. Now all cairo drawings happen outside WM_PAINT. Then, on puglWinCairoLeave we do the paint (BeginPaint -> create win32 surface, copy the image surface over, destroy anything and EndPaint.) I tested this on windows11 and it works perfect. Surly it could be optimized as we didn't relay need to create and destroy the cairo_image_surface on each WM_PAINT, this is only necessary on resize, otherwise we could reuse it. Just I can't see were resizing is handled in the win_cairo source.