summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-04-26 15:36:29 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2022-04-26 15:36:29 +0200
commitc74a4827564faf380e6836d9b3c591a9a2a24fe3 (patch)
tree1a0f41d39b3a0f90b24a5ecebe7505fabb46d817 /examples
parent4618fa9053217fb6c894cc10dd0ea23a9238a6e6 (diff)
Make Cairo example compatible with Cairo version < 1.12 (#436)
Diffstat (limited to 'examples')
-rw-r--r--examples/cairo-draw-x.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/cairo-draw-x.cxx b/examples/cairo-draw-x.cxx
index eb889fb4c..a11e2db0c 100644
--- a/examples/cairo-draw-x.cxx
+++ b/examples/cairo-draw-x.cxx
@@ -24,11 +24,18 @@ static void my_cairo_draw_cb(Fl_Cairo_Window *window, cairo_t *cr) {
const double xmax = (window->w() - 1);
const double ymax = (window->h() - 1);
+ // Set antialiasing mode. We could check the Cairo version at compile time but we'd
+ // also have to check the runtime version which would make this demo too complicated.
+
+ // CAIRO_ANTIALIAS_BEST is available since Cairo version 1.12,
+ // CAIRO_ANTIALIAS_DEFAULT is available since Cairo version 1.0.
+
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_DEFAULT); // use default antialiasing
+
// Draw orange "X"
// Draws an X to four corners of resizable window.
// See Fl_Cairo_Window docs for more info.
//
- cairo_set_antialias(cr, CAIRO_ANTIALIAS_BEST); // use best antialiasing
cairo_set_line_width(cr, 1.00); // line width for drawing
cairo_set_source_rgb(cr, 1.0, 0.5, 0.0); // orange
cairo_move_to(cr, 0.0, 0.0); cairo_line_to(cr, xmax, ymax); // draw diagonal "\"