added a fix in draw_graph_points() to avoid waves to be drawn outside of the graph box container on Windows, where there is no working XSetCLipRectangles()

This commit is contained in:
stefan schippers 2024-12-07 00:56:04 +01:00
parent 963e877497
commit f73cf30452
2 changed files with 13 additions and 7 deletions

View File

@ -102,13 +102,6 @@ void print_image()
}
else return;
}
#if 0
* for(tmp=0;tmp<cadlayers;tmp++) {
* XSetClipRectangles(display, xctx->gc[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 */

View File

@ -1057,10 +1057,14 @@ void set_clip_mask(int what)
if(what == SET) {
for(i=0;i<cadlayers; ++i)
{
#if 1 /* set to 0 to emulate Windows that does not have this function */
XSetClipRectangles(display, xctx->gc[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);