fix previous commit for digital graphs

This commit is contained in:
stefan schippers 2024-12-07 11:40:49 +01:00
parent f73cf30452
commit 2ec8c61757
2 changed files with 16 additions and 6 deletions

View File

@ -2703,23 +2703,32 @@ static void draw_graph_points(int idx, int first, int last,
/* if( 1 || !digital || (c1 >= gr->ypos1 && c1 <= gr->ypos2) ) { */ /* if( 1 || !digital || (c1 >= gr->ypos1 && c1 <= gr->ypos2) ) { */
for(p = first ; p <= last; p++) { for(p = first ; p <= last; p++) {
yy = gv[p]; yy = gv[p];
/* clamps y-value of waves to be inside graph area. Not a clean solution
/* Below CLIP calls (for digital and non digital graphs) for Windows
* clamp y-value of waves to be inside graph area. Not a clean solution
* but avoids drawing outside of graph area when moving vertically on Windows * but avoids drawing outside of graph area when moving vertically on Windows
* platform where is no XSetClipRectangles() * platform where is no XSetClipRectangles()
* waveform points outise graph are drawn as a line on top or bottom of graph * waveform points outise graph are drawn as a line on top or bottom of graph
* <<<<< FIXME: remove these points completely * <<<<< FIXME: remove these points completely
*/ */
#if !defined(__unix__)
yy = CLIP(yy, gr->gy1, gr->gy2);
#endif
if(digital) { if(digital) {
yy = c + yy *s2; yy = c + yy *s2;
#if !defined(__unix__)
yy = CLIP(DS_Y(yy), Y_TO_SCREEN(gr->y1), Y_TO_SCREEN(gr->y2));
#else
yy = CLIP(DS_Y(yy), -30000, 30000); /* only clip to 16 bit signed short limits */
#endif
/* Build poly y array. Translate from graph coordinates to screen coordinates */ /* Build poly y array. Translate from graph coordinates to screen coordinates */
point[poly_npoints].y = (short)CLIP(DS_Y(yy), -30000, 30000); point[poly_npoints].y = (short)yy;
} else { } else {
/* Build poly y array. Translate from graph coordinates to screen coordinates */ /* Build poly y array. Translate from graph coordinates to screen coordinates */
if(gr->logy) yy = mylog10(yy); if(gr->logy) yy = mylog10(yy);
point[poly_npoints].y = (short)CLIP(S_Y(yy), -30000, 30000); #if !defined(__unix__)
yy = CLIP(S_Y(yy), Y_TO_SCREEN(gr->y1), Y_TO_SCREEN(gr->y2));
#else
yy = CLIP(S_Y(yy), -30000, 30000); /* only clip to 16 bit signed short limits */
#endif
point[poly_npoints].y = (short)yy;
} }
poly_npoints++; poly_npoints++;
} }

View File

@ -861,6 +861,7 @@ typedef struct {
double sx1, sy1, sx2, sy2; /* screen coordinates of above */ double sx1, sy1, sx2, sy2; /* screen coordinates of above */
/* graph box (smaller than rect container due to margins) */ /* graph box (smaller than rect container due to margins) */
double x1, y1, x2, y2, w, h; double x1, y1, x2, y2, w, h;
/* the following are the x1,x2, y1, y2 rectangle attributes */
double gx1, gy1, gx2, gy2, gw, gh; double gx1, gy1, gx2, gy2, gw, gh;
double master_gx1, master_gx2, master_gw, master_cx; double master_gx1, master_gx2, master_gw, master_cx;
/* y area range for digital graphs */ /* y area range for digital graphs */