From Paul de Repentigny, fix for dvide by zero crash under windows when toggle full screen in ogviewer.

From Robert Osfield, tweak to the fix to add comment describing the extra check, and addition of check against width, and change to ==0 rather than <= 0.
This commit is contained in:
Robert Osfield
2006-10-14 10:16:00 +00:00
parent 97fc2dfa21
commit b439c08b71

View File

@@ -208,6 +208,10 @@ void ViewerEventHandler::StatsAndHelpDrawCallback::operator()( const Producer::C
int x,y;
unsigned int width,height;
camera.getProjectionRectangle(x,y,width,height);
// don't redraw if the new window size is 0 width or height.
if (width==0 || height==0) return;
_viewport->setViewport(x,y,width,height);
OsgSceneHandler* osh = _veh->getOsgCameraGroup()->getSceneHandlerList()[_cameraNumber].get();
@@ -1258,13 +1262,6 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
}
#ifdef COMPILE_COMPOSITE_EVENTHANDLER
void ViewerEventHandler::accept(osgGA::GUIEventHandlerVisitor& gehv)
{
gehv.visit(*this);
}
#endif
void ViewerEventHandler::getUsage(osg::ApplicationUsage& usage) const
{
usage.addKeyboardMouseBinding("f","Toggle fullscreen");