mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-06 06:53:59 +00:00
Linux: Don't use the SUN specific getScreenFromDevice in LinuxAWTCanvasPeerInfo. This avoids garbage creation per frame and avoids one bit of SUN JRE dependency.
This commit is contained in:
parent
dc4a31e799
commit
8698cf68f3
2 changed files with 31 additions and 26 deletions
|
|
@ -45,20 +45,25 @@ import org.lwjgl.LWJGLUtil;
|
|||
final class LinuxAWTGLCanvasPeerInfo extends LinuxPeerInfo {
|
||||
private final AWTGLCanvas canvas;
|
||||
private final AWTSurfaceLock awt_surface = new AWTSurfaceLock();
|
||||
private int screen = -1;
|
||||
|
||||
public LinuxAWTGLCanvasPeerInfo(AWTGLCanvas canvas) {
|
||||
this.canvas = canvas;
|
||||
}
|
||||
|
||||
protected void doLockAndInitHandle() throws LWJGLException {
|
||||
int screen = -1;
|
||||
try {
|
||||
screen = LinuxCanvasImplementation.getScreenFromDevice(canvas.getGraphicsConfiguration().getDevice());
|
||||
} catch (LWJGLException e) {
|
||||
LWJGLUtil.log("Got exception while trying to determine screen: " + e);
|
||||
ByteBuffer surface_handle = awt_surface.lockAndGetHandle(canvas);
|
||||
if (screen == -1) {
|
||||
try {
|
||||
screen = getScreenFromSurfaceInfo(surface_handle);
|
||||
} catch (LWJGLException e) {
|
||||
LWJGLUtil.log("Got exception while trying to determine screen: " + e);
|
||||
screen = 0;
|
||||
}
|
||||
}
|
||||
nInitHandle(screen, awt_surface.lockAndGetHandle(canvas), getHandle());
|
||||
nInitHandle(screen, surface_handle, getHandle());
|
||||
}
|
||||
private static native int getScreenFromSurfaceInfo(ByteBuffer surface_handle) throws LWJGLException;
|
||||
private static native void nInitHandle(int screen, ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException;
|
||||
|
||||
protected void doUnlock() throws LWJGLException {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue