From 61e6325eed2337d791479ddcd2eb8da928b4f94c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 21 Oct 2010 20:51:50 +0200 Subject: Make ScreenMode public, ie move from newt.impl to newt. --- .../test/junit/newt/TestScreenMode01NEWT.java | 2 +- .../test/junit/newt/TestScreenMode02NEWT.java | 2 +- src/newt/classes/com/jogamp/newt/Screen.java | 3 +- src/newt/classes/com/jogamp/newt/ScreenMode.java | 76 ++++++++++++++++++++++ .../classes/com/jogamp/newt/impl/ScreenImpl.java | 1 + .../classes/com/jogamp/newt/impl/ScreenMode.java | 76 ---------------------- .../com/jogamp/newt/impl/ScreenModeStatus.java | 2 + .../jogamp/newt/impl/windows/WindowsScreen.java | 2 +- .../com/jogamp/newt/impl/x11/X11Screen.java | 2 +- 9 files changed, 84 insertions(+), 82 deletions(-) create mode 100644 src/newt/classes/com/jogamp/newt/ScreenMode.java delete mode 100644 src/newt/classes/com/jogamp/newt/impl/ScreenMode.java (limited to 'src') diff --git a/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java index a3da32bd3..ec6414402 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java @@ -41,7 +41,7 @@ import com.jogamp.newt.Display; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.Window; -import com.jogamp.newt.impl.ScreenMode; +import com.jogamp.newt.ScreenMode; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears; import com.jogamp.test.junit.util.UITestCase; diff --git a/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java index 4d6c40016..c46820ffd 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java @@ -42,7 +42,7 @@ import com.jogamp.newt.Display; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.Window; -import com.jogamp.newt.impl.ScreenMode; +import com.jogamp.newt.ScreenMode; import com.jogamp.test.junit.util.UITestCase; public class TestScreenMode02NEWT extends UITestCase { diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index ab4b9f0b4..b57e34091 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -29,11 +29,10 @@ package com.jogamp.newt; import com.jogamp.newt.impl.Debug; -import com.jogamp.newt.impl.ScreenMode; import javax.media.nativewindow.AbstractGraphicsScreen; public interface Screen { - public static final boolean DEBUG = Debug.debug("Display"); + public static final boolean DEBUG = Debug.debug("Screen"); boolean isNativeValid(); diff --git a/src/newt/classes/com/jogamp/newt/ScreenMode.java b/src/newt/classes/com/jogamp/newt/ScreenMode.java new file mode 100644 index 000000000..f37652a23 --- /dev/null +++ b/src/newt/classes/com/jogamp/newt/ScreenMode.java @@ -0,0 +1,76 @@ +package com.jogamp.newt; + +public class ScreenMode { + public static final int ROTATE_0 = 0; + public static final int ROTATE_90 = 90; + public static final int ROTATE_180 = 180; + public static final int ROTATE_270 = 270; + + private int index; + private int width; + private int height; + private int bitsPerPixel = -1; + + private short[] rates = null; + + public ScreenMode(int index, int width, int height) { + this.index = index; + this.width = width; + this.height = height; + } + /** Not safe to use this on platforms + * other than windows. Since the mode ids + * on X11 match the native ids. unlike windows + * where the ids are generated . + * @param index + */ + public void setIndex(int index) { + this.index = index; + } + public int getIndex() { + return index; + } + public int getWidth() { + return width; + } + public void setWidth(int width) { + this.width = width; + } + public int getHeight() { + return height; + } + public void setHeight(int height) { + this.height = height; + } + public short[] getRates() { + return rates; + } + public void setRates(short[] rates) { + this.rates = rates; + } + + public int getBitsPerPixel() { + return bitsPerPixel; + } + + public void setBitsPerPixel(int bitsPerPixel) { + this.bitsPerPixel = bitsPerPixel; + } + + public short getHighestAvailableRate(){ + short highest = rates[0]; + if(rates.length > 1){ + for (int i = 1; i < rates.length; i++) { + if(rates[i] > highest){ + highest = rates[i]; + } + } + } + return highest; + } + + public String toString() { + return "ScreenMode: " + this.index + " - " + this.width + " x " + + this.height + " " + getHighestAvailableRate() + " Hz"; + } +} diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java index 4535213da..37a751fe1 100644 --- a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java @@ -34,6 +34,7 @@ package com.jogamp.newt.impl; +import com.jogamp.newt.ScreenMode; import com.jogamp.newt.*; import javax.media.nativewindow.*; diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenMode.java b/src/newt/classes/com/jogamp/newt/impl/ScreenMode.java deleted file mode 100644 index 2b61d34c4..000000000 --- a/src/newt/classes/com/jogamp/newt/impl/ScreenMode.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.jogamp.newt.impl; - -public class ScreenMode { - public static final int ROTATE_0 = 0; - public static final int ROTATE_90 = 90; - public static final int ROTATE_180 = 180; - public static final int ROTATE_270 = 270; - - private int index; - private int width; - private int height; - private int bitsPerPixel = -1; - - private short[] rates = null; - - public ScreenMode(int index, int width, int height) { - this.index = index; - this.width = width; - this.height = height; - } - /** Not safe to use this on platforms - * other than windows. Since the mode ids - * on X11 match the native ids. unlike windows - * where the ids are generated . - * @param index - */ - public void setIndex(int index) { - this.index = index; - } - public int getIndex() { - return index; - } - public int getWidth() { - return width; - } - public void setWidth(int width) { - this.width = width; - } - public int getHeight() { - return height; - } - public void setHeight(int height) { - this.height = height; - } - public short[] getRates() { - return rates; - } - public void setRates(short[] rates) { - this.rates = rates; - } - - public int getBitsPerPixel() { - return bitsPerPixel; - } - - public void setBitsPerPixel(int bitsPerPixel) { - this.bitsPerPixel = bitsPerPixel; - } - - public short getHighestAvailableRate(){ - short highest = rates[0]; - if(rates.length > 1){ - for (int i = 1; i < rates.length; i++) { - if(rates[i] > highest){ - highest = rates[i]; - } - } - } - return highest; - } - - public String toString() { - return "ScreenMode: " + this.index + " - " + this.width + " x " - + this.height + " " + getHighestAvailableRate() + " Hz"; - } -} diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenModeStatus.java b/src/newt/classes/com/jogamp/newt/impl/ScreenModeStatus.java index 2ea77c33e..94d3eb4e6 100644 --- a/src/newt/classes/com/jogamp/newt/impl/ScreenModeStatus.java +++ b/src/newt/classes/com/jogamp/newt/impl/ScreenModeStatus.java @@ -1,5 +1,7 @@ package com.jogamp.newt.impl; +import com.jogamp.newt.ScreenMode; + public class ScreenModeStatus { private String screenFQN = null; private ScreenMode[] screenModes = null; diff --git a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java index 3cac617ab..04ffbe11d 100644 --- a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java +++ b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java @@ -37,7 +37,7 @@ import java.util.ArrayList; import com.jogamp.newt.*; import com.jogamp.newt.impl.ScreenImpl; -import com.jogamp.newt.impl.ScreenMode; +import com.jogamp.newt.ScreenMode; import com.jogamp.newt.impl.ScreenModeStatus; import javax.media.nativewindow.*; diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java index f01ffdea4..52c80bbe9 100644 --- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java +++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java @@ -34,7 +34,7 @@ package com.jogamp.newt.impl.x11; import com.jogamp.newt.impl.ScreenImpl; -import com.jogamp.newt.impl.ScreenMode; +import com.jogamp.newt.ScreenMode; import com.jogamp.newt.impl.ScreenModeStatus; import javax.media.nativewindow.x11.*; -- cgit v1.2.3