From ae8931c7884bee53ac1c868130ea7d80c5795b86 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 1 May 2023 22:28:56 +0200 Subject: [PATCH] remove bbox() START/ADD/SET/END from some drawing operations. No observable performance impact and redraw is now more pixel precise, reducing artifacts. --- src/callback.c | 9 --------- src/hilight.c | 31 ------------------------------- src/scheduler.c | 9 --------- src/token.c | 9 --------- 4 files changed, 58 deletions(-) diff --git a/src/callback.c b/src/callback.c index f8c7b93b..1a573e46 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1943,20 +1943,11 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key, } if(key=='K' && state == ShiftMask) /* delete hilighted nets */ { - xRect boundbox; - int big = xctx->wires> 2000 || xctx->instances > 2000 ; if(xctx->semaphore >= 2) break; xctx->enable_drill=0; - if(!big) calc_drawing_bbox(&boundbox, 2); clear_all_hilights(); /* undraw_hilight_net(1); */ - if(!big) { - bbox(START, 0.0 , 0.0 , 0.0 , 0.0); - bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - } draw(); - if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); break; } if(key=='g' && state==Mod1Mask) { /* highlight net and send to viewer */ diff --git a/src/hilight.c b/src/hilight.c index 48adb13c..8e480cbc 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -596,16 +596,10 @@ int search(const char *tok, const char *val, int sub, int sel) const char *empty_string = ""; char *tmpname=NULL; int found = 0; - xRect boundbox; - int big = xctx->wires> 2000 || xctx->instances > 2000; #ifdef __unix__ regex_t re; #endif - /* when unselecting selected area should be redrawn */ - if(sel == -1 && !big) { - calc_drawing_bbox(&boundbox, 1); - } if(!val) { fprintf(errfp, "search(): warning: null val key\n"); return TCL_ERROR; @@ -765,13 +759,7 @@ int search(const char *tok, const char *val, int sub, int sel) } if(found) { if(sel == -1) { - if(!big) { - bbox(START, 0.0 , 0.0 , 0.0 , 0.0); - bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - } draw(); - if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } if(sel) { rebuild_selected_array(); /* sets or clears xctx->ui_state SELECTION flag */ @@ -1747,12 +1735,9 @@ void unhilight_net(void) { int i,n; char *type; - xRect boundbox; - int big = xctx->wires> 2000 || xctx->instances > 2000 ; rebuild_selected_array(); prepare_netlist_structs(0); - if(!big) calc_drawing_bbox(&boundbox, 2); dbg(1, "unhilight_net(): entering\n"); for(i=0;ilastsel; ++i) { n = xctx->sel_array[i].n; @@ -1775,14 +1760,8 @@ void unhilight_net(void) break; } } - if(!big) { - bbox(START, 0.0 , 0.0 , 0.0 , 0.0); - bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - } propagate_hilights(0, 1, XINSERT_NOREPLACE); /* will also clear xctx->hilight_nets if nothing left hilighted */ draw(); - if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); unselect_all(1); } @@ -1790,19 +1769,9 @@ void unhilight_net(void) /* redraws the whole affected rectangle, this avoids artifacts due to antialiased text */ void redraw_hilights(int clear) { - xRect boundbox; - int big = xctx->wires> 2000 || xctx->instances > 2000 ; if(!has_x) return; - if(!big) calc_drawing_bbox(&boundbox, 2); if(clear) clear_all_hilights(); - if(!big) { - bbox(START, 0.0 , 0.0 , 0.0 , 0.0); - bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - dbg(1, "bbox: %g %g %g %g\n", boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - } draw(); - if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } diff --git a/src/scheduler.c b/src/scheduler.c index cb8d8a2e..6b36c573 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -3755,19 +3755,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg * Clear all highlights */ else if(!strcmp(argv[1], "unhilight_all")) { - xRect boundbox; - int big = xctx->wires> 2000 || xctx->instances > 2000 ; xctx->enable_drill=0; - if(!big) calc_drawing_bbox(&boundbox, 2); clear_all_hilights(); /* undraw_hilight_net(1); */ - if(!big) { - bbox(START, 0.0 , 0.0 , 0.0 , 0.0); - bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - } draw(); - if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); Tcl_ResetResult(interp); } diff --git a/src/token.c b/src/token.c index 0904c582..e41d0d9e 100644 --- a/src/token.c +++ b/src/token.c @@ -95,21 +95,12 @@ void check_unique_names(int rename) int newpropcnt = 0; char *tmp = NULL; Int_hashentry *entry; - int big = xctx->wires> 2000 || xctx->instances > 2000; char *upinst = NULL; if(xctx->hilight_nets) { - xRect boundbox; - if(!big) calc_drawing_bbox(&boundbox, 2); xctx->enable_drill=0; clear_all_hilights(); - if(!big) { - bbox(START, 0.0 , 0.0 , 0.0 , 0.0); - bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - } draw(); - if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } int_hash_free(&xctx->inst_table); int_hash_init(&xctx->inst_table, HASHSIZE);