| 230 | } |
| 231 | |
| 232 | void |
| 233 | StringAnimationManager::stringFromInterpolatedIndex(double interpolated, |
| 234 | std::string* returnValue) const |
| 235 | { |
| 236 | int index = std::floor(interpolated + 0.5); |
| 237 | QMutexLocker l(&_imp->keyframesMutex); |
| 238 | |
| 239 | if ( _imp->keyframes.empty() ) { |
| 240 | return; |
| 241 | } |
| 242 | |
| 243 | ///if the index is not in the range, just return the last |
| 244 | if ( index >= (int)_imp->keyframes.size() ) { |
| 245 | Keyframes::const_iterator it = _imp->keyframes.end(); |
| 246 | --it; |
| 247 | *returnValue = it->value; |
| 248 | |
| 249 | return; |
| 250 | } |
| 251 | |
| 252 | int i = 0; |
| 253 | for (Keyframes::const_iterator it = _imp->keyframes.begin(); it != _imp->keyframes.end(); ++it) { |
| 254 | if (i == index) { |
| 255 | *returnValue = it->value; |
| 256 | |
| 257 | return; |
| 258 | } |
| 259 | ++i; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | void |
| 264 | StringAnimationManager::clone(const StringAnimationManager & other) |