diff --git a/src/draw.c b/src/draw.c index 3317302f..fc5519c4 100644 --- a/src/draw.c +++ b/src/draw.c @@ -102,13 +102,6 @@ void print_image() } else return; } - #if 0 - * for(tmp=0;tmpgc[tmp], 0, 0, xctx->xrect, 1, Unsorted); - * XSetClipRectangles(display, xctx->gcstipple[tmp], 0, 0, xctx->xrect, 1, Unsorted); - * } - * XSetClipRectangles(display, xctx->gctiled, 0, 0, xctx->xrect, 1, Unsorted); - #endif save_draw_grid = tclgetboolvar("draw_grid"); tclsetvar("draw_grid", "0"); save_draw_window = xctx->draw_window; @@ -2710,6 +2703,15 @@ static void draw_graph_points(int idx, int first, int last, /* if( 1 || !digital || (c1 >= gr->ypos1 && c1 <= gr->ypos2) ) { */ for(p = first ; p <= last; p++) { yy = gv[p]; + /* clamps 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 + * platform where is no XSetClipRectangles() + * waveform points outise graph are drawn as a line on top or bottom of graph + * <<<<< FIXME: remove these points completely + */ + #if !defined(__unix__) + yy = CLIP(yy, gr->gy1, gr->gy2); + #endif if(digital) { yy = c + yy *s2; /* Build poly y array. Translate from graph coordinates to screen coordinates */ diff --git a/src/xinit.c b/src/xinit.c index 1717a71f..3a1586df 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1057,10 +1057,14 @@ void set_clip_mask(int what) if(what == SET) { for(i=0;igc[i], 0,0, xctx->xrect, 1, Unsorted); XSetClipRectangles(display, xctx->gcstipple[i], 0,0, xctx->xrect, 1, Unsorted); + #endif } + #if 1 /* set to 0 to emulate Windows that does not have this function */ XSetClipRectangles(display, xctx->gctiled, 0,0, xctx->xrect, 1, Unsorted); + #endif #if HAS_CAIRO==1 cairo_rectangle(xctx->cairo_ctx, xctx->xrect[0].x, xctx->xrect[0].y, xctx->xrect[0].width, xctx->xrect[0].height);