1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/graphlcd-base/glcddrivers/driver.c Wed Feb 06 17:32:55 2008 +0000
1.3 @@ -0,0 +1,54 @@
1.4 +/*
1.5 + * GraphLCD driver library
1.6 + *
1.7 + * driver.c - driver base class
1.8 + *
1.9 + * parts were taken from graphlcd plugin for the Video Disc Recorder
1.10 + * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de>
1.11 + *
1.12 + * This file is released under the GNU General Public License. Refer
1.13 + * to the COPYING file distributed with this package.
1.14 + *
1.15 + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de>
1.16 + */
1.17 +
1.18 +#include "common.h"
1.19 +#include "driver.h"
1.20 +
1.21 +
1.22 +namespace GLCD
1.23 +{
1.24 +
1.25 +cDriver::cDriver()
1.26 +: width(0),
1.27 + height(0)
1.28 +{
1.29 +}
1.30 +
1.31 +void cDriver::SetScreen(const unsigned char * data, int wid, int hgt, int lineSize)
1.32 +{
1.33 + int x, y;
1.34 +
1.35 + if (wid > width)
1.36 + wid = width;
1.37 + if (hgt > height)
1.38 + hgt = height;
1.39 +
1.40 + Clear();
1.41 + if (data)
1.42 + {
1.43 + for (y = 0; y < hgt; y++)
1.44 + {
1.45 + for (x = 0; x < (wid / 8); x++)
1.46 + {
1.47 + Set8Pixels(x * 8, y, data[y * lineSize + x]);
1.48 + }
1.49 + if (width % 8)
1.50 + {
1.51 + Set8Pixels((wid / 8) * 8, y, data[y * lineSize + wid / 8] & bitmaskl[wid % 8 - 1]);
1.52 + }
1.53 + }
1.54 + }
1.55 +}
1.56 +
1.57 +} // end of namespace