mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 15:46:52 +08:00
Fix Cairo callback drawing (needs flush)
This commit adds a cairo_surface flush after calling the draw callback. This fixes the test/cairo_test demo program under Windows. At least under Windows the Cairo callback used in Fl_Cairo_Window didn't draw anything with current Windows 10, MinGW (32-bit) and Cairo 1.15.12 for Windows. It worked well under Linux though. Anyway, the flush should do no harm.
This commit is contained in:
@@ -59,10 +59,15 @@ protected:
|
|||||||
/** Overloaded to provide cairo callback support */
|
/** Overloaded to provide cairo callback support */
|
||||||
void draw() {
|
void draw() {
|
||||||
Fl_Double_Window::draw();
|
Fl_Double_Window::draw();
|
||||||
// manual method ? if yes explicitly get a cairo_context here
|
if (draw_cb_) { // call the Cairo draw callback
|
||||||
if (!Fl::cairo_autolink_context())
|
// manual method ? if yes explicitly get a cairo_context here
|
||||||
Fl::cairo_make_current(this);
|
if (!Fl::cairo_autolink_context())
|
||||||
if (draw_cb_) draw_cb_(this, Fl::cairo_cc());
|
Fl::cairo_make_current(this);
|
||||||
|
draw_cb_(this, Fl::cairo_cc());
|
||||||
|
// flush cairo drawings: necessary at least for Windows
|
||||||
|
cairo_surface_t *s = cairo_get_target(Fl::cairo_cc());
|
||||||
|
cairo_surface_flush(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user