diff options
author | Werner Almesberger <werner@almesberger.net> | 2016-09-03 15:18:40 -0300 |
---|---|---|
committer | Werner Almesberger <werner@almesberger.net> | 2016-09-03 19:18:29 -0300 |
commit | b987ddd5026d6e96f96475d2f380e121c40cad29 (patch) | |
tree | fd3d41cf340c4b34989b9c35d9ff65fdc0db3659 /gfx | |
parent | 8fe67338b3f797208623c88893f56d1c1a9d1b30 (diff) | |
download | eeshow-b987ddd5026d6e96f96475d2f380e121c40cad29.tar.gz eeshow-b987ddd5026d6e96f96475d2f380e121c40cad29.tar.bz2 eeshow-b987ddd5026d6e96f96475d2f380e121c40cad29.zip |
select driver by filename extension instead of driver spec
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/cro.c | 11 | ||||
-rw-r--r-- | gfx/diff.c | 1 | ||||
-rw-r--r-- | gfx/fig.c | 5 | ||||
-rw-r--r-- | gfx/gfx.h | 3 |
4 files changed, 14 insertions, 6 deletions
@@ -450,7 +450,6 @@ void cro_color_override(struct cro_ctx *cc, int color) static const struct gfx_ops real_cro_ops = { - .name = "cairo", .line = cr_line, .poly = cr_poly, .circ = cr_circ, @@ -921,8 +920,11 @@ cairo_surface_t *cro_img_surface(struct cro_ctx *cc) /* ----- Operations -------------------------------------------------------- */ +static const char *const cro_png_ext[] = { "png" }; + const struct gfx_ops cro_png_ops = { - .name = "png", + .ext = cro_png_ext, + .n_ext = ARRAY_ELEMENTS(cro_png_ext), .line = record_line, .poly = record_poly, .circ = record_circ, @@ -934,8 +936,11 @@ const struct gfx_ops cro_png_ops = { .end = cr_png_end, }; +static const char *const cro_pdf_ext[] = { "pdf" }; + const struct gfx_ops cro_pdf_ops = { - .name = "pdf", + .ext = cro_pdf_ext, + .n_ext = ARRAY_ELEMENTS(cro_pdf_ext), .line = record_line, .poly = record_poly, .circ = record_circ, @@ -508,7 +508,6 @@ void diff_to_canvas(cairo_t *cr, int cx, int cy, float scale, const struct gfx_ops diff_ops = { - .name = "diff", .line = diff_line, .poly = diff_poly, .circ = diff_circ, @@ -372,8 +372,11 @@ static int fig_end(void *ctx) /* ----- Operations -------------------------------------------------------- */ +static const char *const fig_ext[] = { "fig" }; + const struct gfx_ops fig_ops = { - .name = "fig", + .ext = fig_ext, + .n_ext = ARRAY_ELEMENTS(fig_ext), .line = fig_line, .rect = fig_rect, .poly = fig_poly, @@ -22,7 +22,8 @@ struct gfx; struct gfx_ops { - const char *name; + const char *const *ext; + int n_ext; void (*line)(void *ctx, int sx, int sy, int ex, int ey, int color, unsigned layer); void (*rect)(void *ctx, int sx, int sy, int ex, int ey, |