Skip to content

Commit abd5e8e

Browse files
committed
Fix drawRect drawing one pixel more than specified in both dimension
1 parent 0ab39f1 commit abd5e8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

OLEDDisplay.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ void OLEDDisplay::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1) {
125125
void OLEDDisplay::drawRect(int16_t x, int16_t y, int16_t width, int16_t height) {
126126
drawHorizontalLine(x, y, width);
127127
drawVerticalLine(x, y, height);
128-
drawVerticalLine(x + width, y, height);
129-
drawHorizontalLine(x, y + height, width);
128+
drawVerticalLine(x + width - 1, y, height);
129+
drawHorizontalLine(x, y + height - 1, width);
130130
}
131131

132132
void OLEDDisplay::fillRect(int16_t xMove, int16_t yMove, int16_t width, int16_t height) {

0 commit comments

Comments
 (0)