Skip to content

Commit

Permalink
Fix bug w/large GFXcanvas1's (use 32-bit byte counts)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed Jan 18, 2023
1 parent e122c3d commit 5ea4be3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Adafruit_GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit GFX Library
version=1.11.4
version=1.11.5
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.
Expand Down

0 comments on commit 5ea4be3

Please sign in to comment.