From abd5e8e57f1b57e43074e44e9ec34a7585d97f15 Mon Sep 17 00:00:00 2001 From: Fabrice Weinberg <Fabrice@weinberg.me> Date: Fri, 15 Jul 2016 21:02:57 +0200 Subject: [PATCH] Fix drawRect drawing one pixel more than specified in both dimension --- OLEDDisplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OLEDDisplay.cpp b/OLEDDisplay.cpp index 2be2414..860b489 100644 --- a/OLEDDisplay.cpp +++ b/OLEDDisplay.cpp @@ -125,8 +125,8 @@ void OLEDDisplay::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1) { void OLEDDisplay::drawRect(int16_t x, int16_t y, int16_t width, int16_t height) { drawHorizontalLine(x, y, width); drawVerticalLine(x, y, height); - drawVerticalLine(x + width, y, height); - drawHorizontalLine(x, y + height, width); + drawVerticalLine(x + width - 1, y, height); + drawHorizontalLine(x, y + height - 1, width); } void OLEDDisplay::fillRect(int16_t xMove, int16_t yMove, int16_t width, int16_t height) { -- GitLab