diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-03-25 22:50:26 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-03-25 22:50:26 +0000 |
commit | 6fcf38217e8772b2f90c7a8e7ce6b60071f6d20c (patch) | |
tree | a8e35fe195cc86c616daf9d8a21571e04bc2bc35 /indra/llwindow/llwindowsdl.cpp | |
parent | 11a3589665aae1a2423e258e40eba45c117627d5 (diff) |
merge release@82858 maint-render-2-merge@83010 -> release
QAR-389
Diffstat (limited to 'indra/llwindow/llwindowsdl.cpp')
-rw-r--r-- | indra/llwindow/llwindowsdl.cpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 686be3385e..122b57a497 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -81,7 +81,7 @@ static BOOL was_fullscreen = FALSE; void maybe_lock_display(void) { - if (gWindowImplementation) { + if (gWindowImplementation && gWindowImplementation->Lock_Display) { gWindowImplementation->Lock_Display(); } } @@ -89,7 +89,7 @@ void maybe_lock_display(void) void maybe_unlock_display(void) { - if (gWindowImplementation) { + if (gWindowImplementation && gWindowImplementation->Unlock_Display) { gWindowImplementation->Unlock_Display(); } } @@ -217,7 +217,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth) + BOOL ignore_pixel_depth, U32 fsaa_samples) : LLWindow(fullscreen, flags), mGamma(1.0f) { // Initialize the keyboard @@ -236,6 +236,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width, mReallyCapturedCount = 0; mHaveInputFocus = -1; mIsMinimized = -1; + mFSAASamples = fsaa_samples; #if LL_X11 mSDL_XWindowID = None; @@ -260,7 +261,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width, mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */ if(mWindowTitle == NULL) { - llerrs << "Memory allocation failure" << llendl; + llwarns << "Memory allocation failure" << llendl; return; } @@ -535,6 +536,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if (mFSAASamples > 0) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples); + } + mSDLFlags = sdlflags; if (mFullscreen) @@ -796,7 +803,6 @@ void LLWindowSDL::destroyContext() gGLManager.shutdownGL(); llinfos << "SDL_QuitSS/VID begins" << llendl; SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... - //unload_all_glsyms(); mWindow = NULL; } @@ -922,10 +928,10 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size) { size->mX = mWindow->w; size->mY = mWindow->h; - return (TRUE); + return (TRUE); } - llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; + llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; return (FALSE); } @@ -935,10 +941,10 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size) { size->mX = mWindow->w; size->mY = mWindow->h; - return (TRUE); + return (TRUE); } - llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; + llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; return (FALSE); } @@ -970,6 +976,16 @@ void LLWindowSDL::swapBuffers() SDL_GL_SwapBuffers(); } +U32 LLWindowSDL::getFSAASamples() +{ + return mFSAASamples; +} + +void LLWindowSDL::setFSAASamples(const U32 samples) +{ + mFSAASamples = samples; +} + F32 LLWindowSDL::getGamma() { return 1/mGamma; @@ -1116,8 +1132,10 @@ F32 LLWindowSDL::getPixelAspectRatio() if (getFullscreen()) { LLCoordScreen screen_size; - getSize(&screen_size); - pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX; + if (getSize(&screen_size)) + { + pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX; + } } return pixel_aspect; |