remove bbox() START/ADD/SET/END from some drawing operations. No observable performance impact and redraw is now more pixel precise, reducing artifacts.

This commit is contained in:
stefan schippers 2023-05-01 22:28:56 +02:00
parent 4c3b4d0321
commit ae8931c788
4 changed files with 0 additions and 58 deletions

View File

@ -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 */ if(key=='K' && state == ShiftMask) /* delete hilighted nets */
{ {
xRect boundbox;
int big = xctx->wires> 2000 || xctx->instances > 2000 ;
if(xctx->semaphore >= 2) break; if(xctx->semaphore >= 2) break;
xctx->enable_drill=0; xctx->enable_drill=0;
if(!big) calc_drawing_bbox(&boundbox, 2);
clear_all_hilights(); clear_all_hilights();
/* undraw_hilight_net(1); */ /* 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(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
break; break;
} }
if(key=='g' && state==Mod1Mask) { /* highlight net and send to viewer */ if(key=='g' && state==Mod1Mask) { /* highlight net and send to viewer */

View File

@ -596,16 +596,10 @@ int search(const char *tok, const char *val, int sub, int sel)
const char *empty_string = ""; const char *empty_string = "";
char *tmpname=NULL; char *tmpname=NULL;
int found = 0; int found = 0;
xRect boundbox;
int big = xctx->wires> 2000 || xctx->instances > 2000;
#ifdef __unix__ #ifdef __unix__
regex_t re; regex_t re;
#endif #endif
/* when unselecting selected area should be redrawn */
if(sel == -1 && !big) {
calc_drawing_bbox(&boundbox, 1);
}
if(!val) { if(!val) {
fprintf(errfp, "search(): warning: null val key\n"); fprintf(errfp, "search(): warning: null val key\n");
return TCL_ERROR; return TCL_ERROR;
@ -765,13 +759,7 @@ int search(const char *tok, const char *val, int sub, int sel)
} }
if(found) { if(found) {
if(sel == -1) { 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(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }
if(sel) { if(sel) {
rebuild_selected_array(); /* sets or clears xctx->ui_state SELECTION flag */ rebuild_selected_array(); /* sets or clears xctx->ui_state SELECTION flag */
@ -1747,12 +1735,9 @@ void unhilight_net(void)
{ {
int i,n; int i,n;
char *type; char *type;
xRect boundbox;
int big = xctx->wires> 2000 || xctx->instances > 2000 ;
rebuild_selected_array(); rebuild_selected_array();
prepare_netlist_structs(0); prepare_netlist_structs(0);
if(!big) calc_drawing_bbox(&boundbox, 2);
dbg(1, "unhilight_net(): entering\n"); dbg(1, "unhilight_net(): entering\n");
for(i=0;i<xctx->lastsel; ++i) { for(i=0;i<xctx->lastsel; ++i) {
n = xctx->sel_array[i].n; n = xctx->sel_array[i].n;
@ -1775,14 +1760,8 @@ void unhilight_net(void)
break; 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 */ propagate_hilights(0, 1, XINSERT_NOREPLACE); /* will also clear xctx->hilight_nets if nothing left hilighted */
draw(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
unselect_all(1); unselect_all(1);
} }
@ -1790,19 +1769,9 @@ void unhilight_net(void)
/* redraws the whole affected rectangle, this avoids artifacts due to antialiased text */ /* redraws the whole affected rectangle, this avoids artifacts due to antialiased text */
void redraw_hilights(int clear) void redraw_hilights(int clear)
{ {
xRect boundbox;
int big = xctx->wires> 2000 || xctx->instances > 2000 ;
if(!has_x) return; if(!has_x) return;
if(!big) calc_drawing_bbox(&boundbox, 2);
if(clear) clear_all_hilights(); 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(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }

View File

@ -3755,19 +3755,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* Clear all highlights */ * Clear all highlights */
else if(!strcmp(argv[1], "unhilight_all")) else if(!strcmp(argv[1], "unhilight_all"))
{ {
xRect boundbox;
int big = xctx->wires> 2000 || xctx->instances > 2000 ;
xctx->enable_drill=0; xctx->enable_drill=0;
if(!big) calc_drawing_bbox(&boundbox, 2);
clear_all_hilights(); clear_all_hilights();
/* undraw_hilight_net(1); */ /* 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(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }

View File

@ -95,21 +95,12 @@ void check_unique_names(int rename)
int newpropcnt = 0; int newpropcnt = 0;
char *tmp = NULL; char *tmp = NULL;
Int_hashentry *entry; Int_hashentry *entry;
int big = xctx->wires> 2000 || xctx->instances > 2000;
char *upinst = NULL; char *upinst = NULL;
if(xctx->hilight_nets) { if(xctx->hilight_nets) {
xRect boundbox;
if(!big) calc_drawing_bbox(&boundbox, 2);
xctx->enable_drill=0; xctx->enable_drill=0;
clear_all_hilights(); 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(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }
int_hash_free(&xctx->inst_table); int_hash_free(&xctx->inst_table);
int_hash_init(&xctx->inst_table, HASHSIZE); int_hash_init(&xctx->inst_table, HASHSIZE);