diff options
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/cro.c | 15 | ||||
-rw-r--r-- | gfx/cro.h | 4 | ||||
-rw-r--r-- | gfx/diff.c | 18 | ||||
-rw-r--r-- | gfx/diff.h | 3 |
4 files changed, 14 insertions, 26 deletions
@@ -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; @@ -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); @@ -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); @@ -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, |