Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 21195) +++ trunk/src/draw.c (revision 21196) @@ -186,12 +186,12 @@ int plated, unplated; pcb_board_count_holes(PCB, &plated, &unplated, info->drawn_area); - if (plated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_PLATED_DRILL, 0, &info->xform_caller)) { + if (plated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_PLATED_DRILL, 0, &info->xform_exporter)) { pcb_draw_pstk_holes(info, gid, PCB_PHOLE_PLATED); pcb_gui->end_layer(); } - if (unplated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_UNPLATED_DRILL, 0, &info->xform_caller)) { + if (unplated && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_UNPLATED_DRILL, 0, &info->xform_exporter)) { pcb_draw_pstk_holes(info, gid, PCB_PHOLE_UNPLATED); pcb_gui->end_layer(); } @@ -204,22 +204,22 @@ hid_exp.view = *info->drawn_area; hid_exp.force = 0; - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_TOP_ASSY, 0, &info->xform_caller)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_TOP_ASSY, 0, &info->xform_exporter)) { pcb_draw_assembly(info, PCB_LYT_TOP); pcb_gui->end_layer(); } - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_BOTTOM_ASSY, 0, &info->xform_caller)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_BOTTOM_ASSY, 0, &info->xform_exporter)) { pcb_draw_assembly(info, PCB_LYT_BOTTOM); pcb_gui->end_layer(); } - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_FAB, 0, &info->xform_caller)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_FAB, 0, &info->xform_exporter)) { pcb_stub_draw_fab(info, pcb_draw_out.fgGC, &hid_exp); pcb_gui->end_layer(); } - if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0, &info->xform_caller)) { + if (pcb_layer_gui_set_vlayer(PCB, PCB_VLY_CSECT, 0, &info->xform_exporter)) { pcb_stub_draw_csect(pcb_draw_out.fgGC, &hid_exp); pcb_gui->end_layer(); } @@ -240,7 +240,7 @@ } /* if there's any UI layer, try to draw them */ - if ((first != NULL) && pcb_layer_gui_set_g_ui(first, 0, &info->xform_caller)) { + if ((first != NULL) && pcb_layer_gui_set_g_ui(first, 0, &info->xform_exporter)) { int have_canvas = 0; for(i = 0; i < vtp0_len(&pcb_uilayers); i++) { ly = pcb_uilayers.array[i]; @@ -364,7 +364,7 @@ /* * first draw all 'invisible' stuff */ - if (!conf_core.editor.check_planes && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_INVISIBLE, 0, &info->xform_caller)) { + if (!conf_core.editor.check_planes && pcb_layer_gui_set_vlayer(PCB, PCB_VLY_INVISIBLE, 0, &info->xform_exporter)) { pcb_layer_type_t side = PCB_LYT_INVISIBLE_SIDE(); pcb_draw_silk_doc(info, side, PCB_LYT_DOC, 0, 1); pcb_draw_silk_doc(info, side, PCB_LYT_SILK, 0, 1); @@ -387,7 +387,7 @@ for (i = ngroups - 1; i >= 0; i--) { pcb_layergrp_id_t group = drawn_groups[i]; - if (pcb_layer_gui_set_glayer(PCB, group, 0, &info->xform_caller)) { + if (pcb_layer_gui_set_glayer(PCB, group, 0, &info->xform_exporter)) { int is_current = 0; pcb_layergrp_id_t cgrp = CURRENT->meta.real.grp; @@ -419,13 +419,13 @@ /* Draw the solder mask if turned on */ gid = pcb_layergrp_get_top_mask(); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0, &info->xform_caller))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0, &info->xform_exporter))) { pcb_draw_mask(info, PCB_COMPONENT_SIDE); pcb_gui->end_layer(); } gid = pcb_layergrp_get_bottom_mask(); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0, &info->xform_caller))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, 0, &info->xform_exporter))) { pcb_draw_mask(info, PCB_SOLDER_SIDE); pcb_gui->end_layer(); } @@ -451,7 +451,7 @@ gid = pcb_layergrp_get_top_paste(); if (gid >= 0) paste_empty = pcb_layergrp_is_empty(PCB, gid); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty, &info->xform_caller))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty, &info->xform_exporter))) { pcb_draw_paste(info, PCB_COMPONENT_SIDE); pcb_gui->end_layer(); } @@ -459,7 +459,7 @@ gid = pcb_layergrp_get_bottom_paste(); if (gid >= 0) paste_empty = pcb_layergrp_is_empty(PCB, gid); - if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty, &info->xform_caller))) { + if ((gid >= 0) && (pcb_layer_gui_set_glayer(PCB, gid, paste_empty, &info->xform_exporter))) { pcb_draw_paste(info, PCB_SOLDER_SIDE); pcb_gui->end_layer(); } @@ -589,6 +589,14 @@ else pcb_xform_add(dst, info->xform_caller); } + if (info->xform_exporter != NULL) { + if (info->xform == NULL) { + info->xform = dst; + pcb_xform_copy(dst, info->xform_exporter); + } + else + pcb_xform_add(dst, info->xform_exporter); + } } void pcb_draw_layer(pcb_draw_info_t *info, const pcb_layer_t *Layer_) @@ -601,11 +609,9 @@ xform_setup(info, &xform, Layer); -printf("draw layer: %s %p %d\n", Layer->name, info->xform, info->xform != NULL ? info->xform->layer_faded : 0); - if (((info->xform_caller != NULL) && (info->xform_caller->layer_faded)) || ((info->xform != NULL) && (info->xform->layer_faded))) { + if (xform.layer_faded) { orig_color = Layer->meta.real.color; pcb_lighten_color(orig_color, new_color, 0.5); - printf(" LY COLOR %s -> %s\n", Layer->meta.real.color, new_color); Layer->meta.real.color = new_color; } @@ -655,7 +661,7 @@ info->layer = NULL; info->xform = NULL; - if (((info->xform_caller != NULL) && (info->xform_caller->layer_faded)) || ((info->xform != NULL) && (info->xform->layer_faded))) + if (xform.layer_faded) Layer->meta.real.color = orig_color; } @@ -666,7 +672,7 @@ info.pcb = pcb; info.drawn_area = screen; - info.xform_caller = info.xform = NULL; + info.xform_exporter = info.xform = NULL; /* fix screen coord order */ if ((screen->X2 <= screen->X1) || (screen->Y2 <= screen->Y1)) { @@ -704,7 +710,7 @@ info.pcb = pcb; info.drawn_area = screen; - info.xform_caller = info.xform = NULL; + info.xform_exporter = info.xform = NULL; xform_setup(&info, &tmp, Layer); @@ -973,7 +979,8 @@ expose_begin(&save, hid); info.pcb = PCB; info.drawn_area = &ctx->view; - info.xform_caller = info.xform = xform_caller; + info.xform_caller = xform_caller; + info.xform = info.xform_exporter = NULL; info.layer = NULL; draw_everything(&info); expose_end(&save); Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 21195) +++ trunk/src/draw.h (revision 21196) @@ -52,7 +52,8 @@ typedef struct pcb_draw_info_s { pcb_board_t *pcb; const pcb_box_t *drawn_area; - pcb_xform_t *xform_caller; /* the extra transformation the caller requested */ + pcb_xform_t *xform_caller; /* the extra transformation the caller requested (the one who has initiated the rendering, e.g. throuh pcb_draw_everything()) */ + pcb_xform_t *xform_exporter; /* the extra transformation the exporter requested (e.g. because of cam) */ pcb_xform_t *xform; /* the final transformation applied on objects */ const pcb_layer_t *layer; Index: trunk/src/draw_ly_spec.c =================================================================== --- trunk/src/draw_ly_spec.c (revision 21195) +++ trunk/src/draw_ly_spec.c (revision 21196) @@ -146,7 +146,7 @@ continue; if (setgrp) - if (!pcb_layer_gui_set_glayer(info->pcb, gid[n], 0, &info->xform_caller)) + if (!pcb_layer_gui_set_glayer(info->pcb, gid[n], 0, &info->xform_exporter)) continue; cctx.info = info; @@ -246,7 +246,7 @@ } count += numobj; - if (pcb_layer_gui_set_layer(gid, g, (numobj == 0), &info->xform_caller)) { + if (pcb_layer_gui_set_layer(gid, g, (numobj == 0), &info->xform_exporter)) { /* boundary does NOT support compisiting, everything is drawn in positive */ pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, pcb_draw_out.direct, info->drawn_area); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, info->drawn_area); Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 21195) +++ trunk/src/obj_common.h (revision 21196) @@ -99,6 +99,8 @@ pcb_coord_t bloat; /* if non-zero, bloat (positive) or shrink (negative) by this value */ unsigned layer_faded:1; /* draw layer colors faded */ + + /* WARNING: After adding new fields, make sure to update pcb_xform_add() below */ } pcb_xform_t; #define pcb_xform_clear(dst) memset(dst, 0, sizeof(pcb_xform_t)) @@ -108,6 +110,7 @@ pcb_xform_t *__dst__ = dst; \ const pcb_xform_t *__src__ = src; \ __dst__->bloat += __src__->bloat; \ + __dst__->layer_faded |= __src__->layer_faded; \ } while(0) #define pcb_xform_is_nop(src) ((src)->bloat == 0) Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 21195) +++ trunk/src/obj_pstk.c (revision 21196) @@ -762,7 +762,7 @@ info.pcb = pcb; info.drawn_area = drawn_area; - info.xform_caller = info.xform = NULL; + info.xform_caller = info.xform_exporter = info.xform = NULL; info.layer = NULL; info.objcb.pstk.gid = -1; info.objcb.pstk.holetype = PCB_PHOLE_UNPLATED | PCB_PHOLE_PLATED; Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 21195) +++ trunk/src/obj_subc.c (revision 21196) @@ -1694,7 +1694,7 @@ /* draw padstacks */ info.pcb = PCB; info.drawn_area = drawn_area; - info.xform_caller = info.xform = NULL; + info.xform_caller = info.xform_exporter = info.xform = NULL; info.layer = NULL; info.objcb.pstk.gid = -1; info.objcb.pstk.is_current = 1;