1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2025-01-13 16:31:05 +02:00

sch2fig/gfx.h (gfx_end), gfx.c: add optional termination function

This commit is contained in:
Werner Almesberger 2016-07-30 23:02:15 -03:00
parent 3b18e8b604
commit d1657de267
3 changed files with 11 additions and 1 deletions

View File

@ -74,3 +74,10 @@ void gfx_init(const struct gfx_ops *ops,
gfx_ops = ops; gfx_ops = ops;
gfx_ctx = ops->init(template, n_vars, vars); gfx_ctx = ops->init(template, n_vars, vars);
} }
void gfx_end(void)
{
if (gfx_ops->end)
gfx_ops->end(gfx_ctx);
}

View File

@ -31,6 +31,7 @@ struct gfx_ops {
void (*text)(void *ctx, int x, int y, const char *s, unsigned size, void (*text)(void *ctx, int x, int y, const char *s, unsigned size,
enum text_align align, int rot, unsigned color, unsigned layer); enum text_align align, int rot, unsigned color, unsigned layer);
void *(*init)(const char *template, int n_vars, const char **vars); void *(*init)(const char *template, int n_vars, const char **vars);
void (*end)(void *ctx);
}; };
@ -47,9 +48,10 @@ void gfx_arc(int x, int y, int r, int sa, int ea,
void gfx_text(int x, int y, const char *s, unsigned size, void gfx_text(int x, int y, const char *s, unsigned size,
enum text_align align, int rot, unsigned color, unsigned layer); enum text_align align, int rot, unsigned color, unsigned layer);
/* inititalization */ /* inititalization and termination */
void gfx_init(const struct gfx_ops *ops, void gfx_init(const struct gfx_ops *ops,
const char *template, int n_vars, const char **vars); const char *template, int n_vars, const char **vars);
void gfx_end(void);
#endif /* !GFX_H */ #endif /* !GFX_H */

View File

@ -107,4 +107,5 @@ int main(int argc, char **argv)
read_file(argv[arg], &ctx, do_lib_parse); read_file(argv[arg], &ctx, do_lib_parse);
} }
} }
gfx_end();
} }