mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[3DTEXT] Fix 3dtext.scr using near 100% CPU (#4125)
CORE-17866, CORE-8217
This commit is contained in:
parent
c05a45e17e
commit
5c9fdcb1de
1 changed files with 16 additions and 0 deletions
|
@ -41,6 +41,9 @@ GLfloat extentY = 0.0f;
|
|||
|
||||
HINSTANCE hInstance;
|
||||
BOOL fullscreen = FALSE;
|
||||
UINT uTimerID; // SetTimer Actual ID
|
||||
#define APP_TIMER 1 // Graphics Update Timer ID
|
||||
#define APP_TIMER_INTERVAL (USER_TIMER_MINIMUM * 5) // Graphics Update Interval
|
||||
|
||||
// Build Our Bitmap Font
|
||||
GLvoid BuildFont(GLvoid)
|
||||
|
@ -338,12 +341,18 @@ ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
// Initialize The GL Screen Using Screen Info
|
||||
InitGL(Screen.right, Screen.bottom);
|
||||
|
||||
// Create Graphics update timer
|
||||
uTimerID = SetTimer(hWnd, APP_TIMER, APP_TIMER_INTERVAL, NULL);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
// Disable Fullscreen Mode
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
|
||||
// Delete the Update Timer
|
||||
KillTimer(hWnd, uTimerID);
|
||||
|
||||
// Deletes The Font Display List
|
||||
KillFont();
|
||||
|
||||
|
@ -360,6 +369,8 @@ ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case WM_PAINT:
|
||||
DrawGLScene();
|
||||
SwapBuffers(hDC);
|
||||
// Mark this window as updated, so the OS won't ask us to update it again.
|
||||
ValidateRect(hWnd, NULL);
|
||||
break;
|
||||
|
||||
case WM_SIZE: // Resizing The Screen
|
||||
|
@ -367,6 +378,11 @@ ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
ReSizeGLScene(LOWORD(lParam), HIWORD(lParam));
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
// Used to update graphic based on timer udpate interval
|
||||
InvalidateRect(hWnd, NULL, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Pass Windows Messages to the default screensaver window procedure
|
||||
return DefScreenSaverProc(hWnd, message, wParam, lParam);
|
||||
|
|
Loading…
Reference in a new issue