summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-23 17:00:55 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-23 17:00:55 -0300
commitc9b85bd14a54881898d08261f7b9d98288a217b3 (patch)
tree423b685c283e2157c7b1c07d48f39056987c1282 /gui
parentee5aca2e6cc5a60ea8356e56ca315609c7ea7bc3 (diff)
downloadeeshow-c9b85bd14a54881898d08261f7b9d98288a217b3.tar.gz
eeshow-c9b85bd14a54881898d08261f7b9d98288a217b3.tar.bz2
eeshow-c9b85bd14a54881898d08261f7b9d98288a217b3.zip
gui/: do without the "unrender_all" atrocity
Benefits: - no horrible memory leak - we don't need to jump to the current page (causing zoom_to_extents) Drawbacks: - only supported in non-diff modes
Diffstat (limited to 'gui')
-rw-r--r--gui/common.h3
-rw-r--r--gui/gui.c18
-rw-r--r--gui/render.c12
-rw-r--r--gui/sheet.c3
4 files changed, 12 insertions, 24 deletions
diff --git a/gui/common.h b/gui/common.h
index 2ad96a8..1398931 100644
--- a/gui/common.h
+++ b/gui/common.h
@@ -33,6 +33,7 @@ struct gui_sheet {
struct gui_ctx *ctx; /* back link */
struct gui_hist *hist; /* back link */
struct cro_ctx *gfx_ctx;
+ struct cro_ctx *gfx_ctx_extra;
int w, h; /* in eeschema coordinates */
int xmin, ymin;
@@ -153,8 +154,6 @@ void show_history(struct gui_ctx *ctx, enum selecting sel);
/* gui.c */
-void unrender_all(struct gui_ctx *ctx);
-
struct gui_sheet *find_corresponding_sheet(struct gui_sheet *pick_from,
struct gui_sheet *ref_in, const struct gui_sheet *ref);
void mark_aois(struct gui_ctx *ctx, struct gui_sheet *sheet);
diff --git a/gui/gui.c b/gui/gui.c
index dd00832..5fe3cc9 100644
--- a/gui/gui.c
+++ b/gui/gui.c
@@ -43,24 +43,6 @@
#include "gui/gui.h"
-/* ----- @@@ Hack: discard all rendering on major mode change -------------- */
-
-void unrender_all(struct gui_ctx *ctx)
-{
- const struct gui_hist *h;
- struct gui_sheet *sheet;
-
- for (h = ctx->hist; h; h = h->next)
- for (sheet = h->sheets; sheet; sheet = sheet->next) {
- /*
- * @@@ if there was a gfx_free, we wouldn't create a
- * massive memory leak here.
- */
- sheet->rendered = 0;
- }
-}
-
-
/* ----- Helper functions -------------------------------------------------- */
diff --git a/gui/render.c b/gui/render.c
index 64ddb7c..2e2aa77 100644
--- a/gui/render.c
+++ b/gui/render.c
@@ -181,11 +181,15 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
cro_canvas_prepare(cr);
if (!ctx->old_hist || ctx->diff_mode == diff_new) {
highlight_glabel(ctx, sheet, cr, x, y, f);
+ if (show_extra)
+ cro_canvas_draw(sheet->gfx_ctx_extra, cr, x, y, f);
cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f);
} else if (ctx->diff_mode == diff_old) {
sheet = find_corresponding_sheet(ctx->old_hist->sheets,
ctx->new_hist->sheets, ctx->curr_sheet);
highlight_glabel(ctx, sheet, cr, x, y, f);
+ if (show_extra)
+ cro_canvas_draw(sheet->gfx_ctx_extra, cr, x, y, f);
cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f);
} else if (use_delta) {
struct area *areas = changed_sheets(ctx, x, y, f);
@@ -236,11 +240,15 @@ void render_sheet(struct gui_sheet *sheet)
pl_render(sheet->hist->pl, sheet->hist->sch_ctx.sheets,
sheet->sch);
sch_render(sheet->sch);
- if (show_extra)
- sch_render_extra(sheet->sch);
cro_canvas_end(gfx_ctx,
&sheet->w, &sheet->h, &sheet->xmin, &sheet->ymin);
sheet->gfx_ctx = gfx_ctx;
+
+ gfx_init(&cro_canvas_ops, 1, argv);
+ sch_render_extra(sheet->sch);
+ cro_canvas_end(gfx_ctx, NULL, NULL, NULL, NULL);
+ sheet->gfx_ctx_extra = gfx_ctx;
+
sheet->rendered = 1;
// gfx_end();
}
diff --git a/gui/sheet.c b/gui/sheet.c
index 8a7414a..3e62485 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -552,8 +552,7 @@ static void sheet_key(void *user, int x, int y, int keyval)
break;
case GDK_KEY_e:
show_extra = !show_extra;
- unrender_all(ctx);
- go_to_sheet(ctx, ctx->curr_sheet);
+ redraw(ctx);
break;
case GDK_KEY_n: