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/image.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/image.c')
-rw-r--r-- | glcddrivers/image.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/glcddrivers/image.c b/glcddrivers/image.c index 94623c4..4ca3937 100644 --- a/glcddrivers/image.c +++ b/glcddrivers/image.c @@ -105,6 +105,7 @@ void cDriverImage::Clear() memset(newLCD, 0, lineSize * height); } +#if 0 void cDriverImage::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -123,28 +124,25 @@ void cDriverImage::Set8Pixels(int x, int y, unsigned char data) newLCD[lineSize * y + x / 8] |= ReverseBits(data); } } +#endif 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 + int pos = x % 8; + if (config->upsideDown) { - // upside down orientation x = width - 1 - x; y = height - 1 - y; - newLCD[y * x] |= ReverseBits(data); + pos = 7 - pos; // reverse bit position } + + if (data == GLCD::cColor::White) + newLCD[y * x] |= ( 1 << pos ); + else + newLCD[y * x] &= ( 0xFF ^ ( 1 << pos) ); } void cDriverImage::Refresh(bool refreshAll) |