kassoulet / dose2

a fork of the mfx's dose2 demo

This URL has Read+Write access

dose2 / lfb.h
100644 22 lines (18 sloc) 0.594 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* linear flat frame buffer definition and some accessories
*
*/
#ifndef libya_lfb_h_included
#define libya_lfb_h_included
 
typedef struct _Lfb Lfb;
struct _Lfb {
  char *buf;
  int width, height, pitch, depth;
};
 
#define lfbrow4(l, y) ((unsigned*)((l)->buf+(y)*(l)->pitch))
#define lfbrow2(l, y) ((unsigned short*)((l)->buf+(y)*(l)->pitch))
#define lfbrow1(l, y) ((unsigned char*)((l)->buf+(y)*(l)->pitch))
#define lfbpix4(l, x, y) (lfbrow4((l), (y))[(x)])
#define lfbpix2(l, x, y) (lfbrow2((l), (y))[(x)])
#define lfbpix1(l, x, y) (lfbrow1((l), (y))[(x)])
 
#endif