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/framebuffer.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/framebuffer.c')
-rw-r--r-- | glcddrivers/framebuffer.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/glcddrivers/framebuffer.c b/glcddrivers/framebuffer.c index 10ed9fd..440af89 100644 --- a/glcddrivers/framebuffer.c +++ b/glcddrivers/framebuffer.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 Stephan Skrodzki + * (c) 2004 Stephan Skrodzki + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <fcntl.h> @@ -164,17 +165,19 @@ void cDriverFramebuffer::SetPixel(int x, int y, uint32_t data) y = height - 1 - y; } + // Figure out where in memory to put the pixel location = (x*(1+zoom)+vinfo.xoffset) * (vinfo.bits_per_pixel/8) + (y*(1+zoom)+vinfo.yoffset) * finfo.line_length; - if (vinfo.bits_per_pixel <= 8) - { - outcol = 15; - } - else - { - outcol = 255; + if (data == GLCD::cColor::White) { + if (vinfo.bits_per_pixel <= 8) { + outcol = 15; + } else { + outcol = 255; + } + } else { + outcol = 0; } if (vinfo.bits_per_pixel <= 8) @@ -230,6 +233,7 @@ void cDriverFramebuffer::Clear() memset(offbuff, 0, screensize); } +#if 0 void cDriverFramebuffer::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -242,6 +246,7 @@ void cDriverFramebuffer::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverFramebuffer::Refresh(bool refreshAll) { |