Changed DisplaySetting::instance() to return a ref_ptr<>& rathern than a raw C pointer to enable apps to delete the singleton or assign their own.

This commit is contained in:
Robert Osfield
2010-04-30 11:48:30 +00:00
parent afce262601
commit c2a59415ce
5 changed files with 51 additions and 11 deletions

View File

@@ -427,7 +427,7 @@ void View::setUpViewAcrossAllScreens()
return;
}
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance();
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get();
double fovy, aspectRatio, zNear, zFar;
_camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
@@ -575,7 +575,7 @@ void View::setUpViewAcrossAllScreens()
void View::setUpViewInWindow(int x, int y, int width, int height, unsigned int screenNum)
{
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance();
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds);
@@ -633,7 +633,7 @@ void View::setUpViewOnSingleScreen(unsigned int screenNum)
return;
}
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance();
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get();
osg::GraphicsContext::ScreenIdentifier si;
si.readDISPLAY();