From fb57c652fee6be133990cd7afbbd2fdfc084afaa Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 22 May 2014 07:09:23 +0200 Subject: Bug 742 HiDPI: [Core API Change] Distinguish window-units and pixel-units: Refine commit f9a00b91dcd146c72a50237b62270f33bd0da98e - Using comment tag 'FIXME HiDPI' to locate remaining issues - Fix remaining 'getPixel*(..)' -> 'getSurface*(..)' - UpstreamSurfaceHook - Fix usage (one by one) of - NativeWindow: getWindowWidth() / getWindowHeight() - NativeSurface/GLDrawable: getSurfaceWidth() / getSurfaceHeight() - mention window- or pixel units in API doc where required - use 'setSurfaceSize(..)' where appropriate to match 'getSurface*()' - GLFBODrawable - GLOffscreenAutoDrawable - UpstreamSurfaceHook.MutableSize - NativeWindow's Point: Add API doc and 'Point scaleInv(..)' - NativeSurface Simplify new conversion methods and use single in-place storage - 'int[] getWindowUnitXY(int[], int[])' -> 'int[] convertToWindowUnits(int[], int[])' - 'int[] getPixelUnitXY(int[], int[])' -> 'int[] convertToPixelUnits(int[], int[])' - NEWT Screen/Monitor - Assume screen/window units - TODO: Refine semantics - Monitor resolution probably is in pixel units ?! - Including the Rectangle/Monitor association etc etc - NEWT Window - Add setSurfaceSize(..) for convenience - Add 'Point convertToWindowUnits(final Point pixelUnitsAndResult)', etc .. - All window ops are using window units (size, pos, ..), but methods operating on the surface/drawable: windowRepaint(..) .. - TODO: Consider changing method names 'window*(..)' to 'surface*(..)' actually operating on surface/drawable - Window.windowRepaint(..) - GLAutoDrawableDelegate.windowResizedOp(..) (maybe all similar methods in here) - NEWT Mouse/Pointer Events - Using pixel units --- .../javax/media/opengl/GLEventListener.java | 26 +++++++++++++++------- .../classes/javax/media/opengl/GLFBODrawable.java | 8 +++---- .../media/opengl/GLOffscreenAutoDrawable.java | 10 ++++----- .../classes/javax/media/opengl/awt/GLCanvas.java | 1 - 4 files changed, 27 insertions(+), 18 deletions(-) (limited to 'src/jogl/classes/javax/media') diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/javax/media/opengl/GLEventListener.java index c8c3440b5..995ca2620 100644 --- a/src/jogl/classes/javax/media/opengl/GLEventListener.java +++ b/src/jogl/classes/javax/media/opengl/GLEventListener.java @@ -80,13 +80,23 @@ public interface GLEventListener extends EventListener { enabled. */ public void display(GLAutoDrawable drawable); - /** Called by the drawable during the first repaint after the - component has been resized. The client can update the viewport - and view volume of the window appropriately, for example by a - call to {@link javax.media.opengl.GL#glViewport}; note that for - convenience the component has already called glViewport(x, - y, width, height) when this method is called, so the - client may not have to do anything in this method. - */ + /** + * Called by the drawable during the first repaint after the + * component has been resized. + *

+ * The client can update it's viewport associated data + * and view volume of the window appropriately. + *

+ *

+ * For efficiency the GL viewport has already been updated + * via glViewport(x, y, width, height) when this method is called. + *

+ * + * @param drawable the triggering {@link GLAutoDrawable} + * @param x viewport x-coord in pixel units + * @param y viewport y-coord in pixel units + * @param width viewport width in pixel units + * @param height viewport height in pixel units + */ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height); } diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index 052b08a4b..a34fca0fa 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java @@ -179,17 +179,17 @@ public interface GLFBODrawable extends GLDrawable { /** Resizeable {@link GLFBODrawable} specialization */ public interface Resizeable extends GLFBODrawable { /** - * Resize this drawable. + * Resize this {@link GLFBODrawable}'s surface. *

* This drawable is being locked during operation. *

* @param context the {@link GLContext} bound to this drawable, will be made current during operation * A prev. current context will be make current after operation. - * @param newWidth - * @param newHeight + * @param newWidth new width in pixel units + * @param newHeight new width in pixel units * @throws NativeWindowException in case the surface could no be locked * @throws GLException in case an error during the resize operation occurred */ - void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException; + void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException; } } diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java index d34edaf2e..a69480242 100644 --- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java @@ -37,19 +37,19 @@ import com.jogamp.opengl.FBObject; * exposing offscreen functionality. *

* This class distinguishes itself from {@link GLAutoDrawable} - * with it's {@link #setSize(int, int)} functionality. + * with it's {@link #setSurfaceSize(int, int)} functionality. *

*/ public interface GLOffscreenAutoDrawable extends GLAutoDrawable, GLSharedContextSetter { /** - * Resize this auto drawable. - * @param newWidth - * @param newHeight + * Resize this {@link GLAutoDrawable}'s surface + * @param newWidth new width in pixel units + * @param newHeight new height in pixel units * @throws NativeWindowException in case the surface could no be locked * @throws GLException in case of an error during the resize operation */ - void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException; + void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException; /** * Set the upstream UI toolkit object. diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index c5ce32827..d06b61624 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -101,7 +101,6 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.util.GLDrawableUtil; import com.jogamp.opengl.util.TileRenderer; -import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableHelper; -- cgit v1.2.3