From e45035db5c297190eee18cefa3b91b36b9f0e32b Mon Sep 17 00:00:00 2001 From: Oleg Korsak Date: Sat, 7 Jan 2017 22:03:51 +0200 Subject: [PATCH] extmod/modframebuf: optimize fill_rect subroutine call --- extmod/modframebuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index d6e686e076..93d4922c92 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -115,7 +115,7 @@ static inline uint32_t getpixel(const mp_obj_framebuf_t *fb, int x, int y) { } STATIC void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) { - if (x + w <= 0 || y + h <= 0 || y >= fb->height || x >= fb->width) { + if (h < 1 || w < 1 || x + w <= 0 || y + h <= 0 || y >= fb->height || x >= fb->width) { // No operation needed. return; }