Skip to content

Commit 740677a

Browse files
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.
1 parent 91d916d commit 740677a

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Adafruit_GFX.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,9 @@ class GFXcanvas1 : public Adafruit_GFX {
328328
bool getRawPixel(int16_t x, int16_t y) const;
329329
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
330330
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
331+
uint8_t *buffer; // protected (no longer private) for subclass flexibility
331332

332333
private:
333-
uint8_t *buffer;
334-
335334
#ifdef __AVR__
336335
// Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
337336
static const uint8_t PROGMEM GFXsetBit[], GFXclrBit[];
@@ -360,9 +359,7 @@ class GFXcanvas8 : public Adafruit_GFX {
360359
uint8_t getRawPixel(int16_t x, int16_t y) const;
361360
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
362361
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
363-
364-
private:
365-
uint8_t *buffer;
362+
uint8_t *buffer; // protected (no longer private) for subclass flexibility
366363
};
367364

368365
/// A GFX 16-bit canvas context for graphics
@@ -388,9 +385,7 @@ class GFXcanvas16 : public Adafruit_GFX {
388385
uint16_t getRawPixel(int16_t x, int16_t y) const;
389386
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
390387
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
391-
392-
private:
393-
uint16_t *buffer;
388+
uint16_t *buffer; // protected (no longer private) for subclass flexibility
394389
};
395390

396391
#endif // _ADAFRUIT_GFX_H

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit GFX Library
2-
version=1.11.3
2+
version=1.11.4
33
author=Adafruit
44
maintainer=Adafruit <[email protected]>
55
sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.

0 commit comments

Comments
 (0)