add pixel type

This commit is contained in:
Vincent Wei
2018-04-08 14:50:37 +08:00
parent 1527a164da
commit 5e8cdc8cea
2 changed files with 16 additions and 1 deletions

View File

@@ -213,8 +213,20 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current,
memset (li.fb, 0, li.rlen * height);
Uint32 Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0;
if (li.type == COMMLCD_TRUE_BGR565) {
Bmask = 0xF800;
Gmask = 0x07E0;
Rmask = 0x001F;
}
else if (li.type == COMMLCD_TRUE_BGR888) {
Bmask = 0xFF0000;
Gmask = 0x00FF00;
Rmask = 0x0000FF;
}
/* Allocate the new pixel format for the screen */
if (!GAL_ReallocFormat (current, li.bpp, 0, 0, 0, 0)) {
if (!GAL_ReallocFormat (current, li.bpp, Rmask, Gmask, Bmask, Amask)) {
if (__mg_commlcd_ops.release)
__mg_commlcd_ops.release ();

View File

@@ -64,6 +64,9 @@ struct GAL_PrivateVideoData {
#define COMMLCD_TRUE_RGB888 4
#define COMMLCD_TRUE_RGB0888 5
#define COMMLCD_TRUE_BGR565 6
#define COMMLCD_TRUE_BGR888 7
struct commlcd_info {
short height, width; // Size of the screen
short bpp; // Depth (bits-per-pixel)