Index: trunk/src/layer.c =================================================================== --- trunk/src/layer.c (revision 14741) +++ trunk/src/layer.c (revision 14742) @@ -742,6 +742,14 @@ return hash; } +pcb_layer_type_t pcb_layer_mirror_type(pcb_layer_type_t lyt) +{ + if (lyt & PCB_LYT_TOP) + return (lyt & ~PCB_LYT_TOP) | PCB_LYT_BOTTOM; + else if (lyt & PCB_LYT_BOTTOM) + return (lyt & ~PCB_LYT_BOTTOM) | PCB_LYT_TOP; + return lyt; +} int pcb_layer_type_map(pcb_layer_type_t type, void *ctx, void (*cb)(void *ctx, pcb_layer_type_t bit, const char *name, int class, const char *class_name)) { Index: trunk/src/layer.h =================================================================== --- trunk/src/layer.h (revision 14741) +++ trunk/src/layer.h (revision 14742) @@ -266,7 +266,10 @@ /* Calculate a hash of a bound layer (ingoring its name) */ unsigned int pcb_layer_hash_bound(pcb_layer_t *ly); +/* Calculate mirrored version of some (bound) layer properties */ +pcb_layer_type_t pcb_layer_mirror_type(pcb_layer_type_t lyt); + /* Modify tree pointers in dst to point to src's; allocates trees for src if they are not yet allocated */ void pcb_layer_link_trees(pcb_layer_t *dst, pcb_layer_t *src); Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 14741) +++ trunk/src/obj_subc.c (revision 14742) @@ -1621,10 +1621,7 @@ pcb_subc_mirror(NULL, newsc, yoff, pcb_true); for(n = 0; n < newsc->data->LayerN; n++) { pcb_layer_t *ly = newsc->data->Layer + n; - if (ly->meta.bound.type & PCB_LYT_TOP) - ly->meta.bound.type = (ly->meta.bound.type & ~PCB_LYT_TOP) | PCB_LYT_BOTTOM; - else if (ly->meta.bound.type & PCB_LYT_BOTTOM) - ly->meta.bound.type = (ly->meta.bound.type & ~PCB_LYT_BOTTOM) | PCB_LYT_TOP; + ly->meta.bound.type = pcb_layer_mirror_type(ly->meta.bound.type); } /* place the new subc */