|
From: Elias N. <eli...@us...> - 2005-11-24 11:31:34
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27762/src/native/win32 Modified Files: context.c context.h org_lwjgl_opengl_Pbuffer.c org_lwjgl_opengl_Win32DisplayPeerInfo.c org_lwjgl_opengl_Win32PeerInfo.c Log Message: Added support for native formatted exception messages Index: org_lwjgl_opengl_Win32PeerInfo.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Win32PeerInfo.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_Win32PeerInfo.c 21 Feb 2005 14:46:47 -0000 1.1 +++ org_lwjgl_opengl_Win32PeerInfo.c 24 Nov 2005 11:31:26 -0000 1.2 @@ -53,8 +53,6 @@ int pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer); if (pixel_format_id == -1) return; - if (!applyPixelFormat(peer_info->format_hdc, pixel_format_id)) { - throwException(env, "Could not apply pixel format"); - return; - } + // Let it throw + applyPixelFormat(env, peer_info->format_hdc, pixel_format_id); } Index: org_lwjgl_opengl_Pbuffer.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Pbuffer.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_opengl_Pbuffer.c 12 May 2005 07:47:07 -0000 1.16 +++ org_lwjgl_opengl_Pbuffer.c 24 Nov 2005 11:31:26 -0000 1.17 @@ -71,9 +71,8 @@ return false; } dummy_hdc = GetDC(dummy_hwnd); - if (!applyPixelFormat(dummy_hdc, pixel_format_id)) { + if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Could not apply pixel format"); return false; } dummy_context = wglCreateContext(dummy_hdc); Index: context.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/context.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- context.c 24 Nov 2005 10:28:32 -0000 1.9 +++ context.c 24 Nov 2005 11:31:26 -0000 1.10 @@ -40,6 +40,7 @@ */ #include <malloc.h> +#include <jni.h> #include "common_tools.h" #include "extgl.h" #include "extgl_wgl.h" @@ -78,14 +79,16 @@ return DefWindowProc(hwnd, msg, wParam, lParam); } -bool applyPixelFormat(HDC hdc, int iPixelFormat) { +bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat) { PIXELFORMATDESCRIPTOR desc; if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + throwFormattedException(env, "DescribePixelFormat failed (%d)", GetLastError()); return false; } // make that the pixel format of the device context if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { + throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError()); return false; } return true; @@ -358,8 +361,7 @@ bool use_arb_selection = samples > 0 || pbuffer || pixelFormatCaps != NULL; pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer); if (use_arb_selection) { - if (!applyPixelFormat(hdc, pixel_format_id)) { - throwException(env, "Could not apply pixel format to window"); + if (!applyPixelFormat(env, hdc, pixel_format_id)) { return -1; } dummy_hglrc = wglCreateContext(hdc); Index: context.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/context.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- context.h 29 Apr 2005 15:08:16 -0000 1.3 +++ context.h 24 Nov 2005 11:31:26 -0000 1.4 @@ -43,6 +43,7 @@ #define __LWJGL_CONTEXT_H #include <windows.h> +#include <jni.h> #include "common_tools.h" #include "extgl.h" #include "extgl_wgl.h" @@ -67,7 +68,7 @@ */ extern bool registerWindow(); -extern bool applyPixelFormat(HDC hdc, int iPixelFormat); +extern bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat); /* * Close the window Index: org_lwjgl_opengl_Win32DisplayPeerInfo.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Win32DisplayPeerInfo.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_Win32DisplayPeerInfo.c 21 Feb 2005 14:46:47 -0000 1.1 +++ org_lwjgl_opengl_Win32DisplayPeerInfo.c 24 Nov 2005 11:31:26 -0000 1.2 @@ -73,6 +73,6 @@ throwException(env, "Could not get pixel format from dummy hdc"); return; } - if (!applyPixelFormat(peer_info->drawable_hdc, pixel_format)) - throwException(env, "Could not apply pixel format to drawable"); + // If applyPixelFormat fails, just let it throw + applyPixelFormat(env, peer_info->drawable_hdc, pixel_format); } |