summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-30 00:48:00 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-30 01:00:26 (GMT)
commit2f6677ab8f5f15fc09fc02d6ea86fd5b3f650a1d (patch)
tree0f0595cbd998d30e0178035f91b30f7ed6757e54 /gfx
parent2c9e549c9554e0cabb4d4ccdb2c3a2238d62bcf4 (diff)
downloadeeshow-2f6677ab8f5f15fc09fc02d6ea86fd5b3f650a1d.zip
eeshow-2f6677ab8f5f15fc09fc02d6ea86fd5b3f650a1d.tar.gz
eeshow-2f6677ab8f5f15fc09fc02d6ea86fd5b3f650a1d.tar.bz2
get rid of sch_render_extra and move selection to rendering (WIP)
This works for eeshow, but this breaks the -e option of eeplot and eediff, permanently enabling it in FIG, and permanently disabling it in all the Cairo-based formats.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c15
-rw-r--r--gfx/cro.h4
-rw-r--r--gfx/diff.c18
-rw-r--r--gfx/diff.h3
4 files changed, 14 insertions, 26 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index f1d44b6..5b23113 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -1053,7 +1053,7 @@ void cro_canvas_prepare(cairo_t *cr)
void cro_canvas_draw(struct cro_ctx *cc, cairo_t *cr, int xo, int yo,
- float scale)
+ float scale, enum gfx_extra extra)
{
cc->cr = cr;
@@ -1062,14 +1062,14 @@ void cro_canvas_draw(struct cro_ctx *cc, cairo_t *cr, int xo, int yo,
cc->scale = scale;
cc->xo = xo;
cc->yo = yo;
- record_replay(&cc->record, 0);
+ record_replay(&cc->record, extra);
}
/* ----- Image for external use (simplified API) --------------------------- */
-uint32_t *cro_img(struct cro_ctx *cc, struct cro_ctx *cc_extra,
+uint32_t *cro_img(struct cro_ctx *cc, enum gfx_extra extra,
int xo, int yo, int w, int h,
float scale, double alpha, cairo_t **res_cr, int *res_stride)
{
@@ -1119,14 +1119,7 @@ uint32_t *cro_img(struct cro_ctx *cc, struct cro_ctx *cc_extra,
setup_font(cc);
- if (cc_extra) {
- void *old = cc_extra->record.user;
-
- cc_extra->record.user = cc->record.user; /* @@@ eww ! */
- record_replay(&cc_extra->record, 0);
- cc_extra->record.user = old;
- }
- record_replay(&cc->record, 0);
+ record_replay(&cc->record, extra);
if (res_cr)
*res_cr = cr;
diff --git a/gfx/cro.h b/gfx/cro.h
index 8018e26..f24ba38 100644
--- a/gfx/cro.h
+++ b/gfx/cro.h
@@ -50,9 +50,9 @@ void cro_img_destroy(struct cro_ctx *cc);
void cro_canvas_end(struct cro_ctx *cc, int *w, int *h, int *xmin, int *ymin);
void cro_canvas_prepare(cairo_t *cr);
void cro_canvas_draw(struct cro_ctx *cc, cairo_t *cr,
- int x, int y, float scale);
+ int x, int y, float scale, enum gfx_extra extra);
-uint32_t *cro_img(struct cro_ctx *cc, struct cro_ctx *cc_extra,
+uint32_t *cro_img(struct cro_ctx *cc, enum gfx_extra extra,
int x0, int yo, int w, int h,
float scale, double alpha, cairo_t **res_cr, int *res_stride);
cairo_surface_t *cro_img_surface(struct cro_ctx *cc);
diff --git a/gfx/diff.c b/gfx/diff.c
index 6aef353..fd7245c 100644
--- a/gfx/diff.c
+++ b/gfx/diff.c
@@ -196,8 +196,7 @@ void *diff_process_file(struct diff *diff, struct file_names *file_names,
if (!gfx_args(diff->gfx, argc, argv, opts))
goto fail_open;
sch_render(sch.sheets, diff->gfx);
- if (diff->extra)
- sch_render_extra(sch.sheets, diff->gfx);
+ /* @@@ filter extra */
sch_free(&sch);
lib_free(&lib);
@@ -384,8 +383,7 @@ static void merge_coord(int pos_a, int pos_b, int dim_a, int dim_b,
static cairo_t *make_diff(cairo_t *cr, int cx, int cy, float scale,
- struct cro_ctx *old, struct cro_ctx *old_extra,
- struct cro_ctx *new, struct cro_ctx *new_extra,
+ struct cro_ctx *old, struct cro_ctx *new, enum gfx_extra extra,
const struct area *areas, bool *changed)
{
int old_xmin, old_ymin, old_w, old_h;
@@ -419,9 +417,9 @@ static cairo_t *make_diff(cairo_t *cr, int cx, int cy, float scale,
yo = -ymin * scale;
}
- img_old = cro_img(old, old_extra, xo, yo, sw, sh, scale, 1,
+ img_old = cro_img(old, extra, xo, yo, sw, sh, scale, 1,
&old_cr, &stride);
- img_new = cro_img(new, new_extra, xo, yo, sw, sh, scale, 1,
+ img_new = cro_img(new, extra, xo, yo, sw, sh, scale, 1,
NULL, NULL);
struct diff diff = {
@@ -469,7 +467,7 @@ static int diff_end(void *ctx)
cro_img_reset(gfx_user(diff->gfx));
old_cr = make_diff(NULL, 0, 0, diff->scale,
- gfx_user(diff->gfx), NULL, gfx_user(diff->new_gfx), NULL, NULL,
+ gfx_user(diff->gfx), gfx_user(diff->new_gfx), 0, NULL,
&changed);
s = cairo_get_target(old_cr);
@@ -494,15 +492,13 @@ static int diff_end(void *ctx)
void diff_to_canvas(cairo_t *cr, int cx, int cy, float scale,
- struct cro_ctx *old, struct cro_ctx *old_extra,
- struct cro_ctx *new, struct cro_ctx *new_extra,
+ struct cro_ctx *old, struct cro_ctx *new, enum gfx_extra extra,
const struct area *areas)
{
cairo_t *old_cr;
cairo_surface_t *s;
- old_cr = make_diff(cr, cx, cy, scale, old, old_extra, new, new_extra,
- areas, NULL);
+ old_cr = make_diff(cr, cx, cy, scale, old, new, extra, areas, NULL);
s = cairo_get_target(old_cr);
cairo_set_source_surface(cr, s, 0, 0);
diff --git a/gfx/diff.h b/gfx/diff.h
index d1fbc18..189261c 100644
--- a/gfx/diff.h
+++ b/gfx/diff.h
@@ -40,8 +40,7 @@ void add_area(struct area **areas, int xa, int ya, int xb, int yb,
void free_areas(struct area **areas);
void diff_to_canvas(cairo_t *cr, int cx, int cy, float scale,
- struct cro_ctx *old, struct cro_ctx *old_extra,
- struct cro_ctx *new, struct cro_ctx *new_extra,
+ struct cro_ctx *old, struct cro_ctx *new, enum gfx_extra extra,
const struct area *areas);
void *diff_process_file(struct diff *diff, struct file_names *file_names,