summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-03 18:18:40 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-03 22:18:29 (GMT)
commitb987ddd5026d6e96f96475d2f380e121c40cad29 (patch)
treefd3d41cf340c4b34989b9c35d9ff65fdc0db3659 /gfx
parent8fe67338b3f797208623c88893f56d1c1a9d1b30 (diff)
downloadeeshow-b987ddd5026d6e96f96475d2f380e121c40cad29.zip
eeshow-b987ddd5026d6e96f96475d2f380e121c40cad29.tar.gz
eeshow-b987ddd5026d6e96f96475d2f380e121c40cad29.tar.bz2
select driver by filename extension instead of driver spec
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c11
-rw-r--r--gfx/diff.c1
-rw-r--r--gfx/fig.c5
-rw-r--r--gfx/gfx.h3
4 files changed, 14 insertions, 6 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index 588aad2..13b1daa 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -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,
diff --git a/gfx/diff.c b/gfx/diff.c
index 08554a0..d43b292 100644
--- a/gfx/diff.c
+++ b/gfx/diff.c
@@ -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,
diff --git a/gfx/fig.c b/gfx/fig.c
index a60e41b..c0fa470 100644
--- a/gfx/fig.c
+++ b/gfx/fig.c
@@ -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,
diff --git a/gfx/gfx.h b/gfx/gfx.h
index c53c661..da28b6b 100644
--- a/gfx/gfx.h
+++ b/gfx/gfx.h
@@ -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,