mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
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)
This commit is contained in:
parent
5cf86ee1a6
commit
90407d5730
50
plot.c
50
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<<m0;
|
||||
for (i = 1; i < sweep_points; i++) {
|
||||
int x1 = CELL_X(trace_index[t][i]);
|
||||
int y1 = CELL_Y(trace_index[t][i]);
|
||||
int m1 = x1 / CELLWIDTH;
|
||||
int n1 = y1 / CELLHEIGHT;
|
||||
while (m0 != m1 || n0 != n1) {
|
||||
if (m0 == m1) {
|
||||
if (n0 < n1) n0++; else n0--;
|
||||
} else if (n0 == n1) {
|
||||
if (m0 < m1) m0++; else m0--;
|
||||
} else {
|
||||
int x = ((m0 < m1) ? (m0 + 1) : m0) * CELLWIDTH;
|
||||
int y = ((n0 < n1) ? (n0 + 1) : n0) * CELLHEIGHT;
|
||||
int sgn = (n0 < n1) ? 1 : -1;
|
||||
if (sgn*(y-y0)*(x1-x0) < sgn*(x-x0)*(y1-y0)) {
|
||||
if (m0 < m1) m0++;
|
||||
else m0--;
|
||||
} else {
|
||||
if (n0 < n1) n0++;
|
||||
else n0--;
|
||||
}
|
||||
}
|
||||
mark_map(m0, n0);
|
||||
}
|
||||
x0 = x1;
|
||||
y0 = y1;
|
||||
m0 = m1;
|
||||
n0 = n1;
|
||||
int m1 = CELL_X(trace_index[t][i]) / CELLWIDTH;
|
||||
int n1 = CELL_Y(trace_index[t][i]) / CELLHEIGHT;
|
||||
if (m0 == m1 && n0 == n1)
|
||||
continue;
|
||||
int x0 = m0; int x1 = m1; if (x0>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<<x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -840,7 +821,6 @@ markmap_upperarea(void)
|
|||
invalidateRect(0, 0, AREA_WIDTH_NORMAL, 31);
|
||||
}
|
||||
|
||||
#define SWAP(x,y) {int t=x;x=y;y=t;}
|
||||
//
|
||||
// in most cases _compute_outcode clip calculation not give render line speedup
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue