diff options
author | Sven Gothel <[email protected]> | 2014-05-22 07:09:23 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-22 07:09:23 +0200 |
commit | fb57c652fee6be133990cd7afbbd2fdfc084afaa (patch) | |
tree | 7993fe001b291eb83519bf02f34639502f2afb22 /src/nativewindow/classes/javax/media | |
parent | f9a00b91dcd146c72a50237b62270f33bd0da98e (diff) |
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
Diffstat (limited to 'src/nativewindow/classes/javax/media')
3 files changed, 52 insertions, 15 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java index d5cc048a1..f8596bc74 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java @@ -181,7 +181,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * Returns the width of the client area excluding insets (window decorations) in pixel units. * @return width of the client area in pixel units * @see NativeWindow#getWindowWidth() - * @see #getWindowUnitXY(int[], int[]) + * @see #convertToWindowUnits(int[]) */ public int getSurfaceWidth(); @@ -189,25 +189,25 @@ public interface NativeSurface extends SurfaceUpdatedListener { * Returns the height of the client area excluding insets (window decorations) in pixel units. * @return height of the client area in pixel units * @see NativeWindow#getWindowHeight() - * @see #getWindowUnitXY(int[], int[]) + * @see #convertToWindowUnits(int[]) */ public int getSurfaceHeight(); /** - * Converts the given pixel units into window units. - * @param result int[2] storage for the result, may be equal to pixelUnitXY (in-place) - * @param pixelUnitXY int[2] x- and y-coord values in pixel units - * @return result int[2] storage for chaining holding the converted values + * Converts the given pixel units into window units <i>in place</i>. + * @param pixelUnitsAndResult int[2] storage holding the pixel units for the x- and y-coord to convert + * and the resulting values. + * @return result int[2] storage pixelUnitsAndResult for chaining holding the converted values */ - public int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY); + public int[] convertToWindowUnits(final int[] pixelUnitsAndResult); /** - * Converts the given window units into pixel units. - * @param result int[2] storage for the result, may be equal to windowUnitXY (in-place) - * @param windowUnitXY int[2] x- and y-coord values in window units - * @return result int[2] storage for chaining holding the converted values + * Converts the given window units into pixel units <i>in place</i>. + * @param windowUnitsAndResult int[2] storage holding the window units for the x- and y-coord to convert + * and the resulting values. + * @return result int[2] storage windowUnitsAndResult for chaining holding the converted values */ - public int[] getPixelUnitXY(int[] result, final int[] windowUnitXY); + public int[] convertToPixelUnits(final int[] windowUnitsAndResult); /** * Returns the graphics configuration corresponding to this window. diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java index 39e316856..1a13b050a 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java +++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java @@ -39,14 +39,19 @@ public interface UpstreamSurfaceHook { public void destroy(ProxySurface s); /** Returns the width of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ - public int getPixelWidth(ProxySurface s); + public int getSurfaceWidth(ProxySurface s); /** Returns the height of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ - public int getPixelHeight(ProxySurface s); + public int getSurfaceHeight(ProxySurface s); /** * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize. */ public interface MutableSize extends UpstreamSurfaceHook { - public void setPixelSize(int width, int height); + /** + * Resizes the upstream surface. + * @param width new width in pixel units + * @param height new height in pixel units + */ + public void setSurfaceSize(int width, int height); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java index 331c1388e..e544118d0 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java @@ -106,22 +106,54 @@ public class Point implements Cloneable, PointImmutable { public final void setX(int x) { this.x = x; } public final void setY(int y) { this.y = y; } + /** + * Translate this instance's x- and y-components, + * i.e. add the values of the given delta point to them. + * @param pd delta point + * @return this instance for scaling + */ public final Point translate(Point pd) { x += pd.x ; y += pd.y ; return this; } + /** + * Translate this instance's x- and y-components, + * i.e. add the given deltas to them. + * @param dx delta for x + * @param dy delta for y + * @return this instance for scaling + */ public final Point translate(int dx, int dy) { x += dx ; y += dy ; return this; } + /** + * Scale this instance's x- and y-components, + * i.e. multiply them by the given scale factors. + * @param sx scale factor for x + * @param sy scale factor for y + * @return this instance for scaling + */ public final Point scale(int sx, int sy) { x *= sx ; y *= sy ; return this; } + /** + * Inverse scale this instance's x- and y-components, + * i.e. divide them by the given scale factors. + * @param sx inverse scale factor for x + * @param sy inverse scale factor for y + * @return this instance for scaling + */ + public final Point scaleInv(int sx, int sy) { + x /= sx ; + y /= sy ; + return this; + } } |