Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Cairo widgets going black #119

Open
brummer10 opened this issue Nov 27, 2023 · 1 comment
Open

Windows: Cairo widgets going black #119

brummer10 opened this issue Nov 27, 2023 · 1 comment

Comments

@brummer10
Copy link

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.

@brummer10
Copy link
Author

Doing some optimisation. Now the cairo image surface will be reused as long the size didn't changed, if the size changed it will be re-created to match the new size.
https://github.com/brummer10/StompTuner/blob/main/pugl.patch

@drobilla drobilla changed the title arch: Windows Issue: Cairo widgets going black Windows: Cairo widgets going black Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant