summaryrefslogtreecommitdiff
path: root/glcddrivers/image.c
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2011-05-01 22:22:32 +0200
committermrwastl <mrwastl@users.sourceforge.net>2011-05-01 22:22:32 +0200
commit46e597df44402086edd010b69702c2de52b75fc8 (patch)
treefa9528f19f951b765b071c239b09547cf69bd169 /glcddrivers/image.c
parent57729cf285b058d192a60bd7fce1b2d29bdd9650 (diff)
downloadgraphlcd-base-46e597df44402086edd010b69702c2de52b75fc8.tar.gz
graphlcd-base-46e597df44402086edd010b69702c2de52b75fc8.tar.bz2
initial upload to branch 'touchcol'. see file 'HISTORY' for changes
Diffstat (limited to 'glcddrivers/image.c')
-rw-r--r--glcddrivers/image.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/glcddrivers/image.c b/glcddrivers/image.c
index 9c71006..94623c4 100644
--- a/glcddrivers/image.c
+++ b/glcddrivers/image.c
@@ -7,7 +7,9 @@
* This file is released under the GNU General Public License. Refer
* to the COPYING file distributed with this package.
*
- * (c) 2004 Andreas Regel <andreas.regel AT powarman.de>
+ * (c) 2004-2010 Andreas Regel <andreas.regel AT powarman.de>
+ * (c) 2010-2011 Wolfgang Astleitner <mrwastl AT users sourceforge net>
+ Andreas 'randy' Weinberger
*/
#include <stdio.h>
@@ -50,12 +52,13 @@ int cDriverImage::Init()
}
}
- newLCD = new unsigned char[lineSize * height];
+// newLCD = new unsigned char[lineSize * height];
+ newLCD = new uint32_t[width * height];
if (newLCD)
- memset(newLCD, 0, lineSize * height);
- oldLCD = new unsigned char[lineSize * height];
+ memset(newLCD, 0, width * height);
+ oldLCD = new uint32_t[width * height];
if (oldLCD)
- memset(oldLCD, 0, lineSize * height);
+ memset(oldLCD, 0, width * height);
counter = 0;
@@ -121,6 +124,29 @@ void cDriverImage::Set8Pixels(int x, int y, unsigned char data)
}
}
+void cDriverImage::SetPixel(int x, int y, uint32_t data)
+{
+ if (x >= width || y >= height)
+ return;
+
+ if ((data | 0xFF000000) != cColor::Black) {
+ data = cColor::White;
+ }
+
+ if (!config->upsideDown)
+ {
+ // normal orientation
+ newLCD[y * x] |= data;
+ }
+ else
+ {
+ // upside down orientation
+ x = width - 1 - x;
+ y = height - 1 - y;
+ newLCD[y * x] |= ReverseBits(data);
+ }
+}
+
void cDriverImage::Refresh(bool refreshAll)
{
int i;