From b831ebadcaea1eea7370f7ec0bffc59eaba7a5ba Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 16 Oct 2013 14:28:27 +0200 Subject: Add efficient set(..all..) to Dimension, Insets, Point and Rectangle of NativeWindow's util types. --- src/newt/classes/com/jogamp/newt/MonitorDevice.java | 5 +---- src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 3 +-- src/newt/classes/jogamp/newt/OffscreenWindow.java | 3 +-- src/newt/classes/jogamp/newt/ScreenImpl.java | 5 +---- src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java | 7 ++----- src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java | 5 +---- src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java | 5 +---- src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java | 5 +---- src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java | 5 +---- src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java | 5 +---- src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java | 5 +---- 11 files changed, 12 insertions(+), 41 deletions(-) (limited to 'src/newt') diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index 8bc7f40e3..42ac34240 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -183,10 +183,7 @@ public abstract class MonitorDevice { y1 = Math.min(y1, vp.getY()); y2 = Math.max(y2, vp.getY() + vp.getHeight()); } - result.setX(x1); - result.setY(y1); - result.setWidth(x2 - x1); - result.setHeight(y2 - y1); + result.set(x1, y1, x2 - x1, y2 - y1); return result; } diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 2fa83e0e2..a2135273b 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -497,8 +497,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { if( isOSX ) { final Point los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0); // top-level position -> client window position - los.setX(los.getX() + insets.getLeftWidth()); - los.setY(los.getY() + insets.getTopHeight()); + los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight()); if(null!=point) { return point.translate(los); } else { diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java index 911d371d5..0a302d76b 100644 --- a/src/newt/classes/jogamp/newt/OffscreenWindow.java +++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java @@ -132,8 +132,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { @Override public Point getLocationOnScreen(Point storage) { if(null!=storage) { - storage.setX(0); - storage.setY(0); + storage.set(0, 0); return storage; } return new Point(0,0); diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 5ffa2ebbf..7068d7464 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -285,10 +285,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { */ protected void updateVirtualScreenOriginAndSize() { if(null != usrSize ) { - vOriginSize.setX(0); - vOriginSize.setY(0); - vOriginSize.setWidth(usrSize.getWidth()); - vOriginSize.setHeight(usrSize.getHeight()); + vOriginSize.set(0, 0, usrSize.getWidth(), usrSize.getHeight()); if(DEBUG) { System.err.println("Update user virtual screen viewport @ "+Thread.currentThread().getName()+": "+vOriginSize); } diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index c45a5ae3b..77daa556f 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java @@ -177,11 +177,8 @@ public class WindowDriver extends WindowImpl { } protected void updateInsetsImpl(javax.media.nativewindow.util.Insets insets) { - Insets contInsets = awtContainer.getInsets(); - insets.setLeftWidth(contInsets.left); - insets.setRightWidth(contInsets.right); - insets.setTopHeight(contInsets.top); - insets.setBottomHeight(contInsets.bottom); + final Insets contInsets = awtContainer.getInsets(); + insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom); } private void setCanvasSizeImpl(int width, int height) { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index afaedffe3..abe2908b0 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -101,10 +101,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { - vOriginSize.setX(0); - vOriginSize.setY(0); - vOriginSize.setWidth(fixedWidth); // FIXME - vOriginSize.setHeight(fixedHeight); // FIXME + vOriginSize.set(0, 0, fixedWidth, fixedHeight); // FIXME } //---------------------------------------------------------------------- diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index f7973def8..be99052d7 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java @@ -95,10 +95,7 @@ public class ScreenDriver extends ScreenImpl { @Override protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { - vOriginSize.setX(0); - vOriginSize.setY(0); - vOriginSize.setWidth(cachedWidth); - vOriginSize.setHeight(cachedHeight); + vOriginSize.set(0, 0, cachedWidth, cachedHeight); } /** Called from {@link #initNative()}. */ diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index 4c47eb0d8..27b776562 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -103,10 +103,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { - vOriginSize.setX(0); - vOriginSize.setY(0); - vOriginSize.setWidth(cachedWidth); - vOriginSize.setHeight(cachedHeight); + vOriginSize.set(0, 0, cachedWidth, cachedHeight); } //---------------------------------------------------------------------- diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index dc87c3c08..f893275ca 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -99,10 +99,7 @@ public class ScreenDriver extends ScreenImpl { } protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { - vOriginSize.setX(0); - vOriginSize.setY(0); - vOriginSize.setWidth(cachedWidth); - vOriginSize.setHeight(cachedHeight); + vOriginSize.set(0, 0, cachedWidth, cachedHeight); } protected void sizeChanged(int w, int h) { diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java index 342829691..621091320 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java @@ -155,10 +155,7 @@ public class ScreenDriver extends ScreenImpl { @Override protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { - vOriginSize.setX(getVirtualOriginX0()); - vOriginSize.setY(getVirtualOriginY0()); - vOriginSize.setWidth(getVirtualWidthImpl0()); - vOriginSize.setHeight(getVirtualHeightImpl0()); + vOriginSize.set(getVirtualOriginX0(), getVirtualOriginY0(), getVirtualWidthImpl0(), getVirtualHeightImpl0()); } // Native calls diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java index f37556dd7..c01d899f8 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java @@ -237,10 +237,7 @@ public class ScreenDriver extends ScreenImpl { } else */ { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() { public Object run(long dpy) { - vOriginSize.setX(0); - vOriginSize.setY(0); - vOriginSize.setWidth(getWidth0(dpy, screen_idx)); - vOriginSize.setHeight(getHeight0(dpy, screen_idx)); + vOriginSize.set(0, 0, getWidth0(dpy, screen_idx), getHeight0(dpy, screen_idx)); return null; } } ); if( DEBUG ) { -- cgit v1.2.3