forked from SharpCoder/rpi-kernel
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgpu2d.h
More file actions
executable file
·63 lines (53 loc) · 1.31 KB
/
Copy pathgpu2d.h
File metadata and controls
executable file
·63 lines (53 loc) · 1.31 KB
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
// *******************************
// FILE: gpu2d.h
// AUTHOR: SharpCoder
// DATE: 2012-03-27
// ABOUT: This is the 2D graphics engine (re written) for my
// raspberry pi kernel. I'm trying to implement some
// nicer functions and a backbuffer to make everything
// smoother.
//
// LICENSE: Provided "AS IS". USE AT YOUR OWN RISK.
// *******************************
#ifndef __GPU2D_H_
#define __GPU2D_H_
// Include the common library.
#include "common.h"
#include "raspberrylib.h"
#include "mem.h"
class FB_Info {
public:
uint32 screen_width;
uint32 screen_height;
uint32 virtual_width;
uint32 virtual_height;
uint32 pitch;
uint32 depth;
uint32 xoffset;
uint32 yoffset;
uint32 framePtr;
uint32 bufferSize;
};
// Define some of the basic functions
class gpu2dCanvas {
public:
// Constructor
gpu2dCanvas( void );
gpu2dCanvas( bool useDoubleBuffer );
// Basic methods.
void Draw( void );
void DrawLine( int x1, int y1, int x2, int y2, uint32 color );
void DrawCharacter( int x, int y, char c, uint32 color );
void ClearCharacter( int x, int y );
void Clear( uint32 color );
// Basic properties.
bool valid;
private:
bool switched;
bool enableDoubleBuffer;
FB_Info* fbInfo;
bool initFrameBuffer( void );
void sync( void );
void setPixel( uint32 x, uint32 y, uint32 color );
};
#endif