Skip to content

Commit 82e71e0

Browse files
Merge pull request #18 from jrcutler/master
Make WIDTH & HEIGHT const
2 parents f24ae80 + b4176b1 commit 82e71e0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Adafruit_GFX.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ POSSIBILITY OF SUCH DAMAGE.
3939
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
4040
#endif
4141

42-
Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h) {
43-
_width = WIDTH = w;
44-
_height = HEIGHT = h;
42+
Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h):
43+
WIDTH(w), HEIGHT(h)
44+
{
45+
_width = WIDTH;
46+
_height = HEIGHT;
4547
rotation = 0;
4648
cursor_y = cursor_x = 0;
4749
textsize = 1;

Adafruit_GFX.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ class Adafruit_GFX : public Print {
7070
uint8_t getRotation(void);
7171

7272
protected:
73+
const int16_t
74+
WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes
7375
int16_t
74-
WIDTH, HEIGHT, // This is the 'raw' display w/h - never changes
7576
_width, _height, // Display w/h as modified by current rotation
7677
cursor_x, cursor_y;
7778
uint16_t

0 commit comments

Comments
 (0)