1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Bin number shouldn't be floating point.

This commit is contained in:
Bartosz Taudul 2019-08-02 19:43:08 +02:00
parent 138743f880
commit 9b6c405485

View File

@ -6692,11 +6692,11 @@ void View::DrawFindZone()
auto& io = ImGui::GetIO(); auto& io = ImGui::GetIO();
draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF ); draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF );
const auto bin = double( io.MousePos.x - wpos.x - 2 ); const auto bin = int64_t( io.MousePos.x - wpos.x - 2 );
int64_t t0, t1; int64_t t0, t1;
if( m_findZone.logTime ) if( m_findZone.logTime )
{ {
t0 = int64_t( pow( 10, ltmin + bin / numBins * ( ltmax - ltmin ) ) ); t0 = int64_t( pow( 10, ltmin + double( bin ) / numBins * ( ltmax - ltmin ) ) );
// Hackfix for inability to select data in last bin. // Hackfix for inability to select data in last bin.
// A proper solution would be nice. // A proper solution would be nice.
@ -6706,13 +6706,13 @@ void View::DrawFindZone()
} }
else else
{ {
t1 = int64_t( pow( 10, ltmin + (bin+1) / numBins * ( ltmax - ltmin ) ) ); t1 = int64_t( pow( 10, ltmin + double( bin+1 ) / numBins * ( ltmax - ltmin ) ) );
} }
} }
else else
{ {
t0 = int64_t( tmin + bin / numBins * ( tmax - tmin ) ); t0 = int64_t( tmin + double( bin ) / numBins * ( tmax - tmin ) );
t1 = int64_t( tmin + (bin+1) / numBins * ( tmax - tmin ) ); t1 = int64_t( tmin + double( bin+1 ) / numBins * ( tmax - tmin ) );
} }
int64_t tBefore = 0; int64_t tBefore = 0;
@ -7978,17 +7978,17 @@ void View::DrawCompare()
auto& io = ImGui::GetIO(); auto& io = ImGui::GetIO();
draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF ); draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF );
const auto bin = double( io.MousePos.x - wpos.x - 2 ); const auto bin = int64_t( io.MousePos.x - wpos.x - 2 );
int64_t t0, t1; int64_t t0, t1;
if( m_compare.logTime ) if( m_compare.logTime )
{ {
t0 = int64_t( pow( 10, ltmin + bin / numBins * ( ltmax - ltmin ) ) ); t0 = int64_t( pow( 10, ltmin + double( bin ) / numBins * ( ltmax - ltmin ) ) );
t1 = int64_t( pow( 10, ltmin + (bin+1) / numBins * ( ltmax - ltmin ) ) ); t1 = int64_t( pow( 10, ltmin + double( bin+1 ) / numBins * ( ltmax - ltmin ) ) );
} }
else else
{ {
t0 = int64_t( tmin + bin / numBins * ( tmax - tmin ) ); t0 = int64_t( tmin + double( bin ) / numBins * ( tmax - tmin ) );
t1 = int64_t( tmin + (bin+1) / numBins * ( tmax - tmin ) ); t1 = int64_t( tmin + double( bin+1 ) / numBins * ( tmax - tmin ) );
} }
int64_t tBefore[2] = { 0, 0 }; int64_t tBefore[2] = { 0, 0 };
@ -8975,11 +8975,11 @@ void View::DrawInfo()
auto& io = ImGui::GetIO(); auto& io = ImGui::GetIO();
draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF ); draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF );
const auto bin = double( io.MousePos.x - wpos.x - 2 ); const auto bin = int64_t( io.MousePos.x - wpos.x - 2 );
int64_t t0, t1; int64_t t0, t1;
if( m_frameSortData.logTime ) if( m_frameSortData.logTime )
{ {
t0 = int64_t( pow( 10, ltmin + bin / numBins * ( ltmax - ltmin ) ) ); t0 = int64_t( pow( 10, ltmin + double( bin ) / numBins * ( ltmax - ltmin ) ) );
// Hackfix for inability to select data in last bin. // Hackfix for inability to select data in last bin.
// A proper solution would be nice. // A proper solution would be nice.
@ -8989,13 +8989,13 @@ void View::DrawInfo()
} }
else else
{ {
t1 = int64_t( pow( 10, ltmin + (bin+1) / numBins * ( ltmax - ltmin ) ) ); t1 = int64_t( pow( 10, ltmin + double( bin+1 ) / numBins * ( ltmax - ltmin ) ) );
} }
} }
else else
{ {
t0 = int64_t( tmin + bin / numBins * ( tmax - tmin ) ); t0 = int64_t( tmin + double( bin ) / numBins * ( tmax - tmin ) );
t1 = int64_t( tmin + (bin+1) / numBins * ( tmax - tmin ) ); t1 = int64_t( tmin + double( bin+1 ) / numBins * ( tmax - tmin ) );
} }
ImGui::BeginTooltip(); ImGui::BeginTooltip();