N5110 library

Fork of N5110 by Craig Evans

Revision:
27:0d8d90936b4c
Parent:
26:36be85c20ef4
Child:
28:4091516537e4
Child:
30:11986573659e
diff -r 36be85c20ef4 -r 0d8d90936b4c N5110.cpp
--- a/N5110.cpp	Tue Feb 07 11:24:32 2017 +0000
+++ b/N5110.cpp	Tue Feb 07 21:50:25 2017 +0000
@@ -381,14 +381,14 @@
 void N5110::drawRect(int x0,int y0,int width,int height,int fill)
 {
     if (fill == 0) { // transparent, just outline
-        drawLine(x0,y0,x0+width,y0,1);  // top
-        drawLine(x0,y0+height,x0+width,y0+height,1);  // bottom
-        drawLine(x0,y0,x0,y0+height,1);  // left
-        drawLine(x0+width,y0,x0+width,y0+height,1);  // right
+        drawLine(x0,y0,x0+(width-1),y0,1);  // top
+        drawLine(x0,y0+(height-1),x0+(width-1),y0+(height-1),1);  // bottom
+        drawLine(x0,y0,x0,y0+(height-1),1);  // left
+        drawLine(x0+(width-1),y0,x0+(width-1),y0+(height-1),1);  // right
     } else { // filled rectangle
         int type = (fill==1) ? 1:0;  // black or white fill
-        for (int y = y0; y<= y0+height; y++) {  // loop through rows of rectangle
-            drawLine(x0,y,x0+width,y,type);  // draw line across screen
+        for (int y = y0; y<y0+height; y++) {  // loop through rows of rectangle
+            drawLine(x0,y,x0+(width-1),y,type);  // draw line across screen
         }
     }
 }