Mac OS X: Implemented gamma

This commit is contained in:
Elias Naur 2004-11-16 14:08:31 +00:00
parent 45607a7c69
commit cea73a6b85
2 changed files with 17 additions and 4 deletions

View File

@ -64,6 +64,8 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
final class MacOSXDisplay implements DisplayImplementation {
private final static int GAMMA_LENGTH = 256;
private MacOSXFrame frame;
private MouseEventQueue mouse_queue;
private KeyboardEventQueue keyboard_queue;
@ -103,12 +105,10 @@ final class MacOSXDisplay implements DisplayImplementation {
}
public int getGammaRampLength() {
return 0;
return GAMMA_LENGTH;
}
public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException {
throw new LWJGLException("Gamma not supported");
}
public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException;
public String getAdapter() {
return null;
@ -137,7 +137,10 @@ final class MacOSXDisplay implements DisplayImplementation {
if (MacOSXFrame.getDevice().getFullScreenWindow() != null)
MacOSXFrame.getDevice().setFullScreenWindow(null);
requested_mode = null;
restoreGamma();
}
private native void restoreGamma();
private DisplayMode createLWJGLDisplayMode(java.awt.DisplayMode awt_mode) {
int bit_depth;

View File

@ -162,6 +162,16 @@ static void setView(JNIEnv *env, jobject canvas) {
awt.FreeDrawingSurface(ds);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) {
CGDisplayRestoreColorSyncSettings();
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setGammaRamp(JNIEnv *env, jobject this, jobject gamma_buffer) {
const CGGammaValue *values = (*env)->GetDirectBufferAddress(env, gamma_buffer);
CGTableCount table_size = (*env)->GetDirectBufferCapacity(env, gamma_buffer);
CGSetDisplayTransferByTable(kCGDirectMainDisplay, table_size, values, values, values);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_hideUI(JNIEnv *env, jobject this, jboolean hide) {
if (hide == JNI_TRUE) {
SetSystemUIMode(kUIModeContentSuppressed, 0);