Move bin setup closer to bin usage.

This commit is contained in:
Bartosz Taudul 2019-06-16 16:29:18 +02:00
parent 761405e2a7
commit 14398dd4e8

View File

@ -6246,22 +6246,6 @@ void View::DrawFindZone()
const auto numBins = int64_t( w - 4 );
if( numBins > 1 )
{
if( numBins > m_findZone.numBins )
{
m_findZone.numBins = numBins;
m_findZone.bins = std::make_unique<int64_t[]>( numBins );
m_findZone.binTime = std::make_unique<int64_t[]>( numBins );
m_findZone.selBin = std::make_unique<int64_t[]>( numBins );
}
const auto& bins = m_findZone.bins;
const auto& binTime = m_findZone.binTime;
const auto& selBin = m_findZone.selBin;
memset( bins.get(), 0, sizeof( int64_t ) * numBins );
memset( binTime.get(), 0, sizeof( int64_t ) * numBins );
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
int64_t selectionTime = 0;
const auto s = std::min( m_findZone.highlight.start, m_findZone.highlight.end );
const auto e = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
@ -6323,6 +6307,22 @@ void View::DrawFindZone()
timeTotal = tmax - tmin;
}
if( numBins > m_findZone.numBins )
{
m_findZone.numBins = numBins;
m_findZone.bins = std::make_unique<int64_t[]>( numBins );
m_findZone.binTime = std::make_unique<int64_t[]>( numBins );
m_findZone.selBin = std::make_unique<int64_t[]>( numBins );
}
const auto& bins = m_findZone.bins;
const auto& binTime = m_findZone.binTime;
const auto& selBin = m_findZone.selBin;
memset( bins.get(), 0, sizeof( int64_t ) * numBins );
memset( binTime.get(), 0, sizeof( int64_t ) * numBins );
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
if( m_findZone.logTime )
{
const auto tMinLog = log10( tmin );