summaryrefslogtreecommitdiff
path: root/glcddrivers/driver.c
blob: 056f8bc94d0add20e1f01681f12ab321c72cce12 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * 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-2010 Andreas Regel <andreas.regel AT powarman.de>
 * (c) 2010-2011 Wolfgang Astleitner <mrwastl AT users sourceforge net>
 */

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


namespace GLCD
{

cSimpleTouchEvent::cSimpleTouchEvent() : x(0), y(0), touch(0)
{
}

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

//void cDriver::SetScreen(const unsigned char * data, int wid, int hgt, int lineSize)
void cDriver::SetScreen(const uint32_t * data, int wid, int hgt)
{
    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; x++)
          {
//            printf("%s:%s(%d) - %03d * %03d (linesize %02d), %08x\n", __FILE__, __FUNCTION__, __LINE__, x, y, lineSize, data[y * lineSize + x]);
            SetPixel(x, y, data[y * wid + x]);
          }
        }
    }
/*
            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