summaryrefslogtreecommitdiff
path: root/glcddrivers/driver.c
blob: b1b62868a9fd2f93bc8baa000d4265f50b7dc5f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * GraphLCD driver library
 *
 * driver.c  -  driver base class
 *
 * parts were taken from graphlcd plugin for the Video Disc Recorder
 * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de>
 *
 * 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>
 */

#include "common.h"
#include "driver.h"


namespace GLCD
{

cDriver::cDriver()
:   width(0),
    height(0)
{
}

void cDriver::SetScreen(const unsigned char * data, int wid, int hgt, int lineSize)
{
    int x, y;

    if (wid > width)
        wid = width;
    if (hgt > height)
        hgt = height;

    Clear();
    if (data)
    {
        for (y = 0; y < hgt; y++)
        {
            for (x = 0; x < (wid / 8); x++)
            {
                Set8Pixels(x * 8, y, data[y * lineSize + x]);
            }
            if (width % 8)
            {
                Set8Pixels((wid / 8) * 8, y, data[y * lineSize + wid / 8] & bitmaskl[wid % 8 - 1]);
            }
        }
    }
}

} // end of namespace