Skip to content
Snippets Groups Projects
Commit 6b303e57 authored by FWeinb's avatar FWeinb Committed by GitHub
Browse files

Merge pull request #64 from squix78/fix-drawVerticalLine

Fixing display bounding check in `drawVerticalLine`
parents 27e36868 4f7eca40
No related branches found
No related tags found
No related merge requests found
...@@ -215,14 +215,18 @@ void OLEDDisplay::drawHorizontalLine(int16_t x, int16_t y, int16_t length) { ...@@ -215,14 +215,18 @@ void OLEDDisplay::drawHorizontalLine(int16_t x, int16_t y, int16_t length) {
} }
void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length) { void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length) {
if (y < 0 || y > DISPLAY_HEIGHT) return; if (x < 0 || x > DISPLAY_WIDTH) return;
if (x < 0) { if (y < 0) {
length += x; length += y;
x = 0; y = 0;
}
if ( (y + length) > DISPLAY_HEIGHT) {
length = (DISPLAY_HEIGHT - y);
} }
if (length < 0) return; if (length <= 0) return;
uint8_t yOffset = y & 7; uint8_t yOffset = y & 7;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment