Make WIDTH & HEIGHT const
@@ -39,9 +39,11 @@ POSSIBILITY OF SUCH DAMAGE.
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif
-Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h) {
- _width = WIDTH = w;
- _height = HEIGHT = h;
+Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h):
+ WIDTH(w), HEIGHT(h)
+{
+ _width = WIDTH;
+ _height = HEIGHT;
rotation = 0;
cursor_y = cursor_x = 0;
textsize = 1;
@@ -70,8 +70,9 @@ class Adafruit_GFX : public Print {
uint8_t getRotation(void);
protected:
+ const int16_t
+ WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes
int16_t
- WIDTH, HEIGHT, // This is the 'raw' display w/h - never changes
_width, _height, // Display w/h as modified by current rotation
cursor_x, cursor_y;
uint16_t