From 82d929736a6188583fe3283b8fa2ce776f3cca21 Mon Sep 17 00:00:00 2001 From: mrwastl Date: Sat, 25 Jun 2011 21:52:54 +0200 Subject: adapt all drivers to support SetPixel() with 32bit colours; Set8Pixels() is no longer virtual (generic implementation in base class) --- glcddrivers/network.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'glcddrivers/network.c') diff --git a/glcddrivers/network.c b/glcddrivers/network.c index 485f8ea..367962b 100644 --- a/glcddrivers/network.c +++ b/glcddrivers/network.c @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas Regel + * (c) 2004 Andreas Regel + * (c) 2011 Wolfgang Astleitner */ #include @@ -122,6 +123,28 @@ void cDriverNetwork::Clear() memset(newLCD, 0, lineSize * height); } + +void cDriverNetwork::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::White) + newLCD[lineSize * y + x / 8] |= (1 << pos); + else + newLCD[lineSize * y + x / 8] &= ( 0xFF ^ (1 << pos) ); +} + + +#if 0 void cDriverNetwork::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -140,6 +163,7 @@ void cDriverNetwork::Set8Pixels(int x, int y, unsigned char data) newLCD[lineSize * y + x / 8] |= ReverseBits(data); } } +#endif void cDriverNetwork::Refresh(bool refreshAll) { -- cgit v1.2.3