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: 0791cd3fd26f
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: 9017a91586ec
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Oct 27, 2020

  1. 1
    Copy the full SHA
    a5267ff View commit details
  2. 1
    Copy the full SHA
    9017a91 View commit details
Showing with 13 additions and 8 deletions.
  1. +4 −4 src/glscopeclient/Timeline.cpp
  2. +3 −0 src/glscopeclient/Timeline.h
  3. +1 −1 src/glscopeclient/WaveformArea.cpp
  4. +3 −0 src/glscopeclient/WaveformArea.h
  5. +2 −3 src/glscopeclient/WaveformArea_cairo.cpp
8 changes: 4 additions & 4 deletions src/glscopeclient/Timeline.cpp
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ Timeline::Timeline(OscilloscopeWindow* parent, WaveformGroup* group)
m_dragStartX = 0;
m_originalTimeOffset = 0;

set_size_request(1, 40);
set_size_request(1, 32 * get_pango_context()->get_resolution() / 96);

add_events(
Gdk::POINTER_MOTION_MASK |
@@ -241,7 +241,7 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
round_divisor = 1E12;

//Figure out about how much time per graduation to use
const double min_label_grad_width = 75; //Minimum distance between text labels, in pixels
const double min_label_grad_width = 75 * GetDPIScale(); //Minimum distance between text labels, in pixels
double grad_ps_nominal = min_label_grad_width / m_group->m_pixelsPerXUnit;

//Round so the division sizes are sane
@@ -302,7 +302,7 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
//Render it
tlayout->set_text(m_xAxisUnit.PrettyPrint(t));
tlayout->get_pixel_size(swidth, sheight);
cr->move_to(x+2, ymid + sheight/2);
cr->move_to(x+2, ymid);
tlayout->update_from_cairo_context(cr);
tlayout->show_in_cairo_context(cr);
}
@@ -368,7 +368,7 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
cr->set_source_rgba(color.get_red_p(), color.get_green_p(), color.get_blue_p(), 1.0);
}

int size = 5;
int size = 5 * GetDPIScale();
cr->move_to(x-size, h-size);
cr->line_to(x, h);
cr->line_to(x+size, h-size);
3 changes: 3 additions & 0 deletions src/glscopeclient/Timeline.h
Original file line number Diff line number Diff line change
@@ -71,6 +71,9 @@ class Timeline : public Gtk::Layout
WaveformGroup* m_group;
OscilloscopeWindow* m_parent;

float GetDPIScale()
{ return get_pango_context()->get_resolution() / 96; }

Unit m_xAxisUnit;
};

2 changes: 1 addition & 1 deletion src/glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ void WaveformArea::SharedCtorInit()
m_insertionBarLocation = INSERT_NONE;
m_dropTarget = NULL;
m_padding = 2;
m_overlaySpacing = 30;
m_overlaySpacing = 25 * GetDPIScale();
m_persistenceClear = true;
m_firstFrame = false;
m_waveformRenderData = NULL;
3 changes: 3 additions & 0 deletions src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -398,6 +398,9 @@ class WaveformArea : public Gtk::GLArea
template<class T> static size_t BinarySearchForGequal(T* buf, size_t len, T value);
float GetValueAtTime(int64_t time_ps);

float GetDPIScale()
{ return get_pango_context()->get_resolution() / 96; }

void OnRemoveOverlay(StreamDescriptor filter);

StreamDescriptor m_channel; //The main waveform for this view
5 changes: 2 additions & 3 deletions src/glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -229,7 +229,7 @@ void WaveformArea::RenderTriggerArrow(
{
float y = VoltsToYPosition(voltage);

float trisize = 5;
float trisize = 5 * GetDPIScale();

//Dragging? Arrow follows mouse
if(dragging)
@@ -323,8 +323,7 @@ void WaveformArea::RenderEyeMask(Cairo::RefPtr< Cairo::Context > cr)

void WaveformArea::RenderDecodeOverlays(Cairo::RefPtr< Cairo::Context > cr)
{
//TODO: adjust height/spacing depending on font sizes etc
int height = 20;
int height = 20 * GetDPIScale();

//Render digital bus waveforms in the main channel here (TODO: GL stuff)
auto bus = dynamic_cast<DigitalBusWaveform*>(m_channel.GetData());