diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-06-25 21:52:54 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-06-25 21:52:54 +0200 |
commit | 82d929736a6188583fe3283b8fa2ce776f3cca21 (patch) | |
tree | 1a894c5a603415086db3e3cdbb9b8d15fabc94a5 /glcddrivers/network.c | |
parent | d7b7ae09a995d8ceab70a9d7904a7b9e25beba00 (diff) | |
download | graphlcd-base-82d929736a6188583fe3283b8fa2ce776f3cca21.tar.gz graphlcd-base-82d929736a6188583fe3283b8fa2ce776f3cca21.tar.bz2 |
adapt all drivers to support SetPixel() with 32bit colours; Set8Pixels() is no longer virtual (generic implementation in base class)
Diffstat (limited to 'glcddrivers/network.c')
-rw-r--r-- | glcddrivers/network.c | 26 |
1 files changed, 25 insertions, 1 deletions
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 <andreas.regel AT powarman.de> + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <stdio.h> @@ -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) { |