Merge pull request #631 from flashk/patch-3

Fix for GifImageStream::setReferenceTime
This commit is contained in:
OpenSceneGraph git repository 2018-10-04 08:52:33 +01:00 committed by GitHub
commit 0a6f2be9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,14 +112,15 @@ public:
int i=1;
int framePos = static_cast<int>(time*100.0/_multiplier);
if ( framePos>=(int)_length )
framePos = _length;
framePos = osg::clampBetween(framePos, 0, (int)_length);
_currentLength = framePos;
std::vector<FrameData*>::iterator lastFrame = --_dataList.end();
std::vector<FrameData*>::iterator it;
for ( it=_dataList.begin(); it!=_dataList.end(); it++,i++ )
{
framePos -= (*it)->delay;
if ( framePos<0 )
if ( framePos<0 || it == lastFrame )
break;
}
_dataNum = i-1;