From 4e699dc27cf03f763be30f19db2e3d90a356a813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 16 Feb 2018 10:56:19 +0100 Subject: [PATCH] [apps] statistics: improve box rendering --- apps/statistics/box_view.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/statistics/box_view.cpp b/apps/statistics/box_view.cpp index bfdc93dbb..c1b3ab61c 100644 --- a/apps/statistics/box_view.cpp +++ b/apps/statistics/box_view.cpp @@ -52,15 +52,10 @@ void BoxView::drawRect(KDContext * ctx, KDRect rect) const { // Draw the main box KDCoordinate firstQuartilePixels = std::round(floatToPixel(Axis::Horizontal, m_store->firstQuartile())); KDCoordinate thirdQuartilePixels = std::round(floatToPixel(Axis::Horizontal, m_store->thirdQuartile())); - KDCoordinate lowBoundPixel = floatToPixel(Axis::Vertical, upBound); - KDCoordinate upBoundPixel = floatToPixel(Axis::Vertical, lowBound); + KDCoordinate lowBoundPixel = std::round(floatToPixel(Axis::Vertical, upBound)); + KDCoordinate upBoundPixel = std::round(floatToPixel(Axis::Vertical, lowBound)); ctx->fillRect(KDRect(firstQuartilePixels, lowBoundPixel, thirdQuartilePixels - firstQuartilePixels+2, upBoundPixel-lowBoundPixel), Palette::GreyWhite); - // Add 'shadows' to the box - if (thirdQuartilePixels-firstQuartilePixels > 2) { - ctx->fillRect(KDRect(firstQuartilePixels, upBoundPixel-1, thirdQuartilePixels-firstQuartilePixels, 1), Palette::GreyBright); - ctx->fillRect(KDRect(firstQuartilePixels, upBoundPixel, thirdQuartilePixels-firstQuartilePixels, 1), Palette::GreyMiddle); - } // Draw the horizontal lines linking the box to the extreme bounds drawSegment(ctx, rect, Axis::Horizontal, 0.5f, m_store->minValue(), m_store->firstQuartile(), Palette::GreyDark); drawSegment(ctx, rect, Axis::Horizontal, 0.5f, m_store->thirdQuartile(), m_store->maxValue(), Palette::GreyDark);