* @brief Preserves the auto points over different scale */
| 481 | * @brief Preserves the auto points over different scale |
| 482 | */ |
| 483 | void AutomationPatternView::scaleTimemapToFit( float oldMin, float oldMax ) |
| 484 | { |
| 485 | float newMin = m_pat->getMin(); |
| 486 | float newMax = m_pat->getMax(); |
| 487 | |
| 488 | if( oldMin == newMin && oldMax == newMax ) |
| 489 | { |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | for( AutomationPattern::timeMap::iterator it = m_pat->m_timeMap.begin(); |
| 494 | it != m_pat->m_timeMap.end(); ++it ) |
| 495 | { |
| 496 | if( *it < oldMin ) |
| 497 | { |
| 498 | *it = oldMin; |
| 499 | } |
| 500 | else if( *it > oldMax ) |
| 501 | { |
| 502 | *it = oldMax; |
| 503 | } |
| 504 | *it = (*it-oldMin)*(newMax-newMin)/(oldMax-oldMin)+newMin; |
| 505 | } |
| 506 | |
| 507 | m_pat->generateTangents(); |
| 508 | } |
no test coverage detected