2008-08-19 12:46:03 -04:00
|
|
|
/*
|
2008-04-07 14:42:36 -04:00
|
|
|
* Copyright (c) 2002-2008 LWJGL Project
|
2005-02-21 09:46:47 -05:00
|
|
|
* All rights reserved.
|
2008-08-19 12:46:03 -04:00
|
|
|
*
|
2005-02-21 09:46:47 -05:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
2008-08-19 12:46:03 -04:00
|
|
|
* modification, are permitted provided that the following conditions are
|
2005-02-21 09:46:47 -05:00
|
|
|
* met:
|
2008-08-19 12:46:03 -04:00
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
2005-02-21 09:46:47 -05:00
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
2008-08-19 12:46:03 -04:00
|
|
|
* * Neither the name of 'LWJGL' nor the names of
|
|
|
|
* its contributors may be used to endorse or promote products derived
|
2005-02-21 09:46:47 -05:00
|
|
|
* from this software without specific prior written permission.
|
2008-08-19 12:46:03 -04:00
|
|
|
*
|
2005-02-21 09:46:47 -05:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
2008-08-19 12:46:03 -04:00
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
2005-02-21 09:46:47 -05:00
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
2008-08-19 12:46:03 -04:00
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
2005-02-21 09:46:47 -05:00
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* @author elias_naur <elias_naur@users.sourceforge.net>
|
|
|
|
* @version $Revision$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <jni.h>
|
2006-07-12 14:32:58 -04:00
|
|
|
#include "org_lwjgl_opengl_WindowsPeerInfo.h"
|
2005-02-21 09:46:47 -05:00
|
|
|
#include "context.h"
|
|
|
|
#include "common_tools.h"
|
|
|
|
|
2006-07-12 14:32:58 -04:00
|
|
|
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle
|
2005-02-21 09:46:47 -05:00
|
|
|
(JNIEnv *env, jclass clazz) {
|
2006-07-12 14:32:58 -04:00
|
|
|
return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo));
|
2005-02-21 09:46:47 -05:00
|
|
|
}
|
|
|
|
|
2008-05-01 05:37:21 -04:00
|
|
|
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat
|
|
|
|
(JNIEnv *env, jclass clazz, jlong hdc_ptr, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) {
|
|
|
|
HDC hdc = (HDC)(INT_PTR)hdc_ptr;
|
2008-08-19 12:46:03 -04:00
|
|
|
return findPixelFormatOnDC(env, hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer);
|
2008-05-01 05:37:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat
|
|
|
|
(JNIEnv *env, jclass clazz, jlong hdc_ptr, jint pixel_format) {
|
|
|
|
HDC hdc = (HDC)(INT_PTR)hdc_ptr;
|
|
|
|
applyPixelFormat(env, hdc, pixel_format);
|
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc(JNIEnv *env, jclass unused, jobject peer_info_handle) {
|
|
|
|
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
|
|
|
|
return (intptr_t)peer_info->drawable_hdc;
|
2005-02-21 09:46:47 -05:00
|
|
|
}
|
2006-10-30 10:46:42 -05:00
|
|
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) {
|
|
|
|
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
|
2006-10-30 10:49:02 -05:00
|
|
|
return (intptr_t)peer_info->u.hwnd;
|
2006-10-30 10:46:42 -05:00
|
|
|
}
|