From 268695a94b64f4d0f438b289de81971c86f69d92 Mon Sep 17 00:00:00 2001 From: gengyue Date: Wed, 24 Apr 2019 19:56:20 +0800 Subject: [PATCH] modified for rtems --- configure.ac | 14 +++++++-- include/common.h | 2 +- include/minigui.h | 20 +++++++++---- src/control/edit.c | 2 ++ src/control/newtoolbar.c | 2 ++ src/font/freetype1.c | 10 +++---- src/font/freetype2.c | 10 +++---- src/font/qpf.c | 2 +- src/font/rawbitmap.c | 2 +- src/font/scripteasy.c | 2 +- src/font/upf.c | 2 +- src/font/varbitmap.c | 9 +++--- src/gui/menu.c | 2 +- src/ial/dummy.c | 56 +++++++++++++++++++----------------- src/ial/netial/netial.c | 8 +++--- src/include/devfont.h | 4 +-- src/kernel/timer.c | 9 +++--- src/misc/nposix.c | 2 +- src/mybmp/gif.c | 2 ++ src/newgal/commlcd/commlcd.c | 13 +++++++-- src/newgal/commlcd/commlcd.h | 1 + src/newgal/commlcd/extern.c | 2 +- src/newgal/pixels.c | 4 +-- src/newgal/surface.c | 8 +++++- src/newgal/video.c | 2 ++ src/sysres/mgetc.c | 8 ++++-- src/sysres/resmgr.c | 12 ++++++-- src/textedit/object.c | 4 +++ 28 files changed, 135 insertions(+), 79 deletions(-) diff --git a/configure.ac b/configure.ac index 00489796..e71aec9a 100644 --- a/configure.ac +++ b/configure.ac @@ -1404,12 +1404,18 @@ case "$with_libsuffix" in esac AC_ARG_WITH(osname, - [ --with-osname=linux/uclinux/ecos/ucos2/swlinux/vxworks/win32/darwin/threadx/cygwin/nucleus/ose/psos]) + [ --with-osname=linux/uclinux/ecos/ucos2/swlinux/vxworks/win32/darwin/threadx/cygwin/nucleus/ose/psos/rtems]) dnl configure.in file is used only for the following OSes: linux/uclinux/swlinux/ecos/darwin/cygwin dnl for other OSes, you should use makefile.ng or else. case "$with_osname" in + rtems) + AC_DEFINE(__RTEMS__, 1, + [Define if compile for rtems]) + AC_DEFINE(__NOUNIX__, 1, + [Define if compile for non-UNIX like OS]) + ;; uclinux) AC_DEFINE(__uClinux__, 1, [Define if compile for uClinux]) @@ -1510,7 +1516,7 @@ dnl esac AC_ARG_WITH(targetname, [ --with-targetname=unknown/customer/fmsoft/mstudio/stb810/vfanvil/vxi386/qvfb/fbcon/mx21/monaco/c33l05/bfin/vxppc/ - S3C6410/S3C2440/S3C2410/hi3560a Define the target board name]) + S3C6410/S3C2440/S3C2410/hi3560a/movidius Define the target board name]) case "$with_targetname" in fmsoft) @@ -1565,6 +1571,10 @@ case "$with_targetname" in hi3560a) CFLAGS="$CFLAGS -D_WITH_TARGET_HI3560A" ;; + movidius) + AC_DEFINE(__TARGET_MOVIDIUS__, 1, + [Define for Intel ma2150]) + ;; *) with_targetname="unknown" CFLAGS="$CFLAGS -D_WITH_TARGET_NONE" diff --git a/include/common.h b/include/common.h index badbbcb2..71cccb17 100644 --- a/include/common.h +++ b/include/common.h @@ -1701,7 +1701,7 @@ typedef struct _GAL_Rect { #endif /* Commonly used definitions */ -#if !defined(__NOUNIX__) || defined (__ECOS__) +#if !defined(__NOUNIX__) || defined (__ECOS__) || defined (__RTEMS__) #include #endif diff --git a/include/minigui.h b/include/minigui.h index 3e0bcfe1..ab913a49 100644 --- a/include/minigui.h +++ b/include/minigui.h @@ -2734,8 +2734,9 @@ MG_EXPORT HCURSOR GUIAPI GetCurrentCursor (void); #define LoadCursorFromFile(filename) (do_nothing(), 0) #define CreateCursor(x, y, w, h, ANDbs, XORbs, cr) (do_nothing(), 0) #define DestroyCursor(hcsr) (do_nothing(), 0) - #define GetSystemCursor(csrid) (do_nothing(), 0) +// #define GetSystemCursor(csrid) (do_nothing(), 0) #define GetCurrentCursor() (do_nothing(), 0) +static inline HCURSOR GetSystemCursor(int csrid) { return (HCURSOR) 0;} #endif /* _MGHAVE_CURSOR */ #define MAX_SYSCURSORINDEX 22 @@ -2909,10 +2910,16 @@ MG_EXPORT void GUIAPI SetCursorPos (int x, int y); MG_EXPORT HCURSOR GUIAPI GetDefaultCursor (void); #else - #define SetCursorEx(hcsr, set_def) (do_nothing(), 0) - #define SetCursor(hcsr) (do_nothing(), 0) - #define SetDefaultCursor(hcsr) (do_nothing(), 0) - #define GetDefaultCursor() (do_nothing(), 0) +// #define SetCursorEx(hcsr, set_def) (do_nothing(), (HCURSOR)0) +// #define SetCursor(hcsr) (do_nothing(), (HCURSOR)0) +// #define SetDefaultCursor(hcsr) (do_nothing(), (HCURSOR)0) +// #define GetDefaultCursor() (do_nothing(), (HCURSOR)0) + +static inline HCURSOR SetCursorEx(HCURSOR hcsr, BOOL set_def) { return (HCURSOR) 0;} +static inline HCURSOR SetCursor(HCURSOR hcsr) { return (HCURSOR) 0;} +static inline HCURSOR SetDefaultCursor(HCURSOR hcsr) { return (HCURSOR) 0;} +static inline HCURSOR GetDefaultCursor(void) { return (HCURSOR) 0;} + #endif /* _MGHAVE_CURSOR */ #ifdef _MGHAVE_CURSOR @@ -2933,7 +2940,8 @@ MG_EXPORT HCURSOR GUIAPI GetDefaultCursor (void); */ MG_EXPORT int GUIAPI ShowCursor (BOOL fShow); #else - #define ShowCursor(fShow) (do_nothing(), 0) +// #define ShowCursor(fShow) (do_nothing(), (HCURSOR)0) +static inline int ShowCursor(BOOL fShow) {return 0;} #endif /* _MGHAVE_CURSOR */ /** @} end of cursor_fns */ diff --git a/src/control/edit.c b/src/control/edit.c index b8b27727..3baafb33 100644 --- a/src/control/edit.c +++ b/src/control/edit.c @@ -1893,7 +1893,9 @@ sledit_insert_text (HWND hWnd, PSLEDITDATA sled, const char* newtext, int len) return -1; if (dwStyle & ES_READONLY) + { return 0; + } tempstr = (char*) malloc(realen+1); diff --git a/src/control/newtoolbar.c b/src/control/newtoolbar.c index 5666ff36..f4b0daae 100644 --- a/src/control/newtoolbar.c +++ b/src/control/newtoolbar.c @@ -1266,7 +1266,9 @@ static void ShowCurItemHintText (HWND hWnd, NTBCTRLDATA *ntb_data , NTBITEM * pi return; if (pitem->tip[0] == '\0') + { return; + } x = pitem->rc_item.right; y = pitem->rc_item.bottom; diff --git a/src/font/freetype1.c b/src/font/freetype1.c index 7e3e1ae0..2fbf20fc 100644 --- a/src/font/freetype1.c +++ b/src/font/freetype1.c @@ -294,7 +294,7 @@ static void start_str_output (LOGFONT* logfont, DEVFONT* devfont) /* call this function before getting the bitmap/pixmap of the char * to get the bbox of the char */ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, + Glyph32 glyph_value, int* px, int* py, int* pwidth, int* pheight) { TT_UShort uni_char; @@ -440,7 +440,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont, /* call this function to get the bitmap/pixmap of the char */ static const void* char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, BOOL is_grey) + Glyph32 glyph_value, SIZE* sz, int* pitch, BOOL is_grey) { TT_Raster_Map Raster; TT_Error error; @@ -538,14 +538,14 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, } static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { if (scale) *scale = 1; return char_bitmap_pixmap (logfont, devfont, glyph_value, sz, pitch, FALSE); } static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { if (scale) *scale = 1; return char_bitmap_pixmap (logfont, devfont, glyph_value, sz, pitch, TRUE); @@ -554,7 +554,7 @@ static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont, /* call this function after getting the bitmap/pixmap of the char * to get the advance of the char */ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, int* px, int* py) + Glyph32 glyph_value, int* px, int* py) { TT_Pos vec_x, vec_y; TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont); diff --git a/src/font/freetype2.c b/src/font/freetype2.c index a05b5832..11f4cc38 100644 --- a/src/font/freetype2.c +++ b/src/font/freetype2.c @@ -324,7 +324,7 @@ load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face, * to get the bbox of the char */ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, + Glyph32 glyph_value, int* px, int* py, int* pwidth, int* pheight) { @@ -479,7 +479,7 @@ press_bitmap (void* buffer, int width, int rows, int pitch) /* call this function to get the bitmap/pixmap of the char */ static const void* char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, BOOL is_grey) + Glyph32 glyph_value, SIZE* sz, int* pitch, BOOL is_grey) { FT_BitmapGlyph glyph_bitmap; FT_Bitmap* source; @@ -616,14 +616,14 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { if (scale) *scale = 1; return char_bitmap_pixmap (logfont, devfont, glyph_value, sz, pitch, FALSE); } static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { if (scale) *scale = 1; @@ -648,7 +648,7 @@ start_str_output (LOGFONT* logfont, DEVFONT* devfont) * to get the advance of the char */ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, int* px, int* py) + Glyph32 glyph_value, int* px, int* py) { FT_Fixed advance; FTINSTANCEINFO* ft_inst_info = FT_INST_INFO_P (devfont); diff --git a/src/font/qpf.c b/src/font/qpf.c index 7da0c09d..139f8afc 100644 --- a/src/font/qpf.c +++ b/src/font/qpf.c @@ -329,7 +329,7 @@ static int get_font_descent (LOGFONT* logfont, DEVFONT* devfont) } static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { unsigned int uc16; QPF_GLYPH* glyph; diff --git a/src/font/rawbitmap.c b/src/font/rawbitmap.c index 1394df0a..f351d08a 100644 --- a/src/font/rawbitmap.c +++ b/src/font/rawbitmap.c @@ -208,7 +208,7 @@ static int get_font_descent (LOGFONT* logfont, DEVFONT* devfont) } static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { int bitmap_size; Glyph32 glyph_tmp = glyph_value; diff --git a/src/font/scripteasy.c b/src/font/scripteasy.c index 7989f1ab..35637a18 100644 --- a/src/font/scripteasy.c +++ b/src/font/scripteasy.c @@ -466,7 +466,7 @@ static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont, } static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, int* pitch, unsigned short* scale) + Glyph32 glyph_value, int* pitch, unsigned short* scale) { seunichar16 wc; SeLogFont selogfont; diff --git a/src/font/upf.c b/src/font/upf.c index 9ab83409..ceb711a1 100644 --- a/src/font/upf.c +++ b/src/font/upf.c @@ -279,7 +279,7 @@ print_bitmap(char* bits, int width, int height, int pitch) #endif static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { unsigned int uc16; UPFGLYPH* glyph; diff --git a/src/font/varbitmap.c b/src/font/varbitmap.c index b2440e11..3d814da7 100644 --- a/src/font/varbitmap.c +++ b/src/font/varbitmap.c @@ -237,10 +237,9 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont, } static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale) { int offset; - Glyph32 eff_value = glyph_value; Glyph32 first_value; Glyph32 last_value; VBFINFO* vbf_info = VARFONT_INFO_P (devfont); @@ -249,13 +248,13 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont, last_value = vbf_info->last_glyph; if (glyph_value < first_value || glyph_value > last_value) - eff_value = vbf_info->def_glyph; + glyph_value = vbf_info->def_glyph; if (vbf_info->bits_offset == NULL) offset = (((size_t)vbf_info->max_width + 7) >> 3) * vbf_info->height - * (eff_value - first_value); + * (glyph_value - first_value); else { - offset = vbf_info->bits_offset [eff_value - vbf_info->first_glyph]; + offset = vbf_info->bits_offset [glyph_value - vbf_info->first_glyph]; #if MGUI_BYTEORDER == MGUI_BIG_ENDIAN if (vbf_info->font_size) offset = ArchSwap16 (offset); diff --git a/src/gui/menu.c b/src/gui/menu.c index 8de23212..3e093088 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -4025,7 +4025,7 @@ int PopupMenuTrackProc (PTRACKMENUINFO ptmi, break; case MSG_SHOWMENU: - if (GetCurrentCursor() != GetSystemCursor(IDC_ARROW)) + if ((HCURSOR)GetCurrentCursor() != GetSystemCursor(IDC_ARROW)) SetCursor(GetSystemCursor(IDC_ARROW)); return mnuShowPopupMenu (ptmi); break; diff --git a/src/ial/dummy.c b/src/ial/dummy.c index 32cf891d..175c2170 100644 --- a/src/ial/dummy.c +++ b/src/ial/dummy.c @@ -1,39 +1,39 @@ /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** dummy.c: The dummy IAL engine. -** +** ** Created by Wei Yongming, 2001/09/13 */ @@ -53,9 +53,9 @@ static int mouse_x, mouse_y, mouse_button; typedef struct tagPOS { - short x; - short y; - short b; + short x; + short y; + short b; } POS; /************************ Low Level Input Operations **********************/ @@ -64,28 +64,28 @@ typedef struct tagPOS */ static int mouse_update(void) { - return 1; + return 1; } static void mouse_getxy (int* x, int* y) { - *x = mouse_x; + *x = mouse_x; *y = mouse_y; } static int mouse_getbutton(void) { - return mouse_button; + return mouse_button; } static int keyboard_update(void) { - return 0; + return 0; } static const char * keyboard_get_state (void) { - return NULL; + return NULL; } static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, @@ -93,23 +93,25 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex { #ifdef _MGRM_THREADS __mg_os_time_delay (300); + timeout->tv_sec = 0; + timeout->tv_usec = 0; #else - fd_set rfds; - int e; + fd_set rfds; + int e; if (!in) { in = &rfds; mg_fd_zero (in); } - e = mg_select (maxfd + 1, in, out, except, timeout) ; + e = mg_select (maxfd + 1, in, out, except, timeout) ; if (e < 0) { - return -1; - } + return -1; + } #endif - return 0; + return 0; } BOOL InitDummyInput (INPUT* input, const char* mdev, const char* mtype) @@ -125,9 +127,9 @@ BOOL InitDummyInput (INPUT* input, const char* mdev, const char* mtype) input->set_leds = NULL; input->wait_event = wait_event; - mouse_x = 0; - mouse_y = 0; - mouse_button= 0; + mouse_x = 0; + mouse_y = 0; + mouse_button= 0; return TRUE; } diff --git a/src/ial/netial/netial.c b/src/ial/netial/netial.c index 4bbe8eb8..730fb0dc 100644 --- a/src/ial/netial/netial.c +++ b/src/ial/netial/netial.c @@ -35,7 +35,7 @@ #include #include #include -#include +//#include #include #include @@ -46,10 +46,10 @@ #ifdef _MGIAL_NET #include -#include +//#include #include #include -#include +//#include #include #include @@ -216,7 +216,7 @@ BOOL InitNetInput (INPUT* input, const char* mdev, const char* mtype) } printf ("Please start the PC side of the client process.\n"); - temp_sock_descriptor = accept (sock_descriptor, (struct sockaddr *)&pin, &address_size); + temp_sock_descriptor = accept (sock_descriptor, (struct sockaddr *)&pin, (socklen_t *)&address_size); // gengyue if (temp_sock_descriptor == -1) { perror ("call to accept"); diff --git a/src/include/devfont.h b/src/include/devfont.h index 44cd8ba8..8bc94b3a 100644 --- a/src/include/devfont.h +++ b/src/include/devfont.h @@ -225,11 +225,11 @@ struct _FONTOPS /** The method to get mono-bitmap function. */ const void* (*get_glyph_monobitmap) (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale); + Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale); /** The method to get grey bitmap, pitch and scale function */ const void* (*get_glyph_greybitmap) (LOGFONT* logfont, DEVFONT* devfont, - const Glyph32 galph_value, SIZE* sz, int* pitch, unsigned short* scale); + Glyph32 galph_value, SIZE* sz, int* pitch, unsigned short* scale); /** The method to get the pre-rendered bitmap of one glyph. */ int (*get_glyph_prbitmap) (LOGFONT* logfont, DEVFONT* devfont, diff --git a/src/kernel/timer.c b/src/kernel/timer.c index 389e236d..608ab9c4 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -125,18 +125,18 @@ static OS_TIMER_ID __mg_os_timer = 0; #else /* __AOS__ */ static void* TimerEntry (void* data) { - sem_post ((sem_t*)data); + sem_post ((sem_t*)data); #ifdef _MG_USE_BETTER_TIMER g_timer_started = times(NULL); g_last_tick = 0; #endif /* _MG_USE_BETTER_TIMER */ - while (__mg_quiting_stage > _MG_QUITING_STAGE_TIMER) { + while (__mg_quiting_stage > _MG_QUITING_STAGE_TIMER) + { __mg_os_time_delay (10); __mg_timer_action (NULL); } - /* printf("quit from TimerEntry()\n"); */ return NULL; } @@ -155,8 +155,9 @@ int __mg_timer_init (void) OS_AUTO_ACTIVATE | OS_AUTO_LOAD); #else /* NOT __AOS__ */ { - sem_t wait; + sem_t wait; sem_init (&wait, 0, 0); + pthread_create (&__mg_timer, NULL, TimerEntry, &wait); sem_wait (&wait); sem_destroy (&wait); diff --git a/src/misc/nposix.c b/src/misc/nposix.c index 74c6c222..d4e0b70b 100644 --- a/src/misc/nposix.c +++ b/src/misc/nposix.c @@ -413,7 +413,7 @@ void __mg_os_time_delay (int ms) OSTimeDly (OS_TICKS_PER_SEC * ms / 1000); #elif defined (__VXWORKS__) taskDelay (sysClkRateGet() * ms / 1000); -#elif defined (__PSOS__) || defined (__ECOS__) +#elif defined (__PSOS__) || defined (__ECOS__) || defined (__RTEMS__) struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = ms * 1000000; diff --git a/src/mybmp/gif.c b/src/mybmp/gif.c index 904f3734..1e986211 100644 --- a/src/mybmp/gif.c +++ b/src/mybmp/gif.c @@ -539,7 +539,9 @@ ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height, else { /* emit line at here */ if (bmp->flags &= MYBMP_LOAD_ALLOCATE_ONE) + { (*cb)(context, bmp, ypos); + } ++ypos; } } diff --git a/src/newgal/commlcd/commlcd.c b/src/newgal/commlcd/commlcd.c index 5383a71b..c161855e 100644 --- a/src/newgal/commlcd/commlcd.c +++ b/src/newgal/commlcd/commlcd.c @@ -242,9 +242,9 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, Bmask = 0x001F; break; case COMMLCD_TRUE_RGB565: - Rmask = 0xF800; - Gmask = 0x07E0; - Bmask = 0x001F; + Rmask = 0x07E0; + Gmask = 0x001F; + Bmask = 0xF800; break; case COMMLCD_TRUE_RGB888: case COMMLCD_TRUE_RGB0888: @@ -264,6 +264,13 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, Gmask = 0x0000FF00; Bmask = 0x000000FF; break; + case COMMLCD_TRUE_AGBR8888: +printf("=========================================================================== i am here, type is %d\n", li.type); + Amask = 0xFF000000; + Rmask = 0x0000FF00; + Gmask = 0x000000FF; + Bmask = 0x00FF0000; + break; } /* Allocate the new pixel format for the screen */ diff --git a/src/newgal/commlcd/commlcd.h b/src/newgal/commlcd/commlcd.h index 61147639..ed914734 100644 --- a/src/newgal/commlcd/commlcd.h +++ b/src/newgal/commlcd/commlcd.h @@ -64,6 +64,7 @@ struct GAL_PrivateVideoData { #define COMMLCD_TRUE_RGB0888 5 #define COMMLCD_TRUE_ARGB1555 6 #define COMMLCD_TRUE_ARGB8888 7 +#define COMMLCD_TRUE_AGBR8888 8 struct commlcd_info { short height; // vertical resolution of the screen diff --git a/src/newgal/commlcd/extern.c b/src/newgal/commlcd/extern.c index 149f55e8..c2e5aed2 100644 --- a/src/newgal/commlcd/extern.c +++ b/src/newgal/commlcd/extern.c @@ -44,7 +44,7 @@ #ifdef _MGGAL_COMMLCD -#if defined (__VXWORKS__) || defined (__TARGET_UNKNOWN__) +#if defined (__VXWORKS__) || defined (__TARGET_UNKNOWN__) || defined(__RTEMS__) #include "minigui.h" #include "newgal.h" diff --git a/src/newgal/pixels.c b/src/newgal/pixels.c index d66af920..11090dd8 100644 --- a/src/newgal/pixels.c +++ b/src/newgal/pixels.c @@ -219,7 +219,6 @@ GAL_PixelFormat *GAL_AllocFormat(int bpp, format->Amask = Amask; break; } - /* Calculate some standard bitmasks, if necessary * Note: This could conflict with an alpha mask, if given. */ @@ -247,7 +246,8 @@ GAL_PixelFormat *GAL_ReallocFormat(GAL_Surface *surface, int bpp, GAL_FreeFormat(surface->format); GAL_FormatChanged(surface); } - surface->format = GAL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); + + surface->format = GAL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); return surface->format; } diff --git a/src/newgal/surface.c b/src/newgal/surface.c index ddd96f45..01ace89a 100644 --- a/src/newgal/surface.c +++ b/src/newgal/surface.c @@ -997,7 +997,9 @@ static int _PutBoxAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, if (bpp == 1) + { return -1; + } if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) { while ( h-- ) { @@ -1074,7 +1076,9 @@ static int _PutBoxAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w, if (bpp == 1) + { return -1; + } if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) { if (dstfmt->Amask == 0xff000000 && dstfmt->BitsPerPixel == 32) @@ -1233,7 +1237,9 @@ static int _PutBoxKeyAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcro if (bpp == 1) - return -1; + { + return -1; + } if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) { while ( h-- ) { diff --git a/src/newgal/video.c b/src/newgal/video.c index 5c17b277..e7f1d3c8 100644 --- a/src/newgal/video.c +++ b/src/newgal/video.c @@ -668,6 +668,7 @@ GAL_Surface *GAL_DisplayFormatAlpha(GAL_Surface *surface) optimised alpha format is written, add the converter here */ break; } +printf("============================================================================================== in GAL_DisplayFormatAlpha\n"); format = GAL_AllocFormat(32, rmask, gmask, bmask, amask); flags = GAL_PublicSurface->flags & GAL_HWSURFACE; flags |= surface->flags & (GAL_SRCALPHA | GAL_RLEACCELOK); @@ -1071,6 +1072,7 @@ static GAL_Surface *Slave_CreateSurface (GAL_VideoDevice *this, if (Amask){ surface->flags |= GAL_SRCPIXELALPHA; } +printf("============================================================================================== in Slave_CreateSurface\n"); surface->format = GAL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask); if ( surface->format == NULL ) { diff --git a/src/sysres/mgetc.c b/src/sysres/mgetc.c index 3de4d042..55c28d3c 100644 --- a/src/sysres/mgetc.c +++ b/src/sysres/mgetc.c @@ -58,10 +58,12 @@ static char* _system_keys[]={ }; static char* _system_values[]={ // GAL engine and default options - "pc_xvfb", - "800x600-16bpp", +// "dummy", + "commlcd", + "800x480-32bpp", // IAL engine - "pc_xvfb", + "dummy", +// "comm", "/dev/input/mice", "IMPS2" }; diff --git a/src/sysres/resmgr.c b/src/sysres/resmgr.c index a442f154..bc661ab7 100644 --- a/src/sysres/resmgr.c +++ b/src/sysres/resmgr.c @@ -44,7 +44,7 @@ #include #include -#if !defined(__NOUNIX__) && !defined(WIN32) +#if !defined(__NOUNIX__) && !defined(WIN32) && !defined(__RTEMS__) #include #include #include @@ -364,7 +364,9 @@ static void delete_entry_data(RES_ENTRY* entry) BOOL InitializeResManager(int hash_table_size) { char szpath[MAX_PATH+1]; +#if !defined(__NOUNIX__) || defined(WIN32) || !defined(__RTEMS__) char* p = NULL; +#endif pwd_res_path = strdup("./"); //initialize paths @@ -634,10 +636,16 @@ int UnregisterResType(int type) static char* get_res_file(const char* res_name, char* filename) { +#ifndef __RTEMS__ int i; +#endif if (res_name == NULL || filename == NULL) return NULL; +#ifdef __RTEMS__ + return NULL; +#else + //test it is a full path or not for(i=0; res_name[i] && res_name[i] == '/'; i++); if(i>0) //is full path @@ -670,7 +678,7 @@ static char* get_res_file(const char* res_name, char* filename) return filename; } } - +#endif return NULL; } diff --git a/src/textedit/object.c b/src/textedit/object.c index f2bd4fa3..cbfc959d 100644 --- a/src/textedit/object.c +++ b/src/textedit/object.c @@ -270,11 +270,15 @@ int ncsParseConstructParams(va_list args, const char* signature, ...) return 0; */ if (_va_check (args) == 0) + { return 0; + } argc = va_arg(args, int); if(argc <= 0) + { return 0; + } va_start(params, signature);