Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 19383) +++ trunk/src/draw.c (revision 19384) @@ -247,7 +247,7 @@ pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, info->drawn_area); have_canvas = 1; } - pcb_draw_layer(info->pcb, ly, info->drawn_area); + pcb_draw_layer(info, ly); } } if (have_canvas) @@ -563,26 +563,13 @@ #include "draw_composite.c" #include "draw_ly_spec.c" -void pcb_draw_layer(const pcb_board_t *pcb, const pcb_layer_t *Layer, const pcb_box_t *screen) +void pcb_draw_layer(pcb_draw_info_t *info, const pcb_layer_t *Layer) { - pcb_draw_info_t info; - pcb_box_t scr2; unsigned int lflg = 0; int may_have_delayed = 0; - if ((screen->X2 <= screen->X1) || (screen->Y2 <= screen->Y1)) { - scr2 = *screen; - screen = &scr2; - if (scr2.X2 <= scr2.X1) - scr2.X2 = scr2.X1+1; - if (scr2.Y2 <= scr2.Y1) - scr2.Y2 = scr2.Y1+1; - } + info->layer = Layer; - info.pcb = pcb; - info.drawn_area = screen; - info.layer = Layer; - lflg = pcb_layer_flags_(Layer); if (PCB_LAYERFLG_ON_VISIBLE_SIDE(lflg)) pcb_draw_out.active_padGC = pcb_draw_out.padGC; @@ -594,12 +581,12 @@ delayed_terms_enabled = pcb_true; pcb_hid_set_line_width(pcb_draw_out.fgGC, 1); pcb_hid_set_line_cap(pcb_draw_out.fgGC, pcb_cap_square); - pcb_r_search(Layer->polygon_tree, screen, NULL, pcb_poly_draw_term_callback, &info, NULL); + pcb_r_search(Layer->polygon_tree, info->drawn_area, NULL, pcb_poly_draw_term_callback, info, NULL); delayed_terms_enabled = pcb_false; may_have_delayed = 1; } else { - pcb_r_search(Layer->polygon_tree, screen, NULL, pcb_poly_draw_callback, &info, NULL); + pcb_r_search(Layer->polygon_tree, info->drawn_area, NULL, pcb_poly_draw_callback, info, NULL); } if (conf_core.editor.check_planes) @@ -608,25 +595,49 @@ /* draw all visible layer objects (with terminal gfx on copper) */ if (lflg & PCB_LYT_COPPER) { delayed_terms_enabled = pcb_true; - pcb_r_search(Layer->line_tree, screen, NULL, pcb_line_draw_term_callback, &info, NULL); - pcb_r_search(Layer->arc_tree, screen, NULL, pcb_arc_draw_term_callback, &info, NULL); - pcb_r_search(Layer->text_tree, screen, NULL, pcb_text_draw_term_callback, &info, NULL); + pcb_r_search(Layer->line_tree, info->drawn_area, NULL, pcb_line_draw_term_callback, info, NULL); + pcb_r_search(Layer->arc_tree, info->drawn_area, NULL, pcb_arc_draw_term_callback, info, NULL); + pcb_r_search(Layer->text_tree, info->drawn_area, NULL, pcb_text_draw_term_callback, info, NULL); delayed_terms_enabled = pcb_false; may_have_delayed = 1; } else { - pcb_r_search(Layer->line_tree, screen, NULL, pcb_line_draw_callback, &info, NULL); - pcb_r_search(Layer->arc_tree, screen, NULL, pcb_arc_draw_callback, &info, NULL); - pcb_r_search(Layer->text_tree, screen, NULL, pcb_text_draw_callback, &info, NULL); + pcb_r_search(Layer->line_tree, info->drawn_area, NULL, pcb_line_draw_callback, info, NULL); + pcb_r_search(Layer->arc_tree, info->drawn_area, NULL, pcb_arc_draw_callback, info, NULL); + pcb_r_search(Layer->text_tree, info->drawn_area, NULL, pcb_text_draw_callback, info, NULL); } if (may_have_delayed) - pcb_draw_delayed_objs(&info); + pcb_draw_delayed_objs(info); out:; pcb_draw_out.active_padGC = NULL; + + info->layer = NULL; } +void pcb_draw_layer_noxform(const pcb_board_t *pcb, const pcb_layer_t *Layer, const pcb_box_t *screen) +{ + pcb_draw_info_t info; + pcb_box_t scr2; + + info.pcb = pcb; + info.drawn_area = screen; + + /* fix screen coord order */ + if ((screen->X2 <= screen->X1) || (screen->Y2 <= screen->Y1)) { + scr2 = *screen; + info.drawn_area = &scr2; + if (scr2.X2 <= scr2.X1) + scr2.X2 = scr2.X1+1; + if (scr2.Y2 <= scr2.Y1) + scr2.Y2 = scr2.Y1+1; + } + + pcb_draw_layer(&info, Layer); +} + + /* This version is about 1% slower and used rarely, thus it's all dupped from pcb_draw_layer() to keep the original speed there */ void pcb_draw_layer_under(const pcb_board_t *pcb, const pcb_layer_t *Layer, const pcb_box_t *screen, pcb_data_t *data) @@ -728,7 +739,7 @@ layernum = layers[i]; Layer = info->pcb->Data->Layer + layernum; if (!(gflg & PCB_LYT_SILK) && Layer->meta.real.vis) - pcb_draw_layer(info->pcb, Layer, info->drawn_area); + pcb_draw_layer(info, Layer); } if ((gflg & PCB_LYT_COPPER) && (PCB->pstk_on)) @@ -975,7 +986,7 @@ else if ((e->content.layer_id >= 0) && (e->content.layer_id < pcb_max_layer)) { pcb_gui->set_drawing_mode(PCB_HID_COMP_RESET, 1, &e->view); pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, 1, &e->view); - pcb_draw_layer(PCB, &(PCB->Data->Layer[e->content.layer_id]), &e->view); + pcb_draw_layer_noxform(PCB, &(PCB->Data->Layer[e->content.layer_id]), &e->view); pcb_gui->set_drawing_mode(PCB_HID_COMP_FLUSH, 1, &e->view); } else Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 19383) +++ trunk/src/draw.h (revision 19384) @@ -41,6 +41,16 @@ extern pcb_output_t pcb_draw_out; +/* Some low level draw callback depend on this in their void *cl */ +typedef struct pcb_draw_info_s { + const pcb_board_t *pcb; + const pcb_box_t *drawn_area; + const pcb_xform_t *xform_caller; /* the extra transformation the caller requested */ + pcb_xform_t *xform; /* the final transformation applied on objects */ + + const pcb_layer_t *layer; +} pcb_draw_info_t; + /* Temporarily inhibid drawing if this is non-zero. A function that calls a lot of other functions that would call pcb_draw() a lot in turn may increase this value before the calls, then decrease it at the end and call pcb_draw(). @@ -89,7 +99,8 @@ void pcb_draw(void); void pcb_redraw(void); void pcb_draw_obj(pcb_any_obj_t *obj); -void pcb_draw_layer(const pcb_board_t *pcb, const pcb_layer_t *ly, const pcb_box_t *screen); +void pcb_draw_layer(pcb_draw_info_t *info, const pcb_layer_t *ly); +void pcb_draw_layer_noxform(const pcb_board_t *pcb, const pcb_layer_t *ly, const pcb_box_t *screen); /* Same as pcb_draw_layer(), but never draws an implicit outline and ignores objects that are not in the subtree of data - useful for drawing a subtree, @@ -115,16 +126,7 @@ #define PCB_DRAW_BBOX(obj) #endif -/* Some low level draw callback depend on this in their void *cl */ -typedef struct pcb_draw_info_s { - const pcb_board_t *pcb; - const pcb_box_t *drawn_area; - const pcb_xform_t *xform_caller; /* the extra transformation the caller requested */ - pcb_xform_t *xform; /* the final transformation applied on objects */ - const pcb_layer_t *layer; -} pcb_draw_info_t; - /* Returns whether lay_id is part of a group that is composite-drawn */ int pcb_draw_layer_is_comp(pcb_layer_id_t lay_id); Index: trunk/src/draw_composite.c =================================================================== --- trunk/src/draw_composite.c (revision 19383) +++ trunk/src/draw_composite.c (revision 19384) @@ -138,7 +138,7 @@ pcb_draw_out.fgGC = pcb_draw_out.pmGC; if (l->comb & PCB_LYC_AUTO) draw_auto(ctx, auto_data); - pcb_draw_layer(ctx->info->pcb, l, ctx->info->drawn_area); + pcb_draw_layer(ctx->info, l); pcb_draw_out.fgGC = old_fg; } } Index: trunk/src/draw_ly_spec.c =================================================================== --- trunk/src/draw_ly_spec.c (revision 19383) +++ trunk/src/draw_ly_spec.c (revision 19384) @@ -154,7 +154,7 @@ /* fallback: implicit layer -> original code: draw auto+manual */ 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); - pcb_draw_layer(info->pcb, LAYER_PTR(lid), info->drawn_area); + pcb_draw_layer(info, LAYER_PTR(lid)); pcb_draw_silk_auto(&cctx, &lyt_side); pcb_gui->set_drawing_mode(PCB_HID_COMP_FLUSH, pcb_draw_out.direct, info->drawn_area); } @@ -238,7 +238,7 @@ pcb_gui->set_drawing_mode(PCB_HID_COMP_POSITIVE, pcb_draw_out.direct, info->drawn_area); for(n = 0; n < g->len; n++) { pcb_layer_t *ly = LAYER_PTR(g->lid[n]); - pcb_draw_layer(info->pcb, ly, info->drawn_area); + pcb_draw_layer(info, ly); } pcb_gui->set_drawing_mode(PCB_HID_COMP_FLUSH, pcb_draw_out.direct, info->drawn_area); } Index: trunk/src_plugins/lib_gtk_common/dlg_propedit.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_propedit.c (revision 19383) +++ trunk/src_plugins/lib_gtk_common/dlg_propedit.c (revision 19384) @@ -385,7 +385,7 @@ #warning TODO: do not reimplement draw.c code here: old_pcb = PCB; PCB = &preview_pcb; -/* pcb_draw_layer(&(PCB->Data->Layer[0]), &e->view, NULL); +/* pcb_draw_layer_noxform(PCB, &(PCB->Data->Layer[0]), &e->view); pcb_draw_ppv(0, &e->view);*/ PCB = old_pcb; }