Add USE_DRAW_POLYGON_FALLBACK build option for testing.

This new option, when enabled, forces the in-tree front ends
(Emcscripten, GTK, NestedVM, OS X, and Windows) to use the recently
introduced draw_polygon_fallback() in place of their native
draw_poly(). This will enable easy testing of this function in the
future.

This new option is off by default. To enable it, run CMake as:

$ cmake -DUSE_DRAW_POLYGON_FALLBACK=on

Note that I did _not_ update the Postscript frontend (ps.c) to use
this new option, as I don't think draw_polygon_fallback() would work
at all in Postscript, where the drawing units are no longer guaranteed
to be pixels. The envisioned use case for this option is a developer
testing changes to this function for sanity and/or performance, which
I only foresee happening on a standard GUI front end.
This commit is contained in:
Franklin Wei
2024-08-14 17:53:41 -04:00
committed by Simon Tatham
parent 989df5d2bf
commit a8b544d2aa
6 changed files with 25 additions and 0 deletions

4
gtk.c
View File

@ -1439,7 +1439,11 @@ static const struct drawing_api gtk_drawing = {
gtk_draw_text,
gtk_draw_rect,
gtk_draw_line,
#ifdef USE_DRAW_POLYGON_FALLBACK
draw_polygon_fallback,
#else
gtk_draw_poly,
#endif
gtk_draw_circle,
gtk_draw_update,
gtk_clip,