Wim Huiskamp / SPI_TFT_ILI9341

Fork of SPI_TFT_ILI9341 by Peter Drescher

Revision:
8:8593d3668153
Parent:
0:da1bf437cbc1
Child:
11:7aabc3810093
diff -r 4c30bea883bc -r 8593d3668153 GraphicsDisplay.cpp
--- a/GraphicsDisplay.cpp	Sun Jan 26 20:54:21 2014 +0000
+++ b/GraphicsDisplay.cpp	Wed Apr 02 19:20:09 2014 +0000
@@ -113,7 +113,7 @@
     blitbit(column * 8, row * 8, 8, 8, (char*)&(FONT8x8[value - 0x1F][0]));
 }
 
-void GraphicsDisplay::window(unsigned int x,unsigned  int y,unsigned  int w,unsigned  int h) {
+void GraphicsDisplay::window(unsigned int x, unsigned int y, unsigned int w, unsigned  int h) {
     // current pixel location
     _x = x;
     _y = y;
@@ -139,8 +139,10 @@
 }
 
 void GraphicsDisplay::fill(int x, int y, int w, int h, int colour) { 
+    int pixels = w*h;
+    
     window(x, y, w, h);
-    for(int i=0; i<w*h; i++) {
+    for(int i=0; i<pixels; i++) {
         putp(colour);
     }
 }
@@ -150,15 +152,19 @@
 }
     
 void GraphicsDisplay::blit(int x, int y, int w, int h, const int *colour) { 
+    int pixels = w*h;
+    
     window(x, y, w, h);
-    for(int i=0; i<w*h; i++) {
+    for(int i=0; i<pixels; i++) {
         putp(colour[i]);
     }
 }
     
 void GraphicsDisplay::blitbit(int x, int y, int w, int h, const char* colour) {
+    int pixels = w*h;
+        
     window(x, y, w, h);
-    for(int i = 0; i < w*h; i++) {
+    for(int i = 0; i < pixels; i++) {
         char byte = colour[i >> 3];
         int offset = i & 0x7;
         int c = ((byte << offset) & 0x80) ? _foreground : _background;