From 486fafea19c459175eaff3e3f2339064028d399d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 25 Apr 2020 15:06:47 +0200 Subject: WIP: Show mapped points as circles. --- plugingui/painter.cc | 5 ++++- plugingui/powerwidget.cc | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'plugingui') diff --git a/plugingui/painter.cc b/plugingui/painter.cc index bad5318..bc4abc3 100644 --- a/plugingui/painter.cc +++ b/plugingui/painter.cc @@ -252,7 +252,10 @@ void Painter::drawText(int x0, int y0, const Font& font, void Painter::drawPoint(int x, int y) { - pixbuf.setPixel(x, y, colour); + if(x >= 0 && y >= 0 && (std::size_t)x < pixbuf.width && (std::size_t)y < pixbuf.height) + { + pixbuf.setPixel(x, y, colour); + } } static void plot4points(Painter *p, int cx, int cy, int x, int y) diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc index ec7e498..0fb4c7d 100644 --- a/plugingui/powerwidget.cc +++ b/plugingui/powerwidget.cc @@ -184,12 +184,20 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) p.setColour(GUI::Colour{0.0f, 0.7f, 0.5f, 1.0f}); p.drawFilledCircle(settings.fixed0_x.load() * width(), height() - settings.fixed0_y.load() * height(), rad); + p.drawCircle(power_map.getFixed0().in * width(), + height() - power_map.getFixed0().out * height(), rad + 2); + p.setColour(GUI::Colour{0.5f, 0.7f, 0.0f, 1.0f}); p.drawFilledCircle(settings.fixed1_x.load() * width(), height() - settings.fixed1_y.load() * height(), rad); + p.drawCircle(power_map.getFixed1().in * width(), + height() - power_map.getFixed1().out * height(), rad + 2); + p.setColour(GUI::Colour{0.5f, 0.0f, 0.7f, 1.0f}); p.drawFilledCircle(settings.fixed2_x.load() * width(), height() - settings.fixed2_y.load() * height(), rad); + p.drawCircle(power_map.getFixed2().in * width(), + height() - power_map.getFixed2().out * height(), rad + 2); if(enabled) { -- cgit v1.2.3