performance boost of "show net on symbol pins" feature

This commit is contained in:
Stefan Schippers 2020-10-02 18:19:31 +02:00
parent 6805335a09
commit 164ce52945
6 changed files with 17 additions and 2 deletions

View File

@ -1678,6 +1678,7 @@ void new_wire(int what, double mx_snap, double my_snap)
if(show_pin_net_names) {
int w;
prepare_netlist_structs(0);
find_inst_hash_clear();
bbox(BEGIN , 0.0 , 0.0 , 0.0 , 0.0);
for(w=savelastwire; w<lastwire; w++) {
find_inst_to_be_redrawn(wire[w].node);

View File

@ -949,6 +949,7 @@ void update_symbol(const char *result, int x)
bbox(BEGIN,0.0,0.0,0.0,0.0);
if(show_pin_net_names) {
prepare_netlist_structs(0);
find_inst_hash_clear();
for(k = 0; k < (inst_ptr[i].ptr + instdef)->rects[PINLAYER]; k++) {
if( inst_ptr[i].node && inst_ptr[i].node[k]) {
find_inst_to_be_redrawn(inst_ptr[i].node[k]);
@ -1095,6 +1096,7 @@ void update_symbol(const char *result, int x)
if(show_pin_net_names) {
prepare_netlist_structs(0);
find_inst_hash_clear();
for(k = 0; k < (inst_ptr[i].ptr + instdef)->rects[PINLAYER]; k++) {
if( inst_ptr[i].node && inst_ptr[i].node[k]) {
find_inst_to_be_redrawn(inst_ptr[i].node[k]);

View File

@ -445,11 +445,21 @@ void draw_selection(GC g, int interruptable)
lastsel = i;
}
static struct int_hashentry *nodetable[HASHSIZE];
void find_inst_hash_clear(void)
{
free_int_hash(nodetable);
}
void find_inst_to_be_redrawn(const char *node)
{
int i, p, rects;
Instdef * sym;
if(int_hash_lookup(nodetable, node, 0, XINSERT_NOREPLACE)) return;
for(i=0; i< lastinst; i++) {
sym = inst_ptr[i].ptr + instdef;
rects = sym->rects[PINLAYER];
@ -534,7 +544,7 @@ void copy_objects(int what)
set_modify(1); push_undo(); /* 20150327 push_undo */
prepared_hash_instances=0; /* 20171224 */
prepared_hash_wires=0;
if(show_pin_net_names) find_inst_hash_clear();
/* calculate copied symbols bboxes before actually doing the move */
for(i=0;i<lastselected;i++)
{
@ -984,6 +994,7 @@ void move_objects(int what, int merge, double dx, double dy)
set_modify(1);
prepared_hash_instances=0; /* 20171224 */
prepared_hash_wires=0;
if(show_pin_net_names) find_inst_hash_clear();
if( !(ui_state & (STARTMERGE | PLACE_SYMBOL)) ) {
dbg(1, "move_objects(): push undo state\n");
push_undo(); /* 20150327 push_undo */

View File

@ -631,7 +631,6 @@ void prepare_netlist_structs(int for_netlist)
if (for_netlist>0 && prepared_netlist_structs) return; /* 20160413 */
else if (!for_netlist && prepared_hilight_structs) return; /* 20171210 */
else delete_netlist_structs();
here();
if (for_netlist>0) {
my_snprintf(nn, S(nn), "-----------%s", schematic[currentsch]);
statusmsg(nn,2);

View File

@ -224,6 +224,7 @@ void delete(void)
prepared_netlist_structs=0;
prepared_hilight_structs=0;
if(show_pin_net_names) {
find_inst_hash_clear();
prepare_netlist_structs(0);
}
for(i = 0; i < lastselected; i++) {

View File

@ -873,6 +873,7 @@ extern void arc_3_points(double x1, double y1, double x2, double y2, double x3,
extern void move_objects(int what,int merge, double dx, double dy);
extern void copy_objects(int what);
extern void find_inst_to_be_redrawn(const char *node);
extern void find_inst_hash_clear(void);
extern void pan(int what);
extern void pan2(int what, int mx, int my);
extern void zoom_box(int what);