Fix for GifImageStream::setReferenceTime
Setting the reference time greater than the duration of a gif would cause a crash. Also, the current reference time is not immediately updated when manually setting the reference time.
This commit is contained in:
parent
627c3df093
commit
273dd046c2
@ -112,14 +112,15 @@ public:
|
|||||||
|
|
||||||
int i=1;
|
int i=1;
|
||||||
int framePos = static_cast<int>(time*100.0/_multiplier);
|
int framePos = static_cast<int>(time*100.0/_multiplier);
|
||||||
if ( framePos>=(int)_length )
|
framePos = osg::clampBetween(framePos, 0, (int)_length);
|
||||||
framePos = _length;
|
_currentLength = framePos;
|
||||||
|
|
||||||
|
std::vector<FrameData*>::iterator lastFrame = --_dataList.end();
|
||||||
std::vector<FrameData*>::iterator it;
|
std::vector<FrameData*>::iterator it;
|
||||||
for ( it=_dataList.begin(); it!=_dataList.end(); it++,i++ )
|
for ( it=_dataList.begin(); it!=_dataList.end(); it++,i++ )
|
||||||
{
|
{
|
||||||
framePos -= (*it)->delay;
|
framePos -= (*it)->delay;
|
||||||
if ( framePos<0 )
|
if ( framePos<0 || it == lastFrame )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_dataNum = i-1;
|
_dataNum = i-1;
|
||||||
|
Loading…
Reference in New Issue
Block a user