|
|
Under Wayland, the adequate API already exists : #include <FL/platform.H>
#ifdef FLTK_USE_WAYLAND if (fl_wl_display()) { // to avoid when the hybrid library is in x11 mode
cairo_t *cr = fl_wl_cairo(); cairo_rectangle(cr, x, y, w, h); // for example
}
#endif
returns the cairo_t* quantity that is used in all cairo fiunction calls. This function can be called as soon as the image surface has been made current.
I also believe that in #if defined(_WIN32) cairo_surface_t *cairo_surface = cairo_win32_surface_create((HDC)fl_gc); cairo_t *cairo_context = cairo_create(cairo_surface); return cairo_context; #endif
there's a missing statement. This one should go after the cairo_create() call :
cairo_surface_destroy(cairo_surface); because cairo objects are reference counted, and in your code the cairo_surface finishes with a count set at 2, so when you'll call cairo_destroy() at the end of the cairo_t object, the count will go to 1 and the cairo_surface object will survive without access to it.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/7def2d0b-a531-4fc3-b2f2-634e4a3b25d5n%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |