From 5ea4be3ffeae918899aeec8cbb67f87359cf0026 Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Wed, 18 Jan 2023 14:53:07 -0800 Subject: [PATCH] Fix bug w/large GFXcanvas1's (use 32-bit byte counts) --- Adafruit_GFX.cpp | 4 ++-- library.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Adafruit_GFX.cpp b/Adafruit_GFX.cpp index 7b9a1833..af989002 100644 --- a/Adafruit_GFX.cpp +++ b/Adafruit_GFX.cpp @@ -1761,7 +1761,7 @@ const uint8_t PROGMEM GFXcanvas1::GFXclrBit[] = {0x7F, 0xBF, 0xDF, 0xEF, */ /**************************************************************************/ GFXcanvas1::GFXcanvas1(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { - uint16_t bytes = ((w + 7) / 8) * h; + uint32_t bytes = ((w + 7) / 8) * h; if ((buffer = (uint8_t *)malloc(bytes))) { memset(buffer, 0, bytes); } @@ -1887,7 +1887,7 @@ bool GFXcanvas1::getRawPixel(int16_t x, int16_t y) const { /**************************************************************************/ void GFXcanvas1::fillScreen(uint16_t color) { if (buffer) { - uint16_t bytes = ((WIDTH + 7) / 8) * HEIGHT; + uint32_t bytes = ((WIDTH + 7) / 8) * HEIGHT; memset(buffer, color ? 0xFF : 0x00, bytes); } } diff --git a/library.properties b/library.properties index 3ebbb0a7..bd92ca6f 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.11.4 +version=1.11.5 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.