From e65f4cb1feffc5471c313b66ffcdda9ff2b151d3 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Thu, 13 Apr 2017 00:20:19 +0100 Subject: [PATCH] Rename swap() to avoid clashes Increment version --- TFT_eSPI.cpp | 26 +++++++++++++------------- TFT_eSPI.h | 2 +- library.json | 2 +- library.properties | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index fd4ae3c..d216566 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -916,13 +916,13 @@ void TFT_eSPI::fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, in // Sort coordinates by Y order (y2 >= y1 >= y0) if (y0 > y1) { - swap(y0, y1); swap(x0, x1); + swap_coord(y0, y1); swap_coord(x0, x1); } if (y1 > y2) { - swap(y2, y1); swap(x2, x1); + swap_coord(y2, y1); swap_coord(x2, x1); } if (y0 > y1) { - swap(y0, y1); swap(x0, x1); + swap_coord(y0, y1); swap_coord(x0, x1); } if (y0 == y2) { // Handle awkward all-on-same-line case as its own thing @@ -960,7 +960,7 @@ void TFT_eSPI::fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, in sa += dx01; sb += dx02; - if (a > b) swap(a, b); + if (a > b) swap_coord(a, b); drawFastHLine(a, y, b - a + 1, color); } @@ -974,7 +974,7 @@ void TFT_eSPI::fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, in sa += dx12; sb += dx02; - if (a > b) swap(a, b); + if (a > b) swap_coord(a, b); drawFastHLine(a, y, b - a + 1, color); } } @@ -2309,13 +2309,13 @@ void TFT_eSPI::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t boolean steep = abs(y1 - y0) > abs(x1 - x0); if (steep) { - swap(x0, y0); - swap(x1, y1); + swap_coord(x0, y0); + swap_coord(x1, y1); } if (x0 > x1) { - swap(x0, x1); - swap(y0, y1); + swap_coord(x0, x1); + swap_coord(y0, y1); } int32_t dx = x1 - x0, dy = abs(y1 - y0);; @@ -2364,13 +2364,13 @@ void TFT_eSPI::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t boolean steep = abs(y1 - y0) > abs(x1 - x0); if (steep) { - swap(x0, y0); - swap(x1, y1); + swap_coord(x0, y0); + swap_coord(x1, y1); } if (x0 > x1) { - swap(x0, x1); - swap(y0, y1); + swap_coord(x0, x1); + swap_coord(y0, y1); } if (x1 < 0) return; diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 508c4e4..8b8bfaa 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -213,7 +213,7 @@ // Swap any type template static inline void -swap(T& a, T& b) { T t = a; a = b; b = t; } +swap_coord(T& a, T& b) { T t = a; a = b; b = t; } // This is a structure to conveniently hold infomation on the default fonts // Stores pointer to font character image address table, width table and height diff --git a/library.json b/library.json index 256a00f..c7571e5 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "0.16.0", + "version": "0.16.1", "keywords": "ILI9341, ST7735, ESP8266, TFT", "description": "A TFT SPI graphics library for ESP8266", "repository": diff --git a/library.properties b/library.properties index 1409a39..1fb66a1 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=0.16 +version=0.16.1 author=Bodmer maintainer=Bodmer sentence=A fast TFT library for ESP8266 processors and the Arduino IDE