From 736a532b1a6eeaa34ad3b0664c1761fcf9e53e4e Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 7 Apr 2019 17:16:53 +0800 Subject: [PATCH] use standard pixel format for alpha_pixel_format --- include/exstubs.h | 41 ++++++++++++++++------------------------- src/newgal/pixels.c | 1 + src/newgdi/attr.c | 24 ++++++++++++------------ 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/include/exstubs.h b/include/exstubs.h index c569e731..13bc0133 100644 --- a/include/exstubs.h +++ b/include/exstubs.h @@ -50,10 +50,6 @@ #ifndef GUI_EXSTUBS_H #define GUI_EXSTUBS_H -/* external stubs for COMMLCD NEWGAL engine */ - -#ifdef _MGGAL_COMMLCD - /* The pixel format defined by depth */ #define COMMLCD_PSEUDO_RGB332 1 #define COMMLCD_TRUE_RGB555 2 @@ -78,25 +74,6 @@ struct commlcd_info { Uint8* fb; // Frame buffer }; -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -int __commlcd_drv_init (void); -int __commlcd_drv_getinfo (struct commlcd_info *li, - int width, int height, int depth); -int __commlcd_drv_release (void); -int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors); -int __commlcd_drv_update (const RECT* rc_dirty); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _MGGAL_COMMLCD */ - -#ifdef _MGIAL_COMM - #define COMM_MOUSEINPUT 0x01 #define COMM_KBINPUT 0x02 @@ -107,17 +84,31 @@ int __commlcd_drv_update (const RECT* rc_dirty); extern "C" { #endif /* __cplusplus */ +/* external stubs for COMMLCD NEWGAL engine */ +#ifdef _MGGAL_COMMLCD + +int __commlcd_drv_init (void); +int __commlcd_drv_getinfo (struct commlcd_info *li, + int width, int height, int depth); +int __commlcd_drv_release (void); +int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors); +int __commlcd_drv_update (const RECT* rc_dirty); + +#endif /* _MGGAL_COMMLCD */ + +#ifdef _MGIAL_COMM + int __comminput_init (void); int __comminput_ts_getdata (short *x, short *y, short *button); int __comminput_kb_getdata (short *key, short *status); int __comminput_wait_for_input (struct timeval *timeout); void __comminput_deinit (void); +#endif /* _MGIAL_COMM */ + #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* _MGIAL_COMM */ - #endif /* GUI_EXSTUBS_H */ diff --git a/src/newgal/pixels.c b/src/newgal/pixels.c index d66af920..50c66a74 100644 --- a/src/newgal/pixels.c +++ b/src/newgal/pixels.c @@ -240,6 +240,7 @@ GAL_PixelFormat *GAL_AllocFormat(int bpp, } return(format); } + GAL_PixelFormat *GAL_ReallocFormat(GAL_Surface *surface, int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) { diff --git a/src/newgdi/attr.c b/src/newgdi/attr.c index b101521c..384e63e3 100644 --- a/src/newgdi/attr.c +++ b/src/newgdi/attr.c @@ -75,22 +75,22 @@ static int make_alpha_pixel_format (PDC pdc) if (pdc->alpha_pixel_format == NULL) { switch (pdc->surface->format->BytesPerPixel) { case 2: - Rmask = 0x0000F000; - Gmask = 0x00000F00; - Bmask = 0x000000F0; - Amask = 0x0000000F; + Amask = 0x0000F000; + Rmask = 0x00000F00; + Gmask = 0x000000F0; + Bmask = 0x0000000F; break; case 3: - Rmask = 0x00FC0000; - Gmask = 0x0003F000; - Bmask = 0x00000FC0; - Amask = 0x0000003F; + Amask = 0x00FC0000; + Rmask = 0x0003F000; + Gmask = 0x00000FC0; + Bmask = 0x0000003F; break; case 4: - Rmask = 0xFF000000; - Gmask = 0x00FF0000; - Bmask = 0x0000FF00; - Amask = 0x000000FF; + Amask = 0xFF000000; + Rmask = 0x00FF0000; + Gmask = 0x0000FF00; + Bmask = 0x000000FF; break; default: return -1;