From 740677a73364683043cedda87cc623a5e9b0b212 Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Mon, 16 Jan 2023 15:02:36 -0800 Subject: [PATCH] Make canvas buffers protected instead of private members A use case came up where it was helpful to be able to alter the buffer pointer in a subclass. This is esoteric and should be used with care. --- Adafruit_GFX.h | 11 +++-------- library.properties | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Adafruit_GFX.h b/Adafruit_GFX.h index cd549aa..8000fa0 100644 --- a/Adafruit_GFX.h +++ b/Adafruit_GFX.h @@ -328,10 +328,9 @@ protected: bool getRawPixel(int16_t x, int16_t y) const; void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color); void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color); + uint8_t *buffer; // protected (no longer private) for subclass flexibility private: - uint8_t *buffer; - #ifdef __AVR__ // Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR static const uint8_t PROGMEM GFXsetBit[], GFXclrBit[]; @@ -360,9 +359,7 @@ protected: uint8_t getRawPixel(int16_t x, int16_t y) const; void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color); void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - -private: - uint8_t *buffer; + uint8_t *buffer; // protected (no longer private) for subclass flexibility }; /// A GFX 16-bit canvas context for graphics @@ -388,9 +385,7 @@ protected: uint16_t getRawPixel(int16_t x, int16_t y) const; void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color); void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - -private: - uint16_t *buffer; + uint16_t *buffer; // protected (no longer private) for subclass flexibility }; #endif // _ADAFRUIT_GFX_H diff --git a/library.properties b/library.properties index 355e170..3ebbb0a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.11.3 +version=1.11.4 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.