author | serb |
Tue, 27 Aug 2019 04:43:01 -0700 | |
changeset 58315 | 07556f8cd819 |
parent 54873 | 442e683e65fa |
permissions | -rw-r--r-- |
12047 | 1 |
/* |
54873
442e683e65fa
7141393: [macosx] CARemoteLayer code refactoring and unit test
serb
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
12047 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
#ifndef CGLGraphicsConfig_h_Included |
|
27 |
#define CGLGraphicsConfig_h_Included |
|
28 |
||
29 |
#import "jni.h" |
|
30 |
#import "J2D_GL/gl.h" |
|
31 |
#import "OGLSurfaceData.h" |
|
32 |
#import "OGLContext.h" |
|
33 |
#import <Cocoa/Cocoa.h> |
|
34 |
||
35 |
@interface GraphicsConfigUtil : NSObject {} |
|
36 |
+ (void) _getCGLConfigInfo: (NSMutableArray *)argValue; |
|
37 |
@end |
|
38 |
||
39 |
// REMIND: Using an NSOpenGLPixelBuffer as the scratch surface has been |
|
40 |
// problematic thus far (seeing garbage and flickering when switching |
|
41 |
// between an NSView and the scratch surface), so the following enables |
|
42 |
// an alternate codepath that uses a hidden NSWindow/NSView as the scratch |
|
43 |
// surface, for the purposes of making a context current in certain |
|
44 |
// situations. It appears that calling [NSOpenGLContext setView] too |
|
45 |
// frequently contributes to the bad behavior, so we should try to avoid |
|
46 |
// switching to the scratch surface whenever possible. |
|
47 |
||
48 |
/* Do we need this if we are using all off-screen drawing ? */ |
|
49 |
#define USE_NSVIEW_FOR_SCRATCH 1 |
|
50 |
||
51 |
/** |
|
52 |
* The CGLGraphicsConfigInfo structure contains information specific to a |
|
53 |
* given CGLGraphicsConfig (pixel format). |
|
54 |
* |
|
55 |
* jint screen; |
|
56 |
* The screen and PixelFormat for the associated CGLGraphicsConfig. |
|
57 |
* |
|
58 |
* NSOpenGLPixelFormat *pixfmt; |
|
59 |
* The pixel format of the native NSOpenGL context. |
|
60 |
* |
|
61 |
* OGLContext *context; |
|
62 |
* The context associated with this CGLGraphicsConfig. |
|
63 |
*/ |
|
64 |
typedef struct _CGLGraphicsConfigInfo { |
|
65 |
jint screen; |
|
66 |
NSOpenGLPixelFormat *pixfmt; |
|
67 |
OGLContext *context; |
|
68 |
} CGLGraphicsConfigInfo; |
|
69 |
||
70 |
/** |
|
71 |
* The CGLCtxInfo structure contains the native CGLContext information |
|
72 |
* required by and is encapsulated by the platform-independent OGLContext |
|
73 |
* structure. |
|
74 |
* |
|
75 |
* NSOpenGLContext *context; |
|
76 |
* The core native NSOpenGL context. Rendering commands have no effect until |
|
77 |
* a context is made current (active). |
|
78 |
* |
|
79 |
* NSOpenGLPixelBuffer *scratchSurface; |
|
80 |
* The scratch surface id used to make a context current when we do |
|
81 |
* not otherwise have a reference to an OpenGL surface for the purposes of |
|
82 |
* making a context current. |
|
83 |
*/ |
|
84 |
typedef struct _CGLCtxInfo { |
|
85 |
NSOpenGLContext *context; |
|
86 |
#if USE_NSVIEW_FOR_SCRATCH |
|
87 |
NSView *scratchSurface; |
|
88 |
#else |
|
89 |
NSOpenGLPixelBuffer *scratchSurface; |
|
90 |
#endif |
|
91 |
} CGLCtxInfo; |
|
92 |
||
93 |
#endif /* CGLGraphicsConfig_h_Included */ |