From: Daniel Kirschten Date: Thu, 6 Jun 2019 19:29:45 +0000 (+0200) Subject: Sped up rendering X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=edcba5b9956f3e88b2725adf38991a5db1a71a88;p=Mograsim.git Sped up rendering --- 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); + } } } }