1 /*
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
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 package com.sun.prism.es2;
27
28 import java.security.AccessController;
29 import java.security.PrivilegedAction;
30
31 import com.sun.glass.utils.NativeLibLoader;
32 import com.sun.javafx.PlatformUtil;
33 import com.sun.prism.impl.PrismSettings;
34
35 class GLPixelFormat {
36 final private Attributes attributes;
37 final private long nativeScreen;
38 private long nativePFInfo;
39 private static int defaultDepthSize;
40 private static int defaultBufferSize;
41
42 static {
43 AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
44 defaultDepthSize = Integer.getInteger("prism.glDepthSize", 24);
45 defaultBufferSize = Integer.getInteger("prism.glBufferSize", 32);
46 return null;
47 });
53 }
54
55 Attributes getAttributes() {
56 return attributes;
57 }
58
59 long getNativeScreen() {
60 return nativeScreen;
61 }
62
63 void setNativePFInfo(long nativePFInfo) {
64 this.nativePFInfo = nativePFInfo;
65 }
66
67 long getNativePFInfo() {
68 return nativePFInfo;
69 }
70
71 static class Attributes {
72 // These definitions are used by both the Mac, Win and X11 subclasses
73 final static int RED_SIZE = 0;
74 final static int GREEN_SIZE = 1;
75 final static int BLUE_SIZE = 2;
76 final static int ALPHA_SIZE = 3;
77 final static int DEPTH_SIZE = 4;
78 final static int DOUBLEBUFFER = 5;
79 final static int ONSCREEN = 6;
80
81 final static int NUM_ITEMS = 7;
82
83 private boolean onScreen;
84 private boolean doubleBuffer;
85 private int alphaSize;
86 private int blueSize;
87 private int greenSize;
88 private int redSize;
89 private int depthSize;
90
91 Attributes() {
92 onScreen = true;
93 doubleBuffer = true;
94 depthSize = defaultDepthSize;
95 switch (defaultBufferSize) {
96 case 32:
97 redSize = greenSize = blueSize = alphaSize = 8;
98 break;
99 case 24:
100 redSize = greenSize = blueSize = 8;
101 alphaSize = 0;
|
1 /*
2 * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
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 package com.sun.prism.es2;
27
28 import java.lang.annotation.Native;
29 import java.security.AccessController;
30 import java.security.PrivilegedAction;
31
32 import com.sun.glass.utils.NativeLibLoader;
33 import com.sun.javafx.PlatformUtil;
34 import com.sun.prism.impl.PrismSettings;
35
36 class GLPixelFormat {
37 final private Attributes attributes;
38 final private long nativeScreen;
39 private long nativePFInfo;
40 private static int defaultDepthSize;
41 private static int defaultBufferSize;
42
43 static {
44 AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
45 defaultDepthSize = Integer.getInteger("prism.glDepthSize", 24);
46 defaultBufferSize = Integer.getInteger("prism.glBufferSize", 32);
47 return null;
48 });
54 }
55
56 Attributes getAttributes() {
57 return attributes;
58 }
59
60 long getNativeScreen() {
61 return nativeScreen;
62 }
63
64 void setNativePFInfo(long nativePFInfo) {
65 this.nativePFInfo = nativePFInfo;
66 }
67
68 long getNativePFInfo() {
69 return nativePFInfo;
70 }
71
72 static class Attributes {
73 // These definitions are used by both the Mac, Win and X11 subclasses
74 @Native final static int RED_SIZE = 0;
75 @Native final static int GREEN_SIZE = 1;
76 @Native final static int BLUE_SIZE = 2;
77 @Native final static int ALPHA_SIZE = 3;
78 @Native final static int DEPTH_SIZE = 4;
79 @Native final static int DOUBLEBUFFER = 5;
80 @Native final static int ONSCREEN = 6;
81
82 @Native final static int NUM_ITEMS = 7;
83
84 private boolean onScreen;
85 private boolean doubleBuffer;
86 private int alphaSize;
87 private int blueSize;
88 private int greenSize;
89 private int redSize;
90 private int depthSize;
91
92 Attributes() {
93 onScreen = true;
94 doubleBuffer = true;
95 depthSize = defaultDepthSize;
96 switch (defaultBufferSize) {
97 case 32:
98 redSize = greenSize = blueSize = alphaSize = 8;
99 break;
100 case 24:
101 redSize = greenSize = blueSize = 8;
102 alphaSize = 0;
|