A first port of the excellent Adafruit GFX library

Dependents:   Adafruit_GFX

Files at this revision

API Documentation at this revision

Comitter:
SomeRandomBloke
Date:
Wed Aug 19 06:58:32 2015 +0000
Parent:
2:a7d4ac7ed08a
Commit message:
commit

Changed in this revision

Adafruit_GFX.cpp Show annotated file Show diff for this revision Revisions of this file
Adafruit_GFX.h Show annotated file Show diff for this revision Revisions of this file
diff -r a7d4ac7ed08a -r 83bcb23eed69 Adafruit_GFX.cpp
--- a/Adafruit_GFX.cpp	Fri Jul 17 09:37:26 2015 +0000
+++ b/Adafruit_GFX.cpp	Wed Aug 19 06:58:32 2015 +0000
@@ -163,13 +163,13 @@
                 uint16_t color) {
   int16_t steep = abs(y1 - y0) > abs(x1 - x0);
   if (steep) {
-    swap(x0, y0);
-    swap(x1, y1);
+    aswap(x0, y0);
+    aswap(x1, y1);
   }
 
   if (x0 > x1) {
-    swap(x0, x1);
-    swap(y0, y1);
+    aswap(x0, x1);
+    aswap(y0, y1);
   }
 
   int16_t dx, dy;
@@ -280,13 +280,13 @@
 
   // Sort coordinates by Y order (y2 >= y1 >= y0)
   if (y0 > y1) {
-    swap(y0, y1); swap(x0, x1);
+    aswap(y0, y1); aswap(x0, x1);
   }
   if (y1 > y2) {
-    swap(y2, y1); swap(x2, x1);
+    aswap(y2, y1); aswap(x2, x1);
   }
   if (y0 > y1) {
-    swap(y0, y1); swap(x0, x1);
+    aswap(y0, y1); aswap(x0, x1);
   }
 
   if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing
@@ -327,7 +327,7 @@
     a = x0 + (x1 - x0) * (y - y0) / (y1 - y0);
     b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
     */
-    if(a > b) swap(a,b);
+    if(a > b) aswap(a,b);
     drawFastHLine(a, y, b-a+1, color);
   }
 
@@ -344,7 +344,7 @@
     a = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
     b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
     */
-    if(a > b) swap(a,b);
+    if(a > b) aswap(a,b);
     drawFastHLine(a, y, b-a+1, color);
   }
 }
diff -r a7d4ac7ed08a -r 83bcb23eed69 Adafruit_GFX.h
--- a/Adafruit_GFX.h	Fri Jul 17 09:37:26 2015 +0000
+++ b/Adafruit_GFX.h	Wed Aug 19 06:58:32 2015 +0000
@@ -38,7 +38,7 @@
 #include "Stream.h"
 
 
-#define swap(a, b) { int16_t t = a; a = b; b = t; }
+#define aswap(a, b) { int16_t t = a; a = b; b = t; }
 #define boolean bool
 
 class Adafruit_GFX : public Stream