From 90407d5730edf9ffb9d8a34090ea85dae5006958 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 9 Mar 2020 13:12:01 +0300 Subject: [PATCH] Fix screen artifacts: In mark_cells_from_index(void) mark all rectangle (in most cases this not decrease render speed, and more fast in calculation, and no errors) --- plot.c | 50 +++++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/plot.c b/plot.c index 498aa88..9fa1c07 100644 --- a/plot.c +++ b/plot.c @@ -787,48 +787,29 @@ invalidateRect(int x0, int y0, int x1, int y1){ mark_map(x, y); } +#define SWAP(x,y) {int t=x;x=y;y=t;} + static void mark_cells_from_index(void) { - int t; + int t, i; /* mark cells between each neighber points */ for (t = 0; t < TRACES_MAX; t++) { if (!trace[t].enabled) continue; - int x0 = CELL_X(trace_index[t][0]); - int y0 = CELL_Y(trace_index[t][0]); - int m0 = x0 / CELLWIDTH; - int n0 = y0 / CELLHEIGHT; - int i; - mark_map(m0, n0); + int m0 = CELL_X(trace_index[t][0]) / CELLWIDTH; + int n0 = CELL_Y(trace_index[t][0]) / CELLHEIGHT; + markmap[current_mappage][n0] |= 1<x1) SWAP(x0, x1); m0=m1; + int y0 = n0; int y1 = n1; if (y0>y1) SWAP(y0, y1); n0=n1; + for (; y0<=y1; y0++) + for(int j=x0;j<=x1;j++) + markmap[current_mappage][y0]|= 1<