/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
implements OGLGraphicsConfig, TextureSizeConstraining
{
//private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
protected static boolean cglAvailable;
private int pixfmt;
private long pConfigInfo;
private final int cachedMaxTextureSize;
private static native boolean initCGL();
int swapInterval);
private static native int _getMaxTextureSize();
static {
cglAvailable = initCGL();
}
{
super(device);
this.pConfigInfo = configInfo;
// add a record to the Disposer so that we destroy the native
// CGLGraphicsConfigInfo data when this object goes away
new CGLGCDisposerRecord(pConfigInfo));
// 7200762: Workaround a deadlock by caching the value
// A fix for JDK 8 will remove the workaround
this.cachedMaxTextureSize = _getMaxTextureSize();
}
return this;
}
return CGLSurfaceData.createData(this, w, h,
null,
}
int pixfmt)
{
if (!cglAvailable) {
return null;
}
long cfginfo = 0;
try {
// getCGLConfigInfo() creates and destroys temporary
// Java-level context and flush the queue...
if (cfginfo != 0L) {
public void run() {
}
});
}
} finally {
}
if (cfginfo == 0) {
return null;
}
}
public static boolean isCGLAvailable() {
return cglAvailable;
}
/**
* Returns true if the provided capability bit is present for this config.
* See OGLContext.java for a list of supported capabilities.
*/
}
public final long getNativeConfigInfo() {
return pConfigInfo;
}
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.BufferedContextProvider#getContext
*/
return context;
}
null);
}
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
case Transparency.BITMASK:
case Transparency.TRANSLUCENT:
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
public boolean isDoubleBuffered() {
return isCapPresent(CAPS_DOUBLEBUFFERED);
}
private long pCfgInfo;
}
public void dispose() {
if (pCfgInfo != 0) {
pCfgInfo = 0;
}
}
}
// TODO: CGraphicsConfig doesn't implement displayChanged() yet
//@Override
public synchronized void displayChanged() {
//super.displayChanged();
// the context could hold a reference to a CGLSurfaceData, which in
// turn has a reference back to this CGLGraphicsConfig, so in order
// for this instance to be disposed we need to break the connection
try {
} finally {
}
}
}
/**
* The following methods are invoked from ComponentModel.java rather
* than having the Mac OS X-dependent implementations hardcoded in that
* class. This way the appropriate actions are taken based on the peer's
* GraphicsConfig, whether it is a CGraphicsConfig or a
* CGLGraphicsConfig.
*/
/**
* Creates a new SurfaceData that will be associated with the given
* LWWindowPeer.
*/
}
/**
* Creates a new SurfaceData that will be associated with the given
* CGLLayer.
*/
}
/**
* Creates a new hidden-acceleration image of the given width and height
* that is associated with the target Component.
*/
{
}
/**
* The following methods correspond to the multibuffering methods in
* CWindowPeer.java...
*/
/**
* Attempts to create a OGL-based backbuffer for the given peer. If
* the requested configuration is not natively supported, an AWTException
* is thrown. Otherwise, if the backbuffer creation is successful, a
* value of 1 is returned.
*/
throws AWTException
{
if (numBuffers > 2) {
throw new AWTException(
"Only double or single buffering is supported");
}
if (!configCaps.isPageFlipping()) {
throw new AWTException("Page flipping is not supported");
}
throw new AWTException("FlipContents.PRIOR is not supported");
}
// non-zero return value means backbuffer creation was successful
// (checked in CPlatformWindow.flip(), etc.)
return 1;
}
/**
* Destroys the backbuffer object represented by the given handle value.
*/
}
/**
* Creates a VolatileImage that essentially wraps the target Component's
* backbuffer (the provided backbuffer handle is essentially ignored).
*/
long backBuffer)
{
return new SunVolatileImage(target,
}
/**
* Performs the native OGL flip operation for the given target Component.
*/
{
if (sd instanceof CGLVSyncOffScreenSurfaceData) {
try {
} finally {
}
} else {
return;
}
// not supported by CGL...
return;
}
try {
xBackBuffer.getHeight());
} finally {
g.dispose();
}
}
}
}
}
if (bufferCaps == null) {
}
return bufferCaps;
}
private CGLImageCaps() {
super(true);
}
public boolean isTrueVolatile() {
return true;
}
}
return imageCaps;
}
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
*/
public VolatileImage
int transparency, int type)
{
{
return null;
}
if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
return null;
}
return null;
}
}
transparency, type);
if (!(sd instanceof AccelSurface) ||
{
}
return vi;
}
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
*/
return oglCaps;
}
}
}
private static void updateTotalDisplayBounds() {
synchronized (totalDisplayBounds) {
}
}
}
}
// 7160609: GL still fails to create a square texture of this size,
// so we use this value to cap the total display bounds.
private int getMaxTextureSize() {
return cachedMaxTextureSize;
}
public int getMaxTextureWidth() {
//Temporary disable this logic and use some magic constrain.
/*
int width;
synchronized (totalDisplayBounds) {
if (totalDisplayBounds.width == 0) {
updateTotalDisplayBounds();
}
width = totalDisplayBounds.width;
}
return Math.min(width, getMaxTextureSize());
*/
}
public int getMaxTextureHeight() {
//Temporary disable this logic and use some magic constrain.
/*
int height;
synchronized (totalDisplayBounds) {
if (totalDisplayBounds.height == 0) {
updateTotalDisplayBounds();
}
height = totalDisplayBounds.height;
}
return Math.min(height, getMaxTextureSize());
*/
}
}