Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 29418) +++ trunk/src/draw.c (revision 29419) @@ -198,25 +198,30 @@ static void draw_virtual_layers(pcb_draw_info_t *info, const legacy_vlayer_t *lvly_drawn) { pcb_hid_expose_ctx_t hid_exp; + pcb_xform_t tmp; hid_exp.view = *info->drawn_area; if (set_vlayer(info, lvly_drawn->top_assy, lvly_drawn->top_assy_enable, PCB_VLY_TOP_ASSY)) { + xform_setup(info, &tmp, NULL); pcb_draw_assembly(info, PCB_LYT_TOP); pcb_render->end_layer(pcb_render); } if (set_vlayer(info, lvly_drawn->bot_assy, lvly_drawn->bot_assy_enable, PCB_VLY_BOTTOM_ASSY)) { + xform_setup(info, &tmp, NULL); pcb_draw_assembly(info, PCB_LYT_BOTTOM); pcb_render->end_layer(pcb_render); } if (set_vlayer(info, lvly_drawn->top_fab, lvly_drawn->top_fab_enable, PCB_VLY_FAB)) { + xform_setup(info, &tmp, NULL); pcb_stub_draw_fab(info, pcb_draw_out.fgGC, &hid_exp); pcb_render->end_layer(pcb_render); } if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0, &info->xform_exporter)) { + xform_setup(info, &tmp, NULL); pcb_stub_draw_csect(pcb_draw_out.fgGC, &hid_exp); pcb_render->end_layer(pcb_render); } @@ -329,7 +334,6 @@ static void draw_everything(pcb_draw_info_t *info) { - static pcb_xform_t xf_def = {0}; pcb_layergrp_id_t backsilk_gid; pcb_layergrp_t *backsilk_grp; pcb_color_t old_silk_color[PCB_MAX_LAYERGRP]; @@ -342,14 +346,6 @@ pcb_bool paste_empty; legacy_vlayer_t lvly; - /* no xform means we should use the default logic designed for the GUI */ - if (info->xform_caller == NULL) { - info->xform = info->xform_caller = &xf_def; - info->xform->wireframe = conf_core.editor.wireframe_draw; - info->xform->thin_draw = conf_core.editor.thin_draw; - info->xform->thin_draw_poly = conf_core.editor.thin_draw_poly; - } - backsilk_gid = ((!conf_core.editor.show_solder_side) ? pcb_layergrp_get_bottom_silk() : pcb_layergrp_get_top_silk()); backsilk_grp = pcb_get_layergrp(PCB, backsilk_gid); if (backsilk_grp != NULL) { @@ -576,12 +572,17 @@ static void pcb_draw_pstk_slots(pcb_draw_info_t *info, pcb_layergrp_id_t group, pcb_pstk_draw_hole_t holetype) { + pcb_xform_t tmp; + if (!PCB->hole_on) return; + xform_setup(info, &tmp, NULL); info->objcb.pstk.gid = group; info->objcb.pstk.holetype = holetype; pcb_r_search(PCB->Data->padstack_tree, info->drawn_area, NULL, pcb_pstk_draw_slot_callback, info, NULL); + info->xform = NULL; + info->layer = NULL; } /* --------------------------------------------------------------------------- @@ -926,6 +927,7 @@ if (!pcb_render->gui) pcb_draw_ppv(info, group); + pcb_render->set_drawing_mode(pcb_render, PCB_HID_COMP_FLUSH, pcb_draw_out.direct, info->drawn_area); } @@ -1081,12 +1083,35 @@ pcb_render = pcb_draw_out.hid; } +void pcb_draw_setup_default_xform(pcb_hid_t *hid, pcb_draw_info_t *info) +{ + static pcb_xform_t xf_def = {0}; + static pcb_xform_t xform_main_exp; + + if (info->xform_caller == NULL) { + if (hid->exporter) { + /* exporters without xform should automatically inherit the default xform for exporting, which differs from what GUI does */ + memset(&xform_main_exp, 0, sizeof(xform_main_exp)); + info->xform = info->xform_exporter = &xform_main_exp; + + xform_main_exp.omit_overlay = 1; /* normally exporters shouldn't draw overlays */ + info->xform_caller = &xform_main_exp; + } + else if (hid->gui) { + /* no xform means we should use the default logic designed for the GUI */ + info->xform = info->xform_exporter = &xf_def; + xf_def.wireframe = conf_core.editor.wireframe_draw; + xf_def.thin_draw = conf_core.editor.thin_draw; + xf_def.thin_draw_poly = conf_core.editor.thin_draw_poly; + } + } +} + void pcbhl_expose_main(pcb_hid_t * hid, const pcb_hid_expose_ctx_t *ctx, pcb_xform_t *xform_caller) { if (!pcb_draw_inhibit) { pcb_output_t save; pcb_draw_info_t info; - pcb_xform_t xform_main_exp; expose_begin(&save, hid); pcb_draw_info_setup(&info, PCB); @@ -1095,15 +1120,8 @@ info.xform = info.xform_exporter = NULL; info.layer = NULL; - if ((hid->exporter) && (xform_caller == NULL)) { - /* exporters without xform should automatically inherit the default xform for exporting, which differs from what GUI does */ - memset(&xform_main_exp, 0, sizeof(xform_main_exp)); - info.xform = info.xform_exporter = &xform_main_exp; + pcb_draw_setup_default_xform(hid, &info); - xform_main_exp.omit_overlay = 1; /* normally exporters shouldn't draw overlays */ - info.xform_caller = &xform_main_exp; - } - draw_everything(&info); expose_end(&save); } Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 29418) +++ trunk/src/draw.h (revision 29419) @@ -138,7 +138,7 @@ void pcb_draw_layer_under(pcb_board_t *pcb, const pcb_layer_t *Layer, const pcb_box_t *screen, pcb_data_t *data); /* Composite draw all layer groups matching lyt/purpi/purpose */ -void pcb_draw_groups(pcb_board_t *pcb, pcb_layer_type_t lyt, int purpi, char *purpose, const pcb_box_t *screen, const pcb_color_t *default_color, pcb_layer_type_t pstk_lyt_match, int thin_draw, int invert); +void pcb_draw_groups(pcb_hid_t *hid, pcb_board_t *pcb, pcb_layer_type_t lyt, int purpi, char *purpose, const pcb_box_t *screen, const pcb_color_t *default_color, pcb_layer_type_t pstk_lyt_match, int thin_draw, int invert); void pcb_erase_obj(int, void *, void *); @@ -170,6 +170,8 @@ void pcb_label_invalidate(pcb_coord_t x, pcb_coord_t y, double scale, pcb_bool vert, pcb_bool centered, const char *label); +void pcb_draw_setup_default_xform(pcb_hid_t *hid, pcb_draw_info_t *info); + /* Schedule an object to be called again at the end for drawing its labels on top of everything. */ void pcb_draw_delay_label_add(pcb_any_obj_t *obj); Index: trunk/src/draw_composite.c =================================================================== --- trunk/src/draw_composite.c (revision 29418) +++ trunk/src/draw_composite.c (revision 29419) @@ -180,17 +180,21 @@ pcb_draw_pstks(ctx->info, ctx->gid, 0, *pstk_lyt_match); } -void pcb_draw_groups(pcb_board_t *pcb, pcb_layer_type_t lyt, int purpi, char *purpose, const pcb_box_t *screen, const pcb_color_t *default_color, pcb_layer_type_t pstk_lyt_match, int thin_draw, int invert) +void pcb_draw_groups(pcb_hid_t *hid, pcb_board_t *pcb, pcb_layer_type_t lyt, int purpi, char *purpose, const pcb_box_t *screen, const pcb_color_t *default_color, pcb_layer_type_t pstk_lyt_match, int thin_draw, int invert) { pcb_draw_info_t info; pcb_layergrp_id_t gid; pcb_layergrp_t *g; comp_ctx_t cctx; + pcb_xform_t tmp; memset(&info, 0, sizeof(info)); info.pcb = pcb; info.drawn_area = screen; + pcb_draw_setup_default_xform(hid, &info); + xform_setup(&info, &tmp, NULL); + for(gid = 0, g = pcb->LayerGroups.grp; gid < pcb->LayerGroups.len; gid++,g++) { pcb_layer_t *ly = NULL; Index: trunk/src/draw_ly_spec.c =================================================================== --- trunk/src/draw_ly_spec.c (revision 29418) +++ trunk/src/draw_ly_spec.c (revision 29419) @@ -45,7 +45,10 @@ pcb_layergrp_id_t gid = -1; comp_ctx_t cctx; pcb_layer_t *ly = NULL; + pcb_xform_t tmp; + xform_setup(info, &tmp, NULL); + pcb_layergrp_list(info->pcb, PCB_LYT_PASTE | side_lyt, &gid, 1); cctx.grp = pcb_get_layergrp((pcb_board_t *)info->pcb, gid); @@ -83,7 +86,10 @@ pcb_layergrp_id_t gid = -1; comp_ctx_t cctx; pcb_layer_t *ly = NULL; + pcb_xform_t tmp; + xform_setup(info, &tmp, NULL); + pcb_layergrp_list(PCB, PCB_LYT_MASK | side_lyt, &gid, 1); cctx.grp = pcb_get_layergrp(PCB, gid); Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 29418) +++ trunk/src_plugins/export_gerber/gerber.c (revision 29419) @@ -891,8 +891,8 @@ if (want_outline && !(PCB_LAYER_IS_ROUTE(flags, purpi))) { if (has_outline) { - pcb_draw_groups(PCB, PCB_LYT_BOUNDARY, F_proute, NULL, ®ion, pcb_color_black, PCB_LYT_MECH, 0, 0); - pcb_draw_groups(PCB, PCB_LYT_BOUNDARY, F_uroute, NULL, ®ion, pcb_color_black, PCB_LYT_MECH, 0, 0); + pcb_draw_groups(hid, PCB, PCB_LYT_BOUNDARY, F_proute, NULL, ®ion, pcb_color_black, PCB_LYT_MECH, 0, 0); + pcb_draw_groups(hid, PCB, PCB_LYT_BOUNDARY, F_uroute, NULL, ®ion, pcb_color_black, PCB_LYT_MECH, 0, 0); } else { pcb_hid_gc_t gc = pcb_hid_make_gc(); Index: trunk/src_plugins/export_ps/ps.c =================================================================== --- trunk/src_plugins/export_ps/ps.c (revision 29418) +++ trunk/src_plugins/export_ps/ps.c (revision 29419) @@ -944,8 +944,8 @@ !(PCB_LAYER_IS_ROUTE(flags, purpi))) { int save_drill = global.is_drill; global.is_drill = 0; - pcb_draw_groups(PCB, PCB_LYT_BOUNDARY, F_proute, NULL, &global.exps.view, pcb_color_black, PCB_LYT_MECH, 0, 0); - pcb_draw_groups(PCB, PCB_LYT_BOUNDARY, F_uroute, NULL, &global.exps.view, pcb_color_black, PCB_LYT_MECH, 0, 0); + pcb_draw_groups(hid, PCB, PCB_LYT_BOUNDARY, F_proute, NULL, &global.exps.view, pcb_color_black, PCB_LYT_MECH, 0, 0); + pcb_draw_groups(hid, PCB, PCB_LYT_BOUNDARY, F_uroute, NULL, &global.exps.view, pcb_color_black, PCB_LYT_MECH, 0, 0); global.is_drill = save_drill; }