src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
Print this page
*** 190,205 ****
* 2D pipeline).
*/
JNIEXPORT jlong JNICALL
Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
(JNIEnv *env, jclass cglgc,
! jint screennum, jint pixfmt, jint swapInterval)
{
jlong ret = 0L;
JNF_COCOA_ENTER(env);
NSMutableArray * retArray = [NSMutableArray arrayWithCapacity:3];
! [retArray addObject: [NSNumber numberWithInt: (int)screennum]];
[retArray addObject: [NSNumber numberWithInt: (int)pixfmt]];
[retArray addObject: [NSNumber numberWithInt: (int)swapInterval]];
if ([NSThread isMainThread]) {
[GraphicsConfigUtil _getCGLConfigInfo: retArray];
} else {
--- 190,205 ----
* 2D pipeline).
*/
JNIEXPORT jlong JNICALL
Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
(JNIEnv *env, jclass cglgc,
! jint displayID, jint pixfmt, jint swapInterval)
{
jlong ret = 0L;
JNF_COCOA_ENTER(env);
NSMutableArray * retArray = [NSMutableArray arrayWithCapacity:3];
! [retArray addObject: [NSNumber numberWithInt: (int)displayID]];
[retArray addObject: [NSNumber numberWithInt: (int)pixfmt]];
[retArray addObject: [NSNumber numberWithInt: (int)swapInterval]];
if ([NSThread isMainThread]) {
[GraphicsConfigUtil _getCGLConfigInfo: retArray];
} else {
*** 215,225 ****
@implementation GraphicsConfigUtil
+ (void) _getCGLConfigInfo: (NSMutableArray *)argValue {
AWT_ASSERT_APPKIT_THREAD;
! jint screennum = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue];
jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue];
jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue];
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
[argValue removeAllObjects];
--- 215,225 ----
@implementation GraphicsConfigUtil
+ (void) _getCGLConfigInfo: (NSMutableArray *)argValue {
AWT_ASSERT_APPKIT_THREAD;
! jint displayID = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue];
jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue];
jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue];
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
[argValue removeAllObjects];
*** 228,247 ****
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt;
if (sharedContext == NULL) {
if (glMask == 0) {
! CGDirectDisplayID id =
! FindCGDirectDisplayIDForScreenIndex(screennum);
! glMask = CGDisplayIDToOpenGLDisplayMask(id);
}
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFAClosestPolicy,
- NSOpenGLPFANoRecovery,
- NSOpenGLPFAAccelerated,
- NSOpenGLPFAFullScreen,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorSize, 32,
NSOpenGLPFAAlphaSize, 8,
--- 228,242 ----
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt;
if (sharedContext == NULL) {
if (glMask == 0) {
! glMask = CGDisplayIDToOpenGLDisplayMask(displayID);
}
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFAClosestPolicy,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorSize, 32,
NSOpenGLPFAAlphaSize, 8,
*** 410,440 ****
free(ctxinfo);
[argValue addObject: [NSNumber numberWithLong: 0L]];
return;
}
memset(cglinfo, 0, sizeof(CGLGraphicsConfigInfo));
! cglinfo->screen = screennum;
cglinfo->pixfmt = sharedPixelFormat;
cglinfo->context = oglc;
[NSOpenGLContext clearCurrentContext];
[argValue addObject: [NSNumber numberWithLong:ptr_to_jlong(cglinfo)]];
[pool drain];
}
@end //GraphicsConfigUtil
-
- JNIEXPORT jint JNICALL
- Java_sun_java2d_opengl_CGLGraphicsConfig_getDefaultPixFmt
- (JNIEnv *env, jclass cglgc, jint screennum)
- {
- J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getDefaultPixFmt");
-
- CGDirectDisplayID id = FindCGDirectDisplayIDForScreenIndex(screennum);
- return (jint)CGDisplayIDToOpenGLDisplayMask(id);
- }
-
JNIEXPORT jint JNICALL
Java_sun_java2d_opengl_CGLGraphicsConfig_getOGLCapabilities
(JNIEnv *env, jclass cglgc, jlong configInfo)
{
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getOGLCapabilities");
--- 405,424 ----
free(ctxinfo);
[argValue addObject: [NSNumber numberWithLong: 0L]];
return;
}
memset(cglinfo, 0, sizeof(CGLGraphicsConfigInfo));
! cglinfo->screen = displayID;
cglinfo->pixfmt = sharedPixelFormat;
cglinfo->context = oglc;
[NSOpenGLContext clearCurrentContext];
[argValue addObject: [NSNumber numberWithLong:ptr_to_jlong(cglinfo)]];
[pool drain];
}
@end //GraphicsConfigUtil
JNIEXPORT jint JNICALL
Java_sun_java2d_opengl_CGLGraphicsConfig_getOGLCapabilities
(JNIEnv *env, jclass cglgc, jlong configInfo)
{
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getOGLCapabilities");