mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Removed dynamic loading of gdi32.
This commit is contained in:
parent
532e0dd2f6
commit
2753577dbd
@ -54,7 +54,6 @@ if (_GLFW_WIN32_WGL)
|
||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
set(_GLFW_NO_DLOAD_GDI32 ${BUILD_SHARED_LIBS})
|
||||
set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
|
@ -45,8 +45,6 @@
|
||||
// Define this to 1 if building as a shared library / dynamic library / DLL
|
||||
#cmakedefine _GLFW_BUILD_DLL 1
|
||||
|
||||
// Define this to 1 to disable dynamic loading of gdi32
|
||||
#cmakedefine _GLFW_NO_DLOAD_GDI32 1
|
||||
// Define this to 1 to disable dynamic loading of winmm
|
||||
#cmakedefine _GLFW_NO_DLOAD_WINMM 1
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
||||
{
|
||||
_glfw_GetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
|
||||
GetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +52,6 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
||||
|
||||
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
||||
{
|
||||
_glfw_SetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
|
||||
SetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
|
||||
}
|
||||
|
||||
|
@ -44,40 +44,6 @@
|
||||
|
||||
static GLboolean initLibraries(void)
|
||||
{
|
||||
#ifndef _GLFW_NO_DLOAD_GDI32
|
||||
// gdi32.dll (OpenGL pixel format functions & SwapBuffers)
|
||||
|
||||
_glfwLibrary.Win32.gdi.instance = LoadLibrary(L"gdi32.dll");
|
||||
if (!_glfwLibrary.Win32.gdi.instance)
|
||||
return GL_FALSE;
|
||||
|
||||
_glfwLibrary.Win32.gdi.ChoosePixelFormat = (CHOOSEPIXELFORMAT_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "ChoosePixelFormat");
|
||||
_glfwLibrary.Win32.gdi.DescribePixelFormat = (DESCRIBEPIXELFORMAT_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "DescribePixelFormat");
|
||||
_glfwLibrary.Win32.gdi.GetPixelFormat = (GETPIXELFORMAT_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "GetPixelFormat");
|
||||
_glfwLibrary.Win32.gdi.SetPixelFormat = (SETPIXELFORMAT_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "SetPixelFormat");
|
||||
_glfwLibrary.Win32.gdi.SwapBuffers = (SWAPBUFFERS_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "SwapBuffers");
|
||||
_glfwLibrary.Win32.gdi.GetDeviceGammaRamp = (GETDEVICEGAMMARAMP_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "GetDeviceGammaRamp");
|
||||
_glfwLibrary.Win32.gdi.SetDeviceGammaRamp = (SETDEVICEGAMMARAMP_T)
|
||||
GetProcAddress(_glfwLibrary.Win32.gdi.instance, "SetDeviceGammaRamp");
|
||||
|
||||
if (!_glfwLibrary.Win32.gdi.ChoosePixelFormat ||
|
||||
!_glfwLibrary.Win32.gdi.DescribePixelFormat ||
|
||||
!_glfwLibrary.Win32.gdi.GetPixelFormat ||
|
||||
!_glfwLibrary.Win32.gdi.SetPixelFormat ||
|
||||
!_glfwLibrary.Win32.gdi.SwapBuffers ||
|
||||
!_glfwLibrary.Win32.gdi.GetDeviceGammaRamp ||
|
||||
!_glfwLibrary.Win32.gdi.SetDeviceGammaRamp)
|
||||
{
|
||||
return GL_FALSE;
|
||||
}
|
||||
#endif // _GLFW_NO_DLOAD_GDI32
|
||||
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
// winmm.dll (for joystick and timer support)
|
||||
|
||||
@ -113,14 +79,6 @@ static GLboolean initLibraries(void)
|
||||
|
||||
static void freeLibraries(void)
|
||||
{
|
||||
#ifndef _GLFW_NO_DLOAD_GDI32
|
||||
if (_glfwLibrary.Win32.gdi.instance != NULL)
|
||||
{
|
||||
FreeLibrary(_glfwLibrary.Win32.gdi.instance);
|
||||
_glfwLibrary.Win32.gdi.instance = NULL;
|
||||
}
|
||||
#endif // _GLFW_NO_DLOAD_GDI32
|
||||
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
if (_glfwLibrary.Win32.winmm.instance != NULL)
|
||||
{
|
||||
@ -274,9 +232,6 @@ const char* _glfwPlatformGetVersionString(void)
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
" DLL"
|
||||
#endif
|
||||
#if !defined(_GLFW_NO_DLOAD_GDI32)
|
||||
" load(gdi32)"
|
||||
#endif
|
||||
#if !defined(_GLFW_NO_DLOAD_WINMM)
|
||||
" load(winmm)"
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@ void _glfwPlatformSwapBuffers(void)
|
||||
{
|
||||
_GLFWwindow* window = _glfwLibrary.currentWindow;
|
||||
|
||||
_glfw_SwapBuffers(window->WGL.DC);
|
||||
SwapBuffers(window->WGL.DC);
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,17 +82,6 @@
|
||||
// DLLs that are loaded at glfwInit()
|
||||
//========================================================================
|
||||
|
||||
// gdi32.dll function pointer typedefs
|
||||
#ifndef _GLFW_NO_DLOAD_GDI32
|
||||
typedef int (WINAPI * CHOOSEPIXELFORMAT_T) (HDC,CONST PIXELFORMATDESCRIPTOR*);
|
||||
typedef int (WINAPI * DESCRIBEPIXELFORMAT_T) (HDC,int,UINT,LPPIXELFORMATDESCRIPTOR);
|
||||
typedef int (WINAPI * GETPIXELFORMAT_T) (HDC);
|
||||
typedef BOOL (WINAPI * SETPIXELFORMAT_T) (HDC,int,const PIXELFORMATDESCRIPTOR*);
|
||||
typedef BOOL (WINAPI * SWAPBUFFERS_T) (HDC);
|
||||
typedef BOOL (WINAPI * GETDEVICEGAMMARAMP_T) (HDC,PVOID);
|
||||
typedef BOOL (WINAPI * SETDEVICEGAMMARAMP_T) (HDC,PVOID);
|
||||
#endif // _GLFW_NO_DLOAD_GDI32
|
||||
|
||||
// winmm.dll function pointer typedefs
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT);
|
||||
@ -102,25 +91,6 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
|
||||
#endif // _GLFW_NO_DLOAD_WINMM
|
||||
|
||||
|
||||
// gdi32.dll shortcuts
|
||||
#ifndef _GLFW_NO_DLOAD_GDI32
|
||||
#define _glfw_ChoosePixelFormat _glfwLibrary.Win32.gdi.ChoosePixelFormat
|
||||
#define _glfw_DescribePixelFormat _glfwLibrary.Win32.gdi.DescribePixelFormat
|
||||
#define _glfw_GetPixelFormat _glfwLibrary.Win32.gdi.GetPixelFormat
|
||||
#define _glfw_SetPixelFormat _glfwLibrary.Win32.gdi.SetPixelFormat
|
||||
#define _glfw_SwapBuffers _glfwLibrary.Win32.gdi.SwapBuffers
|
||||
#define _glfw_GetDeviceGammaRamp _glfwLibrary.Win32.gdi.GetDeviceGammaRamp
|
||||
#define _glfw_SetDeviceGammaRamp _glfwLibrary.Win32.gdi.SetDeviceGammaRamp
|
||||
#else
|
||||
#define _glfw_ChoosePixelFormat ChoosePixelFormat
|
||||
#define _glfw_DescribePixelFormat DescribePixelFormat
|
||||
#define _glfw_GetPixelFormat GetPixelFormat
|
||||
#define _glfw_SetPixelFormat SetPixelFormat
|
||||
#define _glfw_SwapBuffers SwapBuffers
|
||||
#define _glfw_GetDeviceGammaRamp GetDeviceGammaRamp
|
||||
#define _glfw_SetDeviceGammaRamp SetDeviceGammaRamp
|
||||
#endif // _GLFW_NO_DLOAD_GDI32
|
||||
|
||||
// winmm.dll shortcuts
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
#define _glfw_joyGetDevCaps _glfwLibrary.Win32.winmm.joyGetDevCaps
|
||||
@ -225,20 +195,6 @@ typedef struct _GLFWlibraryWin32
|
||||
__int64 t0_64;
|
||||
} timer;
|
||||
|
||||
#ifndef _GLFW_NO_DLOAD_GDI32
|
||||
// gdi32.dll
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
CHOOSEPIXELFORMAT_T ChoosePixelFormat;
|
||||
DESCRIBEPIXELFORMAT_T DescribePixelFormat;
|
||||
GETPIXELFORMAT_T GetPixelFormat;
|
||||
SETPIXELFORMAT_T SetPixelFormat;
|
||||
SWAPBUFFERS_T SwapBuffers;
|
||||
GETDEVICEGAMMARAMP_T GetDeviceGammaRamp;
|
||||
SETDEVICEGAMMARAMP_T SetDeviceGammaRamp;
|
||||
} gdi;
|
||||
#endif // _GLFW_NO_DLOAD_GDI32
|
||||
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
// winmm.dll
|
||||
struct {
|
||||
|
@ -159,10 +159,10 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
||||
count = getPixelFormatAttrib(window, 1, WGL_NUMBER_PIXEL_FORMATS_ARB);
|
||||
else
|
||||
{
|
||||
count = _glfw_DescribePixelFormat(window->WGL.DC,
|
||||
1,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
NULL);
|
||||
count = DescribePixelFormat(window->WGL.DC,
|
||||
1,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!count)
|
||||
@ -243,10 +243,10 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
||||
{
|
||||
// Get pixel format attributes through old-fashioned PFDs
|
||||
|
||||
if (!_glfw_DescribePixelFormat(window->WGL.DC,
|
||||
i,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
&pfd))
|
||||
if (!DescribePixelFormat(window->WGL.DC,
|
||||
i,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
&pfd))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -311,14 +311,14 @@ static GLboolean createContext(_GLFWwindow* window,
|
||||
if (wndconfig->share)
|
||||
share = wndconfig->share->WGL.context;
|
||||
|
||||
if (!_glfw_DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
|
||||
if (!DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
|
||||
{
|
||||
_glfwSetError(GLFW_OPENGL_UNAVAILABLE,
|
||||
"Win32/WGL: Failed to retrieve PFD for selected pixel format");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfw_SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
|
||||
if (!SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
|
||||
{
|
||||
_glfwSetError(GLFW_OPENGL_UNAVAILABLE,
|
||||
"Win32/WGL: Failed to set selected pixel format");
|
||||
@ -1673,7 +1673,7 @@ void _glfwPlatformRefreshWindowParams(void)
|
||||
_GLFWwindow* window = _glfwLibrary.currentWindow;
|
||||
|
||||
// Obtain a detailed description of current pixel format
|
||||
pixelFormat = _glfw_GetPixelFormat(window->WGL.DC);
|
||||
pixelFormat = GetPixelFormat(window->WGL.DC);
|
||||
|
||||
if (window->WGL.ARB_pixel_format)
|
||||
{
|
||||
@ -1727,8 +1727,8 @@ void _glfwPlatformRefreshWindowParams(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
_glfw_DescribePixelFormat(window->WGL.DC, pixelFormat,
|
||||
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
DescribePixelFormat(window->WGL.DC, pixelFormat,
|
||||
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
// Is current OpenGL context accelerated?
|
||||
window->accelerated = (pfd.dwFlags & PFD_GENERIC_ACCELERATED) ||
|
||||
|
Loading…
Reference in New Issue
Block a user