Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Jun 13, 2012
Pierre Rossel fix getFrameIndexAtPercent() and optimize it for big numbers
remove a warning
67cf9a5
Commits on Jun 14, 2012
Pierre Rossel remove useless comment 0b5819f
Commits on Jul 27, 2012
James George obviousjim Merge pull request #3 from prossel/master
fix getFrameIndexAtPercent() and optimize it for big numbers
6a174fc
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/ofxImageSequence.cpp
7 src/ofxImageSequence.cpp
View
@@ -204,10 +204,9 @@ ofTexture* ofxImageSequence::getFrameAtPercent(float percent)
int ofxImageSequence::getFrameIndexAtPercent(float percent)
{
- while (percent > 1.0) percent--;
- while (percent < 0.0) percent++;
+ if (percent < 0.0 || percent > 1.0) percent -= floor(percent);
- return (int)MIN(percent*(sequence.size() - .5),sequence.size()-1);
+ return MIN((int)(percent*sequence.size()), sequence.size()-1);
}
ofTexture* ofxImageSequence::getFrameForTime(float time)
@@ -281,6 +280,6 @@ int ofxImageSequence::imageTypeToGLType(int imageType)
return GL_RGBA;
default:
ofLog(OF_LOG_ERROR, "ofxImageSequence - unsupported image type for image");
- break;
+ return GL_RGB;
}
}

No commit comments for this range

Something went wrong with that request. Please try again.