fix(bw): Prevent points being drawn outside of LCD buffer (#4550)
This commit is contained in:
@@ -953,7 +953,7 @@ void lcdMaskPoint(uint8_t * p, uint8_t mask, LcdFlags att)
|
||||
void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att)
|
||||
{
|
||||
uint8_t * p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
if (p < DISPLAY_END) {
|
||||
if (IS_IN_DISPLAY(p)) {
|
||||
lcdMaskPoint(p, bfBit<uint8_t>(y % 8), att);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ extern coord_t lcdLastLeftPos;
|
||||
extern coord_t lcdNextPos;
|
||||
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define IS_IN_DISPLAY(p) ((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user