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: 56046b0f917c
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: c96107069da6
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Dec 1, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c961070 View commit details
Showing with 7 additions and 9 deletions.
  1. +1 −1 lib
  2. +1 −1 src/glscopeclient/WaveformArea.h
  3. +3 −3 src/glscopeclient/WaveformArea_cairo.cpp
  4. +2 −4 src/glscopeclient/WaveformArea_rendering.cpp
2 changes: 1 addition & 1 deletion lib
2 changes: 1 addition & 1 deletion src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -393,7 +393,7 @@ class WaveformArea : public Gtk::GLArea
float XAxisUnitsToXPosition(int64_t t);
float PickStepSize(float volts_per_half_span, int min_steps = 2, int max_steps = 5);
template<class T> static size_t BinarySearchForGequal(T* buf, size_t len, T value);
float GetValueAtTime(int64_t time_ps);
float GetValueAtTime(int64_t time_fs);

float GetDPIScale()
{ return get_pango_context()->get_resolution() / 96; }
6 changes: 3 additions & 3 deletions src/glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -721,18 +721,18 @@ void WaveformArea::RenderCursor(Cairo::RefPtr< Cairo::Context > cr, int64_t pos,
/**
@brief Gets the value of our channel at the specified timestamp (absolute, not waveform ticks)
*/
float WaveformArea::GetValueAtTime(int64_t time_ps)
float WaveformArea::GetValueAtTime(int64_t time_fs)
{
AnalogWaveform* waveform = dynamic_cast<AnalogWaveform*>(m_channel.GetData());
if(!waveform)
return 0;

//Find the index of the sample of interest
double ticks = 1.0f * (time_ps - waveform->m_triggerPhase) / waveform->m_timescale;
double ticks = 1.0f * (time_fs - waveform->m_triggerPhase) / waveform->m_timescale;
size_t index = BinarySearchForGequal(
(int64_t*)&waveform->m_offsets[0],
waveform->m_offsets.size(),
(int64_t)ceil(ticks));
(int64_t)round(ticks));

//Stop if start of waveform (no lerping possible)
if(index == 0)
6 changes: 2 additions & 4 deletions src/glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -177,17 +177,15 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata, bool update_wavefo
//trivially map sample indexes to X pixel coordinates.
//TODO: can we parallelize this? move to a compute shader?
auto group = wdata->m_area->m_group;
int64_t offset_samples = (group->m_xAxisOffset / pdat->m_timescale);
int64_t offset_samples = (group->m_xAxisOffset - pdat->m_triggerPhase) / pdat->m_timescale;
float xscale = (pdat->m_timescale * group->m_pixelsPerXUnit);
for(int j=0; j<wdata->m_area->m_width; j++)
{
int64_t target = floor(j / xscale) + offset_samples;
wdata->m_mappedIndexBuffer[j] = BinarySearchForGequal(
(int64_t*)&pdat->m_offsets[0],
wdata->m_count,
target - 5); //Small fudge factor to fix graphical artifacts (some columns of pixels not being drawn)
//I think these might be floating point rounding issues somewhere? Need to debug more
//but for now, this fixes rendering.
target-2);
}

//Scale alpha by zoom.