From 49887363519e8dba413d5712a466d1e267ff476e Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 9 Aug 2016 10:16:31 -0300 Subject: [PATCH] eeshow/gui.c: experimentally use pixel differences (WIP) This still has a number of bugs but the basics work. The most glaring issues: - AoI coordinates are wrong, so AoIs don't really work - "center and zoom to extents" is all wrong --- eeshow/gui.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/eeshow/gui.c b/eeshow/gui.c index b4faddf..b062c56 100644 --- a/eeshow/gui.c +++ b/eeshow/gui.c @@ -34,6 +34,7 @@ #include "git-hist.h" #include "sch.h" #include "delta.h" +#include "diff.h" #include "gui-aoi.h" #include "gui-over.h" #include "gui.h" @@ -140,6 +141,17 @@ static struct gui_sheet *find_corresponding_sheet(struct gui_sheet *pick_from, #define SHEET_OVERLAYS_Y 10 +static void hack(const struct gui_ctx *ctx, cairo_t *cr) +{ + const struct gui_sheet *a = ctx->curr_sheet; + const struct gui_sheet *b = find_corresponding_sheet( + ctx->last_hist->sheets, ctx->curr_hist->sheets, ctx->curr_sheet); + + diff_to_canvas(cr, ctx->x, ctx->y, 1.0 / (1 << ctx->zoom), + a->gfx_ctx, b->gfx_ctx); +} + + static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr, gpointer user_data) { @@ -157,10 +169,13 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr, if (!ctx->last_hist) { cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f); } else { +#if 0 /* @@@ fix geometry later */ cro_canvas_draw(ctx->delta_ab.gfx_ctx, cr, x, y, f); cro_canvas_draw(ctx->delta_a.gfx_ctx, cr, x, y, f); cro_canvas_draw(ctx->delta_b.gfx_ctx, cr, x, y, f); +#endif + hack(ctx, cr); } overlay_draw_all(ctx->sheet_overlays, cr, @@ -186,8 +201,13 @@ static void render_sheet(struct gui_sheet *sheet) } +/* @@@ not nice to have this so far out */ +static void mark_aois(struct gui_ctx *ctx, struct gui_sheet *sheet); + + static void render_delta(struct gui_ctx *ctx) { +#if 0 struct sheet *sch_a, *sch_b, *sch_ab; const struct gui_sheet *a = ctx->curr_sheet; const struct gui_sheet *b = find_corresponding_sheet( @@ -211,6 +231,14 @@ static void render_delta(struct gui_ctx *ctx) cro_color_override(ctx->delta_b.gfx_ctx, COLOR_GREEN2); // @@@ clean up when leaving sheet +#endif + struct gui_sheet *b = find_corresponding_sheet( + ctx->last_hist->sheets, ctx->curr_hist->sheets, ctx->curr_sheet); + + if (!b->rendered) { + render_sheet(b); + mark_aois(ctx, b); + } }