Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 43c600507afe
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d9ba37ad2dc7
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Mar 10, 2020

  1. Copy the full SHA
    d9ba37a View commit details
Showing with 9 additions and 0 deletions.
  1. +4 −0 glscopeclient/Timeline.cpp
  2. +5 −0 glscopeclient/WaveformArea_events.cpp
4 changes: 4 additions & 0 deletions glscopeclient/Timeline.cpp
Original file line number Diff line number Diff line change
@@ -233,6 +233,10 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, Unit xAxisUnit)
double units_rounded = pow(base, log_units_rounded);
int64_t grad_ps_rounded = units_rounded * round_divisor;

//avoid divide-by-zero in weird cases with no waveform etc
if(grad_ps_rounded == 0)
return;

//Calculate number of ticks within a division
double nsubticks = 5;
double subtick = grad_ps_rounded / nsubticks;
5 changes: 5 additions & 0 deletions glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -579,6 +579,11 @@ void WaveformArea::OnWaveformDataReady()
{
//eye is two UIs wide
int64_t eye_width_ps = 2 * eye->GetUIWidth();

//If decode fails for some reason, don't have an invalid timeline
if(eye_width_ps == 0)
eye_width_ps = 5;

m_group->m_pixelsPerXUnit = m_width * 1.0f / eye_width_ps;
m_group->m_xAxisOffset = -eye->GetUIWidth();
}