/*
* 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.
*/
#import <stdlib.h>
#import "sun_java2d_opengl_CGLSurfaceData.h"
#import "jni.h"
#import "jni_util.h"
#import "OGLRenderQueue.h"
#import "CGLGraphicsConfig.h"
#import "CGLSurfaceData.h"
#import "CGLLayer.h"
#import "ThreadUtilities.h"
/* JDK's glext.h is already included and will prevent the Apple glext.h
* being included, so define the externs directly
*/
/**
* The methods in this file implement the native windowing system specific
* layer (CGL) for the OpenGL-based Java 2D pipeline.
*/
// TODO: hack that's called from OGLRenderQueue to test out unlockFocus behavior
#if 0
void
{
}
}
/**
* Makes the given context current to its associated "scratch" surface. If
* the operation is successful, this method will return JNI_TRUE; otherwise,
* returns JNI_FALSE.
*/
static jboolean
{
"CGLSD_MakeCurrentToScratch: context is null");
return JNI_FALSE;
}
#else
cubeMapFace: 0
mipMapLevel: 0
return JNI_TRUE;
}
/**
* This function disposes of any native windowing system resources associated
* with this surface. For instance, if the given OGLSDOps is of type
* OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer
* surface.
*/
void
{
}
}
// detach the NSView from the NSOpenGLContext
}
}
/**
* Returns a pointer (as a jlong) to the native CGLGraphicsConfigInfo
* associated with the given OGLSDOps. This method can be called from
* shared code to retrieve the native GraphicsConfig data in a platform-
* independent manner.
*/
{
return 0L;
}
return 0L;
}
}
/**
* Makes the given GraphicsConfig's context current to its associated
* "scratch" surface. If there is a problem making the context current,
* this method will return NULL; otherwise, returns a pointer to the
* OGLContext that is associated with the given GraphicsConfig.
*/
{
return NULL;
}
// avoid changing the context's target view whenever possible, since
// calling setView causes flickering; as long as our context is current
// to some view, it's not necessary to switch to the scratch surface
// it seems to be necessary to explicitly flush between context changes
if (currentContext != NULL) {
j2d_glFlush();
}
return NULL;
}
// make sure our context is current
}
// the GL_EXT_framebuffer_object extension is present, so this call
// will ensure that we are bound to the scratch surface (and not
// some other framebuffer object)
}
return oglc;
}
/**
* Makes a context current to the given source and destination
* surfaces. If there is a problem making the context current, this method
* will return NULL; otherwise, returns a pointer to the OGLContext that is
* associated with the destination surface.
*/
{
J2dTraceLn4(J2D_TRACE_VERBOSE, " src: %d %p dst: %d %p", srcOps->drawableType, srcOps, dstOps->drawableType, dstOps);
return NULL;
}
// it seems to be necessary to explicitly flush between context changes
if (currentContext != NULL) {
j2d_glFlush();
}
// first make sure we have a current context (if the context isn't
// already current to some drawable, we will make it current to
// its scratch surface)
if (oglc != currentContext) {
return NULL;
}
}
// now bind to the fbobject associated with the destination surface;
// this means that all rendering will go into the fbobject destination
// (note that we unbind the currently bound texture first; this is
// recommended procedure when binding an fbobject)
return oglc;
}
// set the current surface
// REMIND: pbuffers are not fully tested yet...
cubeMapFace: 0
mipMapLevel: 0
} else {
}
}
// the GL_EXT_framebuffer_object extension is present, so we
// must bind to the default (windowing system provided)
// framebuffer
}
// bind pbuffer to the render texture object (since we are preparing
// to copy from the pbuffer)
}
return oglc;
}
/**
* This function initializes a native window surface and caches the window
* bounds in the given OGLSDOps. Returns JNI_TRUE if the operation was
* successful; JNI_FALSE otherwise.
*/
{
return JNI_FALSE;
}
return JNI_FALSE;
}
if (v == NULL) {
return JNI_FALSE;
}
return JNI_TRUE;
}
void
{
}
void
{
/* If there's a remote layer (being used for testing)
* then we want to have that also receive the texture.
* First sync. up its dimensions with that of the layer
* we have attached to the local window and tell it that
* it also needs to copy the texture.
*/
}
#endif /* REMOTELAYER */
}];
}
}
}
{
return;
}
}
}
{
}
{
J2dTraceLn3(J2D_TRACE_INFO, "CGLSurfaceData_initPbuffer: w=%d h=%d opq=%d", width, height, isOpaque);
return JNI_FALSE;
}
return JNI_FALSE;
}
return JNI_FALSE;
}
// find the maximum allowable texture dimensions (this value ultimately
// determines our maximum pbuffer size)
int pbMax = 0;
int pbWidth = 0;
int pbHeight = 0;
// use non-power-of-two dimensions directly
} else {
// find the appropriate power-of-two dimensions
}
J2dTraceLn3(J2D_TRACE_VERBOSE, " desired pbuffer dimensions: w=%d h=%d max=%d", pbWidth, pbHeight, pbMax);
// requested dimensions
return JNI_FALSE;
}
return JNI_FALSE;
}
// make sure the actual dimensions match those that we requested
J2dRlsTraceLn2(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: actual (w=%d h=%d) != requested", actualWidth, actualHeight);
return JNI_FALSE;
}
return JNI_TRUE;
}
// Must be called on the QFT...
{
// we have to explicitly tell the NSOpenGLContext that its target
// drawable has changed size
}
}