From 5e8cdc8ceaa5269621963b2117889f72650482f4 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 8 Apr 2018 14:50:37 +0800 Subject: [PATCH] add pixel type --- src/newgal/commlcd/commlcd.c | 14 +++++++++++++- src/newgal/commlcd/commlcd.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/newgal/commlcd/commlcd.c b/src/newgal/commlcd/commlcd.c index b37167f4..4b39e2b1 100644 --- a/src/newgal/commlcd/commlcd.c +++ b/src/newgal/commlcd/commlcd.c @@ -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 (); diff --git a/src/newgal/commlcd/commlcd.h b/src/newgal/commlcd/commlcd.h index 1ad019fb..83870060 100644 --- a/src/newgal/commlcd/commlcd.h +++ b/src/newgal/commlcd/commlcd.h @@ -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)