From c89a8ac5e3b533beac0a10938e860cf3248067bc Mon Sep 17 00:00:00 2001 From: Peter Clifton Date: Sun, 4 Dec 2016 19:20:03 +0000 Subject: [PATCH] Draw pin / pad names first, so they don't get masked by the pad Since we use stencil masking to ensure we don't redraw an area multiple times, confusingly, we need to draw the text first to ensure it isn't occluded by the pad its-self. HACK: We probably draw the names multiple times - as we still use the common draw.c code which assumes it can draw labels on top of the pads. --- src/hid/gtk/gtkhid-gl.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c index 14204eba2d..b1eccd8889 100644 --- a/src/hid/gtk/gtkhid-gl.c +++ b/src/hid/gtk/gtkhid-gl.c @@ -1126,7 +1126,21 @@ draw_pin (PinType *pin, bool draw_hole) static int pin_callback (const BoxType * b, void *cl) { - draw_pin ((PinType *)b, TEST_FLAG (THINDRAWFLAG, PCB)); + PinType *pin = (PinType *) b; + + if (!TEST_FLAG (HOLEFLAG, pin) && TEST_FLAG (DISPLAYNAMEFLAG, pin)) + _draw_pv_name (pin); + draw_pin (pin, TEST_FLAG (THINDRAWFLAG, PCB)); + return 1; +} + +static int +pin_name_callback (const BoxType * b, void *cl) +{ + PinType *pin = (PinType *) b; + + if (!TEST_FLAG (HOLEFLAG, pin) && TEST_FLAG (DISPLAYNAMEFLAG, pin)) + _draw_pv_name (pin); return 1; } @@ -1236,8 +1250,11 @@ pad_callback (const BoxType * b, void *cl) PadType *pad = (PadType *) b; int *side = cl; - if (ON_SIDE (pad, *side)) + if (ON_SIDE (pad, *side)) { + if (TEST_FLAG (DISPLAYNAMEFLAG, pad)) + draw_pad_name (pad); draw_pad (pad); + } return 1; } @@ -1487,6 +1504,9 @@ GhidDrawLayerGroup (int group, const BoxType * screen) /* Draw pins, vias and pads on this layer */ if (!global_view_2d && !is_outline) { + if (PCB->PinOn && + (group == bottom_group || group == top_group)) + r_search (PCB->Data->pin_tree, screen, NULL, pin_name_callback, Layer); if (PCB->PinOn) r_search (PCB->Data->pin_tree, screen, NULL, pin_inlayer_callback, Layer); if (PCB->ViaOn) r_search (PCB->Data->via_tree, screen, NULL, via_inlayer_callback, Layer); if (PCB->PinOn && group == top_group) -- 2.11.4.GIT