From f5ec45e42b7216ca3fa34eb08ec052071d672422 Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Tue, 26 Jan 2016 10:37:56 -0800 Subject: [PATCH] adagfxswap() renamed and localized to .cpp file to avoid collisions --- Adafruit_GFX.cpp | 22 +++++++++++++--------- Adafruit_GFX.h | 6 ------ library.properties | 2 +- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Adafruit_GFX.cpp b/Adafruit_GFX.cpp index 4d376164..659663e3 100755 --- a/Adafruit_GFX.cpp +++ b/Adafruit_GFX.cpp @@ -49,6 +49,10 @@ POSSIBILITY OF SUCH DAMAGE. #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif +#ifndef _swap_int16_t +#define _swap_int16_t(a, b) { int16_t t = a; a = b; b = t; } +#endif + Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h): WIDTH(w), HEIGHT(h) { @@ -176,13 +180,13 @@ void Adafruit_GFX::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { int16_t steep = abs(y1 - y0) > abs(x1 - x0); if (steep) { - adagfxswap(x0, y0); - adagfxswap(x1, y1); + _swap_int16_t(x0, y0); + _swap_int16_t(x1, y1); } if (x0 > x1) { - adagfxswap(x0, x1); - adagfxswap(y0, y1); + _swap_int16_t(x0, x1); + _swap_int16_t(y0, y1); } int16_t dx, dy; @@ -287,13 +291,13 @@ void Adafruit_GFX::fillTriangle(int16_t x0, int16_t y0, // Sort coordinates by Y order (y2 >= y1 >= y0) if (y0 > y1) { - adagfxswap(y0, y1); adagfxswap(x0, x1); + _swap_int16_t(y0, y1); _swap_int16_t(x0, x1); } if (y1 > y2) { - adagfxswap(y2, y1); adagfxswap(x2, x1); + _swap_int16_t(y2, y1); _swap_int16_t(x2, x1); } if (y0 > y1) { - adagfxswap(y0, y1); adagfxswap(x0, x1); + _swap_int16_t(y0, y1); _swap_int16_t(x0, x1); } if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing @@ -335,7 +339,7 @@ void Adafruit_GFX::fillTriangle(int16_t x0, int16_t y0, a = x0 + (x1 - x0) * (y - y0) / (y1 - y0); b = x0 + (x2 - x0) * (y - y0) / (y2 - y0); */ - if(a > b) adagfxswap(a,b); + if(a > b) _swap_int16_t(a,b); drawFastHLine(a, y, b-a+1, color); } @@ -352,7 +356,7 @@ void Adafruit_GFX::fillTriangle(int16_t x0, int16_t y0, a = x1 + (x2 - x1) * (y - y1) / (y2 - y1); b = x0 + (x2 - x0) * (y - y0) / (y2 - y0); */ - if(a > b) adagfxswap(a,b); + if(a > b) _swap_int16_t(a,b); drawFastHLine(a, y, b-a+1, color); } } diff --git a/Adafruit_GFX.h b/Adafruit_GFX.h index 829ad791..af428db6 100644 --- a/Adafruit_GFX.h +++ b/Adafruit_GFX.h @@ -10,12 +10,6 @@ #include "gfxfont.h" -#define adagfxswap(a, b) { int16_t t = a; a = b; b = t; } - -#if !defined(ESP8266) - #define swap(a, b) adagfxswap(a, b) -#endif - class Adafruit_GFX : public Print { public: diff --git a/library.properties b/library.properties index c26246cc..c109d3e6 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.1.3 +version=1.1.4 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.