From 97de7b52b8c0ca7f1afff394321a15e7f3df293d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 31 Jan 2023 22:39:47 +0100 Subject: NEWT Screen: Cleanup get*Monitor*() methods --- src/newt/classes/com/jogamp/newt/Screen.java | 40 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index 7f6ffeb13..d670c0d83 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -228,9 +228,7 @@ public abstract class Screen { MonitorDevice res = null; float maxCoverage = Float.MIN_VALUE; final List monitors = getMonitorDevices(); - final int monitorCount = monitors.size(); - for(int i=0; i maxCoverage ) { @@ -245,11 +243,17 @@ public abstract class Screen { return monitors.get(0); } + /** + * Returns the {@link MonitorDevice} which completely which {@link MonitorDevice#getViewportInWindowUnits() viewport} + * completely {@link RectangleImmutable#contains(RectangleImmutable) coverage} the given rectangle in window units, + * which is not a {@link MonitorDevice#isClone() clone}. + *

+ * If no match is found, null is being returned + *

+ * @param r arbitrary rectangle in window units + */ public final MonitorDevice getFullyEnteredMonitor(final RectangleImmutable r) { - final List monitors = getMonitorDevices(); - final int monitorCount = monitors.size(); - for(int i=0; i + * If no match is found, null is being returned + *

+ */ public final MonitorDevice getMonitorById(final int monitorId) { - final List monitors = getMonitorDevices(); - final int monitorCount = monitors.size(); - for(int i=0; i + * If no match is found, null is being returned + *

+ */ public final MonitorDevice getMonitorByHandle(final long monitorHandle) { - final List monitors = getMonitorDevices(); - final int monitorCount = monitors.size(); - for(int i=0; i