From 3108e5f18c1ee66cbb3f6e18f9ca7a2c9e49ee39 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 15 Sep 2017 22:20:00 -0400 Subject: [PATCH] Found that the crosshair function was wasting compute cycles by drawing out-of-bounds when the crosshair was turned off rather than just not drawing it. --- dbwind/DBWtools.c | 3 +++ graphics/grTCairo2.c | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dbwind/DBWtools.c b/dbwind/DBWtools.c index 4cf315a1..3dc6696b 100644 --- a/dbwind/DBWtools.c +++ b/dbwind/DBWtools.c @@ -457,6 +457,9 @@ DBWDrawCrosshair(window, plane) { Point p; + /* Crosshair is disabled by setting to MINFINITY */ + if (crosshairPos.p_x == MINFINITY) return; + WindPointToScreen(window, &crosshairPos, &p); GrSetStuff(STYLE_YELLOW1); diff --git a/graphics/grTCairo2.c b/graphics/grTCairo2.c index c63388f8..c43056f1 100644 --- a/graphics/grTCairo2.c +++ b/graphics/grTCairo2.c @@ -146,13 +146,6 @@ int nb; TCairoData *tcairodata = (TCairoData *)tcairoCurrent.mw->w_grdata2; int i; - // Diagnostic - Display *disp = cairo_xlib_surface_get_display(tcairodata->surface); - Screen *screen = cairo_xlib_surface_get_screen(tcairodata->surface); - Drawable draw = cairo_xlib_surface_get_drawable(tcairodata->surface); - int w = cairo_xlib_surface_get_width(tcairodata->surface); - int h = cairo_xlib_surface_get_height(tcairodata->surface); - cairo_save(tcairodata->context); for (i = 0; i < nb; i++) {