X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2FLogicUIRenderer.java;fp=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2FLogicUIRenderer.java;h=5182a24a8afe03aedf0c9f9693a61b7f217d86d6;hb=fb685bde0f5e5bc79ac7af6f9690bed41f04f6f6;hp=a2be5bac221a0b7b6256e2fad6fd11d1b3e5eba4;hpb=0468e55a8b3536a33208f5e24b31985b077ba745;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUIRenderer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUIRenderer.java index a2be5bac..5182a24a 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUIRenderer.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUIRenderer.java @@ -29,14 +29,19 @@ public class LogicUIRenderer private static void renderComponent(GeneralGC gc, GUIComponent component, Rectangle visibleRegion) { - component.render(gc, visibleRegion); - if (DRAW_PINS) + Rectangle bounds = component.getBounds(); + double lw = gc.getLineWidth(); + if (visibleRegion.intersects(bounds.x - lw, bounds.y - lw, bounds.width + lw + lw, bounds.height + lw + lw)) { - gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_DARK_CYAN)); - for (Pin p : component.getPins()) + component.render(gc, visibleRegion); + if (DRAW_PINS) { - Point pos = p.getPos(); - gc.fillOval(pos.x - 1, pos.y - 1, 2, 2); + gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_DARK_CYAN)); + for (Pin p : component.getPins()) + { + Point pos = p.getPos(); + gc.fillOval(pos.x - 1, pos.y - 1, 2, 2); + } } } }