summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-04-25 15:06:47 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-04-25 15:06:47 +0200
commit486fafea19c459175eaff3e3f2339064028d399d (patch)
treeb8c98be4449a824b065bb958ac780211f23cfc0a
parentd762ec9f9fef7636602b73e11ddfc1842f377e92 (diff)
WIP: Show mapped points as circles.
-rw-r--r--plugingui/painter.cc5
-rw-r--r--plugingui/powerwidget.cc8
2 files changed, 12 insertions, 1 deletions
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)
{