1 /*
2  * libtilemcore - Graphing calculator emulation library
3  *
4  * Copyright (C) 2010-2011 Benjamin Moody
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _TILEM_GRAYLCD_H
22 #define _TILEM_GRAYLCD_H
23 
24 typedef struct _TilemGrayLCDPixel {
25 	word ndark;		/* Sum of lengths of dark intervals */
26 	word nlight;		/* Sum of lengths of light intervals */
27 	word ndarkseg;		/* Number of dark intervals */
28 	word nlightseg;		/* Number of light intervals */
29 } TilemGrayLCDPixel;
30 
31 struct _TilemGrayLCD {
32 	TilemCalc *calc;	/* Calculator */
33 	int timer_id;		/* Screen update timer */
34 	dword lcdupdatetime;	/* CPU time of last known LCD update */
35 
36 	dword t;		/* Time counter */
37 	int windowsize;		/* Number of frames in the sampling
38 				   window */
39 	int framenum;		/* Current frame number */
40 	int sampleint;		/* Microseconds per sample */
41 
42 	int bwidth;		/* Width of LCD, bytes */
43 	int height;		/* Height of LCD, pixels */
44 	byte *oldbits;		/* Original pixel values (current buffer) */
45 	byte *newbits;		/* Original pixel values (alternate buffer) */
46 
47 	dword *tchange;		/* Time when pixels changed */
48 	dword *tframestart;	/* Time at start of frame */
49 	dword *framestamp;	/* LCD update time at start of frame */
50 
51 	TilemGrayLCDPixel *curpixels; /* Current pixel counters */
52 	TilemGrayLCDPixel *framebasepixels; /* Pixel counters as of
53 					       the start of each
54 					       frame */
55 };
56 
57 #endif
58