Compare commits

..
42 changed files with 1376 additions and 803 deletions
+1 -2
View File
@@ -566,7 +566,6 @@ A brief history description of the development progress is listed as follow:
1. Jul., 2019: FMSoft released MiniGUI version 4.0.0.
1. Mar., 2020: FMSoft released MiniGUI version 5.0.0.
1. May., 2021: FMSoft released MiniGUI version 5.0.6.
1. Jan., 2022: FMSoft released MiniGUI version 5.0.9.
## AUTHORS AND COPYING
@@ -574,7 +573,7 @@ The original author of MiniGUI is WEI Yongming, and now MiniGUI is
maintained by FMSoft. For more information, please refer to
<http://www.fmsoft.cn>.
Copyright (C) 2002 ~ 2022, Beijing FMSoft Technologies Co., Ltd.
Copyright (C) 2002 ~ 2021, Beijing FMSoft Technologies Co., Ltd.
Copyright (C) 1998 ~ 2002, WEI Yongming
This program is free software: you can redistribute it and/or modify
-41
View File
@@ -1,9 +1,5 @@
# Release Notes
- [Version 5.0.9](#version-508)
+ [What's new in version 5.0.9](#whats-new-in-version-508)
- [Version 5.0.8](#version-508)
+ [What's new in version 5.0.8](#whats-new-in-version-508)
- [Version 5.0.6](#version-506)
+ [What's new in version 5.0.6](#whats-new-in-version-506)
- [Version 5.0.5](#version-505)
@@ -24,43 +20,6 @@
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility)
+ [Deprecated APIs](#deprecated-apis)
## Version 5.0.9
On Jan. 14 2022, FMSoft announces the availability of MiniGUI 5.0.9,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.9
In this version, we fixed some bugs:
* BUGFIXING:
- Fix a crash bug in `InitSubDC()` of `src/newgdi/gdi.c`.
* ENHANCEMENTS:
* OPTIMIZATIONS:
* TUNING:
- Change copyright year to 2022.
## Version 5.0.8
The MiniGUI development team announces the availability of MiniGUI 5.0.8,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.8
In this version, we fixed some bugs and made some optimizations and enhancements:
* BUGFIXING:
* ENHANCEMENTS:
- Support for WebP image format based on `libwebp`.
- Support for two ARM64-based hardware platforms: PX30 and R818.
- New surface pixel format for main window: `ST_PIXEL_XRGB565` under compositing schema.
* OPTIMIZATIONS:
- Shrink heap size for fixed string.
- Optimize the memory use of blitting context.
* TUNING:
- Tune code of fbcon video engine for compositing schema.
- Fix warnings and errors for conditional compilation.
## Version 5.0.6
The MiniGUI development team announces the availability of MiniGUI 5.0.6,
+2 -2
View File
@@ -1,6 +1,6 @@
Version 5.0.9 (2022/01/14)
Version 5.0.6 (2021/05/20)
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
This is the first official release of MiniGUI 5.0.x, the stable version.
Other packages for MiniGUI resource, tools, components, and samples:
+186 -131
View File
File diff suppressed because it is too large Load Diff
-6
View File
@@ -105,12 +105,6 @@ seat=seat0
[fbcon]
defaultmode=1024x768-16bpp
dpi=96
# Whether double buffering is enabled (only for threads and standalone runmodes).
# Use `true` or `yes` for enabled, anything else for disabled.
# Note that under compositing schema, double buffering is always enabled.
# Since 5.0.10.
double_buffering=true
#}}
#{{ifdef _MGGAL_PCXVFB
+1 -1
View File
@@ -6455,7 +6455,7 @@ MG_EXPORT RES_KEY Str2Key (const char* str);
* \fn int GUIAPI GetWindowZOrder(HWND hWnd);
* \brief Get The Control ZOrder in the parent window
*
* \param hWnd Handler of a control
* \param hWnd Handle of a control
*
* \return return index of ZOrder or 0 if hWnd is a MainWindow or -1 if error
*
+23 -14
View File
@@ -1,19 +1,28 @@
if MG_MINIMALGDI
COMMON_SUBDIRS = misc kernel sysres include
COMMON_LADD = \
kernel/libkernel.la \
sysres/libsysres.la \
misc/libmisc.la
else
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit
COMMON_LADD = \
libc/liblibc.la \
misc/libmisc.la \
control/libcontrol.la \
ex_ctrl/libexctrl.la \
font/libfont.la \
COMMON_LADD = \
libc/liblibc.la \
misc/libmisc.la \
control/libcontrol.la \
ex_ctrl/libexctrl.la \
font/libfont.la \
font/in-core/libincore.la \
ial/libial.la \
gui/libgui.la \
main/libmain.la \
mybmp/libmybmp.la \
kernel/libkernel.la \
ial/libial.la \
gui/libgui.la \
main/libmain.la \
mybmp/libmybmp.la \
kernel/libkernel.la \
sysres/libsysres.la \
textedit/libtextedit.la
textedit/libtextedit.la
endif
if MGRM_STANDALONE
LITE_LADD = standalone/libstandalone.la
@@ -36,8 +45,8 @@ SUBDIRS = $(COMMON_SUBDIRS) $(NEWGAL_SUBDIRS) $(LITE_SUBDIRS)
MGSOURCES = template.c template.h
MGLIBADD = $(COMMON_LADD) \
$(LITE_LADD) \
$(NEWGAL_LADD)
$(LITE_LADD) \
$(NEWGAL_LADD)
MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la
+3
View File
@@ -75,6 +75,9 @@
#ifdef _MG_ENABLE_LICENSE
# include "../sysres/license/c_files/04_progressbar-bk.dat.c"
#endif
#ifndef __TARGET_UNKNOWN__
unsigned int g_license_processor_id;
#endif
#ifdef _MGHAVE_MENU
/* function defined in menu module. */
+1 -1
View File
@@ -93,7 +93,7 @@ typedef struct tagDC* PDC;
# else /* not defined _MGSCHEMA_COMPOSITING */
void __mg_lock_recalc_gcrinfo (PDC pdc);
void __mg_unlock_gcrinfo (PDC pdc);
#define LOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_lock_recalc_gcrinfo (pdc)
#define LOCK_GCRINFO(pdc) __mg_lock_recalc_gcrinfo (pdc)
#define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc)
# endif /* not defined _MGSCHEMA_COMPOSITING */
+111 -9
View File
@@ -54,12 +54,26 @@
# define MG_LOCAL /* NULL */
#endif
/*
* Common
*/
#if defined(_MG_ENABLE_SPLASH) || \
defined(_MG_ENABLE_SCREENSAVER) || \
defined(_MG_ENABLE_WATERMARK)
#define _MG_ENABLE_LICENSE 1
enum {
SPLASH_MINIGUI,
SPLASH_FMSOFT,
SPLASH_FEIMAN,
SPLASH_PROGRESSBAR,
SPLASH_PROGRESSBAR_BK,
#if 0
WATERMARK_1,
WATERMARK_2,
WATERMARK_3,
#endif /* _MG_ENABLE_WATERMARK */
LICENSE_BITMAP_NR
};
@@ -71,14 +85,14 @@ extern MG_LOCAL BITMAP g_license_bitmaps[];
#define g_bitmap_progressbar g_license_bitmaps[SPLASH_PROGRESSBAR]
#define g_bitmap_progressbar_bk g_license_bitmaps[SPLASH_PROGRESSBAR_BK]
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
# define _MG_ENABLE_LICENSE 1
MG_LOCAL void __mg_license_create(void);
MG_LOCAL void __mg_license_destroy(void);
#else
# define __mg_license_create() /* NULL */
# define __mg_license_destroy() /* NULL */
#endif
#endif /* endif _MG_ENABLE_SPLASH or _MG_ENABLE_SCREENSAVER or _MG_ENABLE_WATERMARK*/
#ifdef _MG_ENABLE_SCREENSAVER
MG_LOCAL void __mg_screensaver_create(void);
@@ -88,6 +102,9 @@ MG_LOCAL void __mg_screensaver_destroy(void);
# define __mg_screensaver_destroy() /* NULL */
#endif
/*
* Splash
*/
#ifdef _MG_ENABLE_SPLASH
MG_LOCAL void __mg_splash_draw_framework(void);
MG_LOCAL void __mg_splash_progress(void);
@@ -98,11 +115,96 @@ MG_LOCAL void __mg_splash_delay(void);
# define __mg_splash_delay() /* NULL */
#endif /* endif _MG_ENABLE_SPLASH */
#define __mg_license_on_input() /* NULL */
#define __mg_license_on_timeout() /* NULL */
#define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
#define license_get_processor_id() /* NULL */
#define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
#define LICENSE_MODIFY_MESSAGE(x) /* NULL */
/*
* ScreenSaver & Watermark
*/
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
MG_LOCAL void __mg_license_on_input(void);
MG_LOCAL void __mg_license_on_timeout(void);
#else
# define __mg_license_on_input() /* NULL */
# define __mg_license_on_timeout() /* NULL */
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
/*
* Product ID
*/
#ifdef _MG_PRODUCTID
typedef struct _product_id {
/* Fixed 8-byte code, help us to locate the struct in .so file */
unsigned char prefix[8];
/* the ID of the customer */
int customer_id;
/* svn version */
int version;
/* When does we compile the .so, in seconds */
int compile_date;
/* The size of the .so file */
int file_size;
/* The check sum of the .so file */
unsigned char checksum[16];
} product_id_t;
#define PRODUCT_ID_PREFIX 0xca, 0x3f, 0x2b, 0x43, 0x00, 0x33, 0xb0, 0xc3
MG_LOCAL int license_get_customer_id(void);
#endif /* _MG_PRODUCTID */
/*
* Tools to encrypt const variables
*/
MG_LOCAL unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int);
MG_LOCAL char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *, int);
/*
* Processor ID
*/
#ifdef _MG_PRODUCTID
# define LICENSE_CHECK_CUSTIMER_ID() \
do { \
if (! license_get_customer_id()) { \
return ERR_INVALID_ARGS; \
} \
} while(0)
#else
# define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
#endif
#ifdef __TARGET_UNKNOWN__
# define license_get_processor_id() /* NULL */
# define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
# define LICENSE_MODIFY_MESSAGE(x) /* NULL */
#else /* not __TARGET_UNKNOWN__ */
extern MG_LOCAL unsigned int g_license_processor_id; /* window.c */
MG_LOCAL void license_get_processor_id (void);
#define LICENSE_PROCESSOR_ID_NONE (0xFC1D8B2A)
extern MG_LOCAL unsigned int g_license_message_offset; /* zorder.c */
#if defined (_WITH_TARGET_S3C6410)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x1AE2FDFD /* 0x36410101 */)
#elif defined (_WITH_TARGET_S3C2440)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AA4FDFD /* 0x32440101 */)
#elif defined (_WITH_TARGET_S3C2410)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AE2FDFD /* 0x32410101 */)
#elif defined (_WITH_TARGET_HI3560A)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0xFC38C9AD /* 0x35600200 */)
#else
# define REAL_PROCESSOR_ID LICENSE_PROCESSOR_ID_NONE
#endif
#define LICENSE_SET_MESSAGE_OFFSET() do {g_license_message_offset=g_license_processor_id-(REAL_PROCESSOR_ID);}while (0)
#define LICENSE_MODIFY_MESSAGE(pMsg) \
do { \
pMsg->message += g_license_message_offset; \
pMsg->hwnd -= g_license_message_offset / 2; \
} while (0)
#endif /* __TARGET_UNKNOWN__ */
#endif /* LICENSE_H */
+10 -6
View File
@@ -216,10 +216,7 @@ typedef struct GAL_Surface {
#ifdef _MGUSE_PIXMAN
pixman_image_t *pix_img; /* The pixman image object for this surface */
pixman_image_t *msk_img;
uint16_t pix_op;
uint16_t pix_filter;
uint32_t pix_alpha_bits;
void *blit_ctxt; /* blitting context */
#endif
#if IS_COMPOSITING_SCHEMA
@@ -821,6 +818,13 @@ static inline BOOL GAL_CheckPixmanFormats (GAL_Surface *src, GAL_Surface *dst)
return FALSE;
}
typedef struct GAL_BlittingContext {
uint16_t op;
uint16_t filter;
uint32_t alpha_bits;
pixman_image_t *msk_img;
} GAL_BlittingContext;
int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops);
int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst);
@@ -1067,8 +1071,8 @@ GAL_Surface* __drm_create_surface_from_name (GHANDLE video,
uint32_t name, uint32_t drm_format, uint32_t pixels_off,
uint32_t width, uint32_t height, uint32_t pitch);
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video, uint32_t handle,
size_t size, uint32_t drm_format, uint32_t pixels_off,
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video,
uint32_t handle, size_t size, uint32_t drm_format, uint32_t pixels_off,
uint32_t width, uint32_t height, uint32_t pitch);
GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video,
-8
View File
@@ -138,14 +138,6 @@ int __mg_save_png (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
BOOL __mg_check_png (MG_RWops* fp);
#endif
#ifdef _MGIMAGE_WEBP
void* __mg_init_webp (MG_RWops* fp, MYBITMAP *png, RGB *pal);
int __mg_load_webp (MG_RWops* fp, void* init_info, MYBITMAP *png, CB_ONE_SCANLINE cb, void* context);
void __mg_cleanup_webp (void* init_info);
int __mg_save_webp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
BOOL __mg_check_webp (MG_RWops* fp);
#endif
int __mg_bmp_compute_pitch (int bpp, Uint32 width, Uint32 *pitch, BOOL does_round);
#define fp_getc(fp) MGUI_RWgetc(fp)
+5
View File
@@ -3,12 +3,17 @@ AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
noinst_LTLIBRARIES = libkernel.la
if MG_MINIMALGDI
libkernel_la_SOURCES = init-lite.c fixstr.c \
blockheap.c
else
libkernel_la_SOURCES = timer.c init.c init-lite.c \
desktop-ths.c desktop-sa.c desktop-procs.c \
cursor.c cursor-procs.c cursor-sa.c \
sharedres.c message.c event.c listenfd.c \
blockheap.c fixstr.c slotset.c zorder.c sem-manager.c \
compsor-manager.c compsor-fallback.c
endif
EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc
+1 -1
View File
@@ -1303,7 +1303,7 @@ static void transit_to_layer (CompositorCtxt* ctxt, MG_Layer* to_layer)
}
}
_DBG_PRINTF ("Average time to composite the layers: %ums (times: %u)\n", total_time_ms / total_times, total_times);
_WRN_PRINTF ("Average time to composite the layers: %u (times: %u)\n", total_time_ms / total_times, total_times);
}
CompositorOps __mg_fallback_compositor = {
+2 -2
View File
@@ -1403,7 +1403,7 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
else {
from = 0;
}
lock_zi_for_read (zi);
from = __kernel_get_next_znode (zi, from);
@@ -1821,7 +1821,7 @@ static void dskRefreshAllWindow (const RECT* invrc)
info.is_empty_invrc = TRUE;
#ifdef _MGHAVE_MENU
dskForceCloseMenu ();
dskForceCloseMenu ();
#endif
SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0,
+3 -3
View File
@@ -3641,9 +3641,6 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
do_for_all_znodes (&rcOld, zi, _cb_update_znode, ZT_ALL);
/* unlock zi for change ... */
unlock_zi_for_change (zi);
if (nodes [0].flags & ZOF_IF_REFERENCE) {
SendMessage (HWND_DESKTOP,
MSG_ERASEDESKTOP, 0, (LPARAM)&rcOld);
@@ -3683,6 +3680,9 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
update_client_window_rgn (nodes [idx_znode].cli,
nodes [idx_znode].hwnd);
/* unlock zi for change ... */
unlock_zi_for_change (zi);
}
else {
lock_zi_for_change (zi);
+3
View File
@@ -67,6 +67,9 @@
#ifdef _MG_ENABLE_LICENSE
# include "../sysres/license/c_files/03_progressbar.dat.c"
#endif
#ifndef __TARGET_UNKNOWN__
unsigned int g_license_message_offset;
#endif
#ifdef _MGRM_PROCESSES
# include "ourhdr.h"
+1 -1
View File
@@ -1472,7 +1472,7 @@ void mg_slice_debug_tree_statistics (void)
su / bf, en, ex);
}
else
_DBG_PRINTF("MGSlice: MemChecker: root=NULL\n");
_MG_PRINTF("MGSlice: MemChecker: root=NULL\n");
pthread_mutex_unlock (&smc_tree_mutex);
+4
View File
@@ -5,9 +5,13 @@ EXTRA_DIST= misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c error.c sockio.c rc4.c rc4.h \
makefile.ng makefile.msvc
if MG_MINIMALGDI
libmisc_la_SOURCES = misc.c math.c rwops.c nposix.c
else
libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c license.c anon_file.c rbtree.c map.c \
error.c sockio.c
endif
SRC_FILES = $(libmisc_la_SOURCES)
LIB_NAME=libmisc
+339 -7
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -1,9 +1,8 @@
AM_CPPFLAGS = $(WEBP_CFLAGS)
AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
noinst_LTLIBRARIES = libmybmp.la
SRC_FILES = mybmp.c winbmp.c gif.c jpeg.c png12.c png16.c webp.c lbm.c pcx.c tga.c
SRC_FILES = mybmp.c winbmp.c gif.c jpeg.c png12.c png16.c lbm.c pcx.c tga.c
libmybmp_la_SOURCES = $(SRC_FILES)
+2 -3
View File
@@ -309,7 +309,7 @@ void* __mg_init_jpg (MG_RWops *fp, MYBITMAP* mybmp, RGB* pal)
struct my_error_mgr *jerr;
jpeg_init_info_t* init_info;
if (!read_be16(fp, &soi_marker) || JMK_SOI != soi_marker)
if (!read_be16(fp,&soi_marker) || JMK_SOI != soi_marker)
goto err; /* not JPEG image*/
MGUI_RWseek (fp, 0, SEEK_SET);
@@ -353,8 +353,7 @@ void* __mg_init_jpg (MG_RWops *fp, MYBITMAP* mybmp, RGB* pal)
}
/* Step 4: set parameters for decompression */
cinfo->out_color_space =
(mybmp->flags & MYBMP_LOAD_GRAYSCALE) ? JCS_GRAYSCALE: JCS_RGB;
cinfo->out_color_space = (mybmp->flags & MYBMP_LOAD_GRAYSCALE) ? JCS_GRAYSCALE: JCS_RGB;
cinfo->quantize_colors = FALSE;
if (!(mybmp->flags & MYBMP_LOAD_GRAYSCALE)) {
-3
View File
@@ -98,9 +98,6 @@ static BITMAP_TYPE_INFO bitmap_types [MAX_BITMAP_TYPES] =
#ifdef _MGIMAGE_PNG
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, NULL, __mg_check_png },
#endif
#ifdef _MGIMAGE_WEBP
{ "webp", __mg_init_webp, __mg_load_webp, __mg_cleanup_webp, NULL, __mg_check_webp },
#endif
};
/*
-273
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -42,6 +42,8 @@ COMMON_SRCS = \
surface-shm.c \
shadow-screen.h \
shadow-screen.c \
concurrent-tasks.h \
concurrent-tasks.c \
$(NULL_FILE)
libnewgal_la_SOURCES = $(COMMON_SRCS)
+37 -27
View File
@@ -77,13 +77,13 @@ static int GAL_SoftBlit(GAL_Surface *src, GAL_Rect *srcrect,
GAL_loblit RunBlit;
/* Set up the blit information */
info.s_pixels = (Uint8 *)src->pixels +
info.s_pixels = (Uint8 *)src->pixels + src->pixels_off +
(Uint16)srcrect->y*src->pitch +
(Uint16)srcrect->x*src->format->BytesPerPixel;
info.s_width = srcrect->w;
info.s_height = srcrect->h;
info.s_skip=src->pitch-info.s_width*src->format->BytesPerPixel;
info.d_pixels = (Uint8 *)dst->pixels +
info.d_pixels = (Uint8 *)dst->pixels + dst->pixels_off +
(Uint16)dstrect->y*dst->pitch +
(Uint16)dstrect->x*dst->format->BytesPerPixel;
info.d_width = dstrect->w;
@@ -332,37 +332,39 @@ int GAL_CalculateBlit(GAL_Surface *surface)
int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops)
{
if (GAL_CheckPixmanFormats (src, dst)) {
GAL_BlittingContext* ctxt;
src->blit_ctxt = malloc (sizeof (GAL_BlittingContext));
if (src->blit_ctxt == NULL)
return -1;
ctxt = src->blit_ctxt;
if ((src->flags & GAL_SRCALPHA) && src->format->alpha != GAL_ALPHA_OPAQUE) {
memset (&src->pix_alpha_bits, src->format->alpha, sizeof(uint32_t));
src->msk_img = pixman_image_create_bits_no_clear (PIXMAN_a8, 1, 1,
&src->pix_alpha_bits, 4);
if (src->msk_img)
pixman_image_set_repeat (src->msk_img, PIXMAN_REPEAT_NORMAL);
memset (&ctxt->alpha_bits, src->format->alpha, sizeof(uint32_t));
ctxt->msk_img = pixman_image_create_bits_no_clear (PIXMAN_a8, 1, 1,
&ctxt->alpha_bits, 4);
if (ctxt->msk_img)
pixman_image_set_repeat (ctxt->msk_img, PIXMAN_REPEAT_NORMAL);
}
else
src->msk_img = NULL;
ctxt->msk_img = NULL;
ops &= COLOR_BLEND_FLAGS_MASK;
if (ops == COLOR_BLEND_LEGACY) {
if ((src->flags & GAL_SRCPIXELALPHA) && src->format->Amask && src != dst) {
src->pix_op = PIXMAN_OP_OVER;
ctxt->op = PIXMAN_OP_OVER;
}
else {
src->pix_op = PIXMAN_OP_SRC;
ctxt->op = PIXMAN_OP_SRC;
}
}
else {
src->pix_op = ops;
ctxt->op = ops;
}
if (src->pix_op > PIXMAN_OP_HSL_LUMINOSITY ||
src->pix_op < PIXMAN_OP_CLEAR) {
src->pix_op = PIXMAN_OP_SRC;
if (ctxt->op > PIXMAN_OP_HSL_LUMINOSITY ||
ctxt->op < PIXMAN_OP_CLEAR) {
ctxt->op = PIXMAN_OP_SRC;
}
/* reset transform and filter */
pixman_image_set_transform (src->pix_img, NULL);
pixman_image_set_filter (src->pix_img, PIXMAN_FILTER_NEAREST, NULL, 0);
}
return 0;
@@ -370,13 +372,14 @@ int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops)
int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst)
{
if (src->msk_img) {
pixman_image_unref (src->msk_img);
src->msk_img = NULL;
if (src->blit_ctxt) {
GAL_BlittingContext* ctxt = src->blit_ctxt;
if (ctxt->msk_img)
pixman_image_unref (ctxt->msk_img);
free (src->blit_ctxt);
src->blit_ctxt = NULL;
}
pixman_image_set_clip_region32 (dst->pix_img, NULL);
return 0;
}
@@ -386,9 +389,16 @@ static int GAL_PixmanBlit (struct GAL_Surface *src, GAL_Rect *srcrect,
pixman_image_t *src_img = src->pix_img, *dst_img = dst->pix_img;
pixman_image_t *msk_img;
pixman_op_t op;
msk_img = src->msk_img;
op = (pixman_op_t)src->pix_op;
if (src->blit_ctxt) {
GAL_BlittingContext* ctxt = src->blit_ctxt;
msk_img = ctxt->msk_img;
op = (pixman_op_t)ctxt->op;
}
else {
msk_img = NULL;
op = PIXMAN_OP_SRC;
}
_DBG_PRINTF ("srcrect: %d, %d, %dx%d; dstrect: %d, %d, %dx%d\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
@@ -401,8 +411,8 @@ static int GAL_PixmanBlit (struct GAL_Surface *src, GAL_Rect *srcrect,
pixman_image_set_clip_region32 (dst_img, &clip_region);
#endif
// pixman_blt does not work
#if 0
// pixman_blt does not work
if (pixman_image_get_format (src_img) == pixman_image_get_format (dst_img) &&
op == PIXMAN_OP_SRC && msk_img == NULL) {
pixman_blt ((uint32_t *)((char*)src->pixels + src->pixels_off),
+12 -5
View File
@@ -1524,12 +1524,12 @@ GAL_loblit GAL_CalculateBlitN(GAL_Surface *surface, int blit_index)
}
} else {
/* Now the meat, choose the blitter we want */
int a_need = 0;
if (dstfmt->Amask)
int a_need = 0;
if(dstfmt->Amask)
a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
table = normal_blit[srcfmt->BytesPerPixel-1];
for (which=0; table[which].srcR; ++which) {
if (srcfmt->Rmask == table[which].srcR &&
for ( which=0; table[which].srcR; ++which ) {
if ( srcfmt->Rmask == table[which].srcR &&
srcfmt->Gmask == table[which].srcG &&
srcfmt->Bmask == table[which].srcB &&
dstfmt->BytesPerPixel == table[which].dstbpp &&
@@ -1538,7 +1538,7 @@ GAL_loblit GAL_CalculateBlitN(GAL_Surface *surface, int blit_index)
dstfmt->Bmask == table[which].dstB &&
(a_need & table[which].alpha) == a_need &&
(CPU_Flags()&table[which].cpu_flags) ==
table[which].cpu_flags)
table[which].cpu_flags )
break;
}
sdata->aux_data = table[which].aux_data;
@@ -1547,6 +1547,13 @@ GAL_loblit GAL_CalculateBlitN(GAL_Surface *surface, int blit_index)
blitfun = BlitNtoNCopyAlpha;
}
#ifdef DEBUG_ASM
if ( (blitfun == GAL_BlitNtoN) || (blitfun == GAL_BlitNto1) )
fprintf(stderr, "Using C blit\n");
else
fprintf(stderr, "Using optimized C blit\n");
#endif /* DEBUG_ASM */
return(blitfun);
}
File diff suppressed because it is too large Load Diff
+72
View File
@@ -0,0 +1,72 @@
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
* 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~2020, 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 <http://www.gnu.org/licenses/>.
*
* 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
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
*/
/*
** The helpers for concurrent tasks.
**
** Current maintainer: Wei Yongming.
**
** Create date: 2021/05/21
*/
#ifndef _GAL_concurrent_tasks_h
#define _GAL_concurrent_tasks_h
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef void (*CCTaskProc)(void* context, int loop_idx);
int concurrentTasks_Init (void);
int concurrentTasks_Term (void);
int concurrentTasks_SplitRect (GAL_Rect* rcs, const GAL_Rect* rc, int count);
int concurrentTasks_Do (void* context, CCTaskProc proc);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _GAL_concurrent_tasks_h */
+2 -9
View File
@@ -796,7 +796,7 @@ static GAL_Surface* create_surface_from_buffer (_THIS,
surface->pixels_off = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
#if IS_COMPOSITING_SCHEMA
surface->shared_header = NULL;
@@ -952,11 +952,6 @@ static void DRM_DeleteDevice(GAL_VideoDevice *device)
free(device);
}
#ifdef __TARGET_PX30__
static inline char* find_driver_for_device (const char *dev_name) {
return strdup ("rockchip");
}
#else /* __TARGET_PX30__ */
static char* find_driver_for_device (const char *dev_name)
{
char *driver;
@@ -1001,7 +996,6 @@ static char* find_driver_for_device (const char *dev_name)
return strdup (driver + strlen ("/"));
}
#endif /* not defined __TARGET_PX30__ */
static DrmDriverOps* load_external_driver (DrmVideoData* vdata,
const char* driver_name, int device_fd)
@@ -1101,7 +1095,6 @@ static int open_drm_device(GAL_VideoDevice *device)
_DBG_PRINTF("Try to load DRM driver: %s\n", driver_name);
fd = drmOpen(driver_name, NULL);
if (fd < 0) {
_ERR_PRINTF("NEWGAL>DRM: drmOpen failed\n");
free(driver_name);
@@ -3575,7 +3568,7 @@ GAL_Surface* __drm_create_surface_from_name (GHANDLE video,
/* called by drmCreateDCFromHandle */
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video, uint32_t handle,
size_t size, uint32_t drm_format, uint32_t pixels_off,
unsigned long size, uint32_t drm_format, uint32_t pixels_off,
uint32_t width, uint32_t height, uint32_t pitch)
{
GAL_VideoDevice *this = (GAL_VideoDevice *)video;
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -68,26 +68,19 @@ typedef struct vidmem_bucket {
/* Private display data */
struct GAL_PrivateVideoData {
/* When double buffering supported, the real surface represents the ultimate
* scan-out frame buffer, and the shadow screen represents the rendering
* surface. When double buffering disabled, shadow_screen is NULL.
*
* For compositing schema, we force to use double buffering.
* For threads and standalone mode, controlled by `fbcon.double_buffering`
* run-time option. Not supported for processes mode.
*/
/* For compositing schema, we force to use double buffering */
#ifdef _MGSCHEMA_COMPOSITING
/* start of header for shadow screen */
int magic, version;
GAL_Surface *real_screen, *shadow_screen;
RECT dirty_rc;
#ifdef _MGSCHEMA_COMPOSITING
/* Used to simulate the hardware cursor. */
GAL_Surface *cursor;
int csr_x, csr_y;
int hot_x, hot_y;
#endif
/* end of header for shadow screen */
#endif /* _MGSCHEMA_COMPOSITING */
int console_fd;
struct fb_var_screeninfo cache_vinfo;
@@ -111,6 +104,13 @@ struct GAL_PrivateVideoData {
void (*wait_vbl)(_THIS);
void (*wait_idle)(_THIS);
#if 0 /* deprecated code */
int flip_page;
char *flip_address[2];
#define flip_page (this->hidden->flip_page)
#define flip_address (this->hidden->flip_address)
#endif
};
/* Old variable names */
+86 -25
View File
@@ -49,6 +49,7 @@
#include "common.h"
#include "newgal.h"
#include "blit.h"
#include "concurrent-tasks.h"
#define DEFINE_COPY_ROW(name, type) \
static void name(type *src, int src_w, type *dst, int dst_w) \
@@ -273,38 +274,44 @@ int GAL_SetupStretchBlit (GAL_Surface *src, GAL_Rect *srcrect,
double rotation;
pixman_f_transform_t ftransform;
pixman_transform_t transform;
GAL_BlittingContext* ctxt;
src->blit_ctxt = malloc (sizeof (GAL_BlittingContext));
if (src->blit_ctxt == NULL)
return -1;
ctxt = src->blit_ctxt;
if ((src->flags & GAL_SRCALPHA) && src->format->alpha != GAL_ALPHA_OPAQUE) {
memset (&src->pix_alpha_bits, src->format->alpha, sizeof(uint32_t));
src->msk_img = pixman_image_create_bits_no_clear (PIXMAN_a8, 1, 1,
&src->pix_alpha_bits, 4);
if (src->msk_img)
pixman_image_set_repeat (src->msk_img, PIXMAN_REPEAT_NORMAL);
memset (&ctxt->alpha_bits, src->format->alpha, sizeof(uint32_t));
ctxt->msk_img = pixman_image_create_bits_no_clear (PIXMAN_a8, 1, 1,
&ctxt->alpha_bits, 4);
if (ctxt->msk_img)
pixman_image_set_repeat (ctxt->msk_img, PIXMAN_REPEAT_NORMAL);
}
else
src->msk_img = NULL;
ctxt->msk_img = NULL;
src->pix_filter = ops >> SCALING_FILTER_SHIFT;
if (src->pix_filter > PIXMAN_FILTER_CONVOLUTION) {
src->pix_filter = PIXMAN_FILTER_FAST;
ctxt->filter = ops >> SCALING_FILTER_SHIFT;
if (ctxt->filter > PIXMAN_FILTER_CONVOLUTION) {
ctxt->filter = PIXMAN_FILTER_FAST;
}
ops &= COLOR_BLEND_FLAGS_MASK;
if (ops == COLOR_BLEND_LEGACY) {
if ((src->flags & GAL_SRCPIXELALPHA) && src->format->Amask && src != dst) {
src->pix_op = PIXMAN_OP_OVER;
ctxt->op = PIXMAN_OP_OVER;
}
else {
src->pix_op = PIXMAN_OP_SRC;
ctxt->op = PIXMAN_OP_SRC;
}
}
else {
src->pix_op = ops;
ctxt->op = ops;
}
if (src->pix_op > PIXMAN_OP_HSL_LUMINOSITY ||
src->pix_op < PIXMAN_OP_CLEAR) {
src->pix_op = PIXMAN_OP_SRC;
if (ctxt->op > PIXMAN_OP_HSL_LUMINOSITY ||
ctxt->op < PIXMAN_OP_CLEAR) {
ctxt->op = PIXMAN_OP_SRC;
}
pixman_f_transform_init_identity (&ftransform);
@@ -344,7 +351,7 @@ int GAL_SetupStretchBlit (GAL_Surface *src, GAL_Rect *srcrect,
pixman_image_set_filter (src_img, (pixman_filter_t)filter, NULL, 0);
}
#else
pixman_image_set_filter (src->pix_img, (pixman_filter_t)src->pix_filter, NULL, 0);
pixman_image_set_filter (src->pix_img, (pixman_filter_t)ctxt->filter, NULL, 0);
#endif
}
@@ -353,18 +360,49 @@ int GAL_SetupStretchBlit (GAL_Surface *src, GAL_Rect *srcrect,
int GAL_CleanupStretchBlit (GAL_Surface *src, GAL_Surface *dst)
{
if (src->msk_img) {
pixman_image_unref (src->msk_img);
src->msk_img = NULL;
}
if (src->blit_ctxt) {
pixman_transform_t transform;
pixman_image_set_transform (src->pix_img, NULL);
pixman_image_set_filter (src->pix_img, PIXMAN_FILTER_NEAREST, NULL, 0);
pixman_image_set_clip_region32 (dst->pix_img, NULL);
GAL_BlittingContext* ctxt = src->blit_ctxt;
if (ctxt->msk_img)
pixman_image_unref (ctxt->msk_img);
free (src->blit_ctxt);
src->blit_ctxt = NULL;
pixman_transform_init_identity (&transform);
pixman_image_set_transform (src->pix_img, &transform);
pixman_image_set_filter (src->pix_img, PIXMAN_FILTER_FAST, NULL, 0);
pixman_image_set_clip_region32 (dst->pix_img, NULL);
}
return 0;
}
#ifdef _MGRM_PROCESSES
typedef struct _ContextStretch {
pixman_op_t op;
pixman_image_t *src_img;
pixman_image_t *msk_img;
pixman_image_t *dst_img;
GAL_Rect dst_rects [_MGNR_CONCURRENT_TASKS + 1];
} ContextStretch;
static void stretch_proc (void* context, int loop_idx)
{
ContextStretch *ctxt = context;
if (ctxt->dst_rects[loop_idx].h > 0) {
GAL_Rect* dstrect = ctxt->dst_rects + loop_idx;
pixman_image_composite32 (ctxt->op, ctxt->src_img, ctxt->msk_img, ctxt->dst_img,
dstrect->x, dstrect->y,
0, 0,
dstrect->x, dstrect->y,
dstrect->w, dstrect->h);
}
}
#endif
int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
GAL_Surface *dst, GAL_Rect *dstrect,
const STRETCH_EXTRA_INFO* sei, DWORD ops)
@@ -378,8 +416,15 @@ int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
return GAL_StretchBltLegacy (src, srcrect, dst, dstrect,
ops & COLOR_BLEND_FLAGS_MASK);
msk_img = src->msk_img;
op = (pixman_op_t)src->pix_op;
if (src->blit_ctxt) {
GAL_BlittingContext* ctxt = src->blit_ctxt;
msk_img = ctxt->msk_img;
op = (pixman_op_t)ctxt->op;
}
else {
msk_img = NULL;
op = PIXMAN_OP_SRC;
}
_DBG_PRINTF ("srcrect: %d,%d, %dx%d; dstrect: %d,%d, %dx%d; cliprect: %d,%d, %dx%d\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
@@ -390,11 +435,27 @@ int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
dst->clip_rect.x, dst->clip_rect.y, dst->clip_rect.w, dst->clip_rect.h);
pixman_image_set_clip_region32 (dst_img, &clip_region);
#ifdef _MGRM_PROCESSES
// we use concurrent tasks only under MiniGUI-Processes.
{
ContextStretch ctxt;
ctxt.op = op;
ctxt.src_img = src_img;
ctxt.msk_img = msk_img;
ctxt.dst_img = dst_img;
concurrentTasks_SplitRect (ctxt.dst_rects, dstrect, _MGNR_CONCURRENT_TASKS + 1);
concurrentTasks_Do (&ctxt, stretch_proc);
}
#else
pixman_image_composite32 (op, src_img, msk_img, dst_img,
dstrect->x, dstrect->y,
0, 0,
dstrect->x, dstrect->y,
dstrect->w, dstrect->h);
#endif
pixman_region32_fini (&clip_region);
return 0;
+1 -1
View File
@@ -105,7 +105,7 @@ GAL_Surface * GAL_CreateCursorSurface (GAL_VideoDevice *video,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
+5 -5
View File
@@ -138,7 +138,7 @@ GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
@@ -278,7 +278,7 @@ error:
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
@@ -328,7 +328,7 @@ void GAL_FreeSharedSurfaceData (GAL_Surface *surface)
surface->pixels = NULL;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
@@ -424,7 +424,7 @@ GAL_Surface * GAL_AttachSharedRGBSurface (int fd, size_t map_size,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
GAL_SetClipRect (surface, NULL);
@@ -481,7 +481,7 @@ void GAL_DettachSharedSurfaceData (GAL_Surface *surface)
surface->pixels = NULL;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
+45 -31
View File
@@ -56,6 +56,7 @@
#include "pixels_c.h"
#include "memops.h"
#include "leaks.h"
#include "concurrent-tasks.h"
#ifdef _MGRM_PROCESSES
#include <sys/mman.h> /* for munmap */
@@ -144,7 +145,7 @@ GAL_Surface * GAL_CreateRGBSurface (Uint32 flags,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
#if IS_COMPOSITING_SCHEMA
surface->shared_header = NULL;
@@ -493,6 +494,28 @@ static int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, G
}
#endif
#ifdef _MGRM_PROCESSES
typedef struct _ContextBlit {
GAL_Surface *src;
GAL_Surface *dst;
GAL_blit real_blit;
GAL_Rect src_rects [_MGNR_CONCURRENT_TASKS + 1];
GAL_Rect dst_rects [_MGNR_CONCURRENT_TASKS + 1];
} ContextBlit;
static void blit_proc (void* context, int loop_idx)
{
ContextBlit *ctxt = context;
if (ctxt->src_rects[loop_idx].h > 0) {
ctxt->real_blit (ctxt->src, ctxt->src_rects + loop_idx,
ctxt->dst, ctxt->dst_rects + loop_idx);
}
}
#endif
/*
* Set up a blit between two surfaces -- split into three parts:
* The upper part, GAL_UpperBlit(), performs clipping and rectangle
@@ -538,38 +561,31 @@ int GAL_LowerBlit (GAL_Surface *src, GAL_Rect *srcrect,
}
#endif
#ifdef MG_CONFIG_USE_OWN_OVERLAPPED_BITBLIT
ret = own_overlapped_bitblit(do_blit, src, srcrect, dst, dstrect);
#else
ret = do_blit(src, srcrect, dst, dstrect);
#endif
#if 0
#ifdef _MGRM_PROCESSES
// we use concurrent tasks only under MiniGUI-Processes.
{
static int n_sw=0, n_hw=0;
if ((src->flags & GAL_HWACCEL) == GAL_HWACCEL)
{
n_hw ++;
}
else
{
n_sw ++;
}
printf("[%06u] hw/blit=%d/%d %c size=%dX%d src=(%d %d),%p dst=(%d %d),%p\n",
times(NULL) % 1000000,
n_hw, n_hw+n_sw,
do_blit == src->map->sw_blit ? 'S':'H',
srcrect->w, srcrect->h,
srcrect->x, srcrect->y, src,
dstrect->x, dstrect->y, dst
);
ContextBlit ctxt;
ctxt.src = src;
ctxt.dst = dst;
ctxt.real_blit = do_blit;
concurrentTasks_SplitRect (ctxt.src_rects, srcrect, _MGNR_CONCURRENT_TASKS + 1);
concurrentTasks_SplitRect (ctxt.dst_rects, dstrect, _MGNR_CONCURRENT_TASKS + 1);
concurrentTasks_Do (&ctxt, blit_proc);
}
#else
# ifdef MG_CONFIG_USE_OWN_OVERLAPPED_BITBLIT
ret = own_overlapped_bitblit(do_blit, src, srcrect, dst, dstrect);
# else
ret = do_blit(src, srcrect, dst, dstrect);
# endif
#endif
return ret;
}
int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,
GAL_Surface *dst, GAL_Rect *dstrect, DWORD op)
{
@@ -1870,15 +1886,13 @@ void GAL_FreeSurface (GAL_Surface *surface)
#ifdef _MGUSE_PIXMAN
if (surface->pix_img) {
_DBG_PRINTF ("There is not cleaned up blitting pixel image: %p\n", surface->pix_img);
pixman_image_unref (surface->pix_img);
surface->pix_img = NULL;
}
if (surface->msk_img) {
_DBG_PRINTF ("There is not cleaned up blitting mask image: %p\n", surface->msk_img);
pixman_image_unref (surface->msk_img);
surface->msk_img = NULL;
if (surface->blit_ctxt) {
_WRN_PRINTF ("There is not cleaned up blitting context: %p\n", surface->blit_ctxt);
}
#endif
+14 -1
View File
@@ -58,6 +58,7 @@
#include "pixels_c.h"
#include "license.h"
#include "debug.h"
#include "concurrent-tasks.h"
/* Available video drivers */
static VideoBootStrap *bootstrap[] = {
@@ -288,6 +289,12 @@ int GAL_VideoInit (const char *driver_name, Uint32 flags)
video->info.vfmt = GAL_VideoSurface->format;
#ifdef _MGRM_PROCESSES
// we use concurrent tasks only under MiniGUI-Processes.
if (concurrentTasks_Init ())
return -1;
#endif
return(0);
}
@@ -1154,6 +1161,12 @@ void GAL_VideoQuit (void)
DestroyFreeClipRectList (&__mg_free_update_region_list);
#endif
}
#ifdef _MGRM_PROCESSES
// we use concurrent tasks only under MiniGUI-Processes.
concurrentTasks_Term ();
#endif
return;
}
@@ -1257,7 +1270,7 @@ static GAL_Surface *Slave_CreateSurface (GAL_VideoDevice *this,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->msk_img = NULL;
surface->blit_ctxt = NULL;
#endif
#if IS_COMPOSITING_SCHEMA
surface->shared_header = NULL;
+6
View File
@@ -3,6 +3,11 @@ AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
noinst_LTLIBRARIES = libnewgdi.la
if MG_MINIMALGDI
SRC_FILES = gdi.c attr.c clip.c coor.c rect.c \
bitmap.c pixel.c pixel_ops.c \
region.c polygon.c
else
SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
palette.c readbmp.c icon.c screen.c bitmap.c \
pixel.c line.c arc.c pixel_ops.c \
@@ -15,6 +20,7 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
textruns.c \
shape-glyphs-basic.c shape-glyphs-complex.c \
layout.c layout-utils.c layout-ellipsize.c
endif
HDR_FILES = glyph.h drawtext.h mi.h midc.h mistruct.h miwideline.h \
pixel_ops.h mifillarc.h mispans.h polygon.h mifpoly.h \
+14 -75
View File
@@ -1108,11 +1108,6 @@ void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh,
if (!(pddc = __mg_check_ecrgn (hddc)))
return;
/* The coordinates should be in device space. */
#if 0
if (sw <= 0) sw = RECTW (psdc->DevRC);
if (sh <= 0) sh = RECTH (psdc->DevRC);
// Transfer logical to device to screen here.
sw += sx; sh += sy;
coor_LP2SP (psdc, &sx, &sy);
@@ -1128,16 +1123,6 @@ void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh,
coor_LP2SP (pddc, &dx, &dy);
SetRect (&dstOutput, dx, dy, dx + sw, dy + sh);
#else
if (sw <= 0) sw = RECTW (psdc->DevRC);
if (sh <= 0) sh = RECTH (psdc->DevRC);
coor_DP2SP (psdc, &sx, &sy);
SetRect (&srcOutput, sx, sy, sx + sw, sy + sh);
coor_DP2SP (pddc, &dx, &dy);
SetRect (&dstOutput, dx, dy, dx + sw, dy + sh);
#endif
if (pddc->surface == psdc->surface) {
if (sx == dx && sy == dy)
@@ -1393,11 +1378,12 @@ void GUIAPI StretchBltLegacy (HDC hsdc, int sx, int sy, int sw, int sh,
if (!(pddc = __mg_check_ecrgn (hddc)))
return;
/* The coordinates should be in device space. */
#if 0
// Transfer logical to device to screen here.
sw += sx; sh += sy;
coor_LP2SP(psdc, &sx, &sy);
coor_LP2SP(psdc, &sw, &sh);
if (sw == sx) sw = sx + RECTW (psdc->DevRC);
if (sh == sy) sh = sy + RECTH (psdc->DevRC);
SetRect (&srcOutput, sx, sy, sw, sh);
NormalizeRect (&srcOutput);
sx = srcOutput.left; sy = srcOutput.top;
@@ -1406,6 +1392,8 @@ void GUIAPI StretchBltLegacy (HDC hsdc, int sx, int sy, int sw, int sh,
dw += dx; dh += dy;
coor_LP2SP (pddc, &dx, &dy);
coor_LP2SP (pddc, &dw, &dh);
if (dw == dx) dw = dx + RECTW (pddc->DevRC);
if (dh == dy) dh = dy + RECTH (pddc->DevRC);
SetRect (&dstOutput, dx, dy, dw, dh);
NormalizeRect (&dstOutput);
dx = dstOutput.left; dy = dstOutput.top;
@@ -1413,41 +1401,15 @@ void GUIAPI StretchBltLegacy (HDC hsdc, int sx, int sy, int sw, int sh,
if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0)
goto error_ret;
if ((sx + sw) < 0 || sx >= psdc->DevRC.right)
if (sx < 0 || sx >= RECTW(psdc->DevRC) || (sx + sw) > RECTW(psdc->DevRC))
goto error_ret;
if ((sy +sh) < 0 || sy >= psdc->DevRC.bottom)
goto error_ret;
if ((dx + dw) < 0 || dx >= pddc->DevRC.right)
goto error_ret;
if ((dy + dh) <0 || dy >= pddc->DevRC.bottom)
goto error_ret;
#else
if (sx < 0) sx = 0;
if (sy < 0) sy = 0;
if (dx < 0) dx = 0;
if (dy < 0) dy = 0;
if (sx >= RECTW(psdc->DevRC))
goto error_ret;
if (sy >= RECTH(psdc->DevRC))
if (sy < 0 || sy >= RECTH(psdc->DevRC) || (sy + sh) > RECTH(psdc->DevRC))
goto error_ret;
if (dx >= RECTW(pddc->DevRC))
goto error_ret;
if (dy >= RECTH(pddc->DevRC))
goto error_ret;
if (sw <= 0 || sw > RECTW (psdc->DevRC) - sx) sw = RECTW (psdc->DevRC) - sx;
if (sh <= 0 || sh > RECTH (psdc->DevRC) - sy) sh = RECTH (psdc->DevRC) - sy;
if (dw <= 0 || dw > RECTW (pddc->DevRC) - dx) dw = RECTW (pddc->DevRC) - dx;
if (dh <= 0 || dh > RECTH (pddc->DevRC) - dy) dh = RECTH (pddc->DevRC) - dy;
coor_DP2SP (psdc, &sx, &sy);
SetRect (&srcOutput, sx, sy, sx + sw, sy + sh);
coor_DP2SP (pddc, &dx, &dy);
SetRect (&dstOutput, dx, dy, dx + dw, dy + dh);
#endif
info.pdc = pddc;
info.dst_x = dx; info.dst_y = dy;
info.dst_w = dw; info.dst_h = dh;
@@ -1530,11 +1492,12 @@ BOOL GUIAPI StretchBltEx (HDC hsdc, int sx, int sy, int sw, int sh,
if (!(pddc = __mg_check_ecrgn (hddc)))
return retv;
/* The coordinates should be in device space. */
#if 0
// Transfer logical to device to screen here.
sw += sx; sh += sy;
coor_LP2SP(psdc, &sx, &sy);
coor_LP2SP(psdc, &sw, &sh);
if (sw == sx) sw = sx + RECTW (psdc->DevRC);
if (sh == sy) sh = sy + RECTH (psdc->DevRC);
SetRect (&srcOutput, sx, sy, sw, sh);
NormalizeRect (&srcOutput);
sx = srcOutput.left; sy = srcOutput.top;
@@ -1543,6 +1506,8 @@ BOOL GUIAPI StretchBltEx (HDC hsdc, int sx, int sy, int sw, int sh,
dw += dx; dh += dy;
coor_LP2SP (pddc, &dx, &dy);
coor_LP2SP (pddc, &dw, &dh);
if (dw == dx) dw = dx + RECTW (pddc->DevRC);
if (dh == dy) dh = dy + RECTH (pddc->DevRC);
SetRect (&dstOutput, dx, dy, dw, dh);
NormalizeRect (&dstOutput);
dx = dstOutput.left; dy = dstOutput.top;
@@ -1550,41 +1515,15 @@ BOOL GUIAPI StretchBltEx (HDC hsdc, int sx, int sy, int sw, int sh,
if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0)
goto error_ret;
if ((sx + sw) < 0 || sx >= psdc->DevRC.right)
if (sx < 0 || sx >= RECTW(psdc->DevRC) || (sx + sw) > RECTW(psdc->DevRC))
goto error_ret;
if ((sy +sh) < 0 || sy >= psdc->DevRC.bottom)
goto error_ret;
if ((dx + dw) < 0 || dx >= pddc->DevRC.right)
goto error_ret;
if ((dy + dh) <0 || dy >= pddc->DevRC.bottom)
goto error_ret;
#else
if (sx < 0) sx = 0;
if (sy < 0) sy = 0;
if (dx < 0) dx = 0;
if (dy < 0) dy = 0;
if (sx >= RECTW(psdc->DevRC))
goto error_ret;
if (sy >= RECTH(psdc->DevRC))
if (sy < 0 || sy >= RECTH(psdc->DevRC) || (sy + sh) > RECTH(psdc->DevRC))
goto error_ret;
if (dx >= RECTW(pddc->DevRC))
goto error_ret;
if (dy >= RECTH(pddc->DevRC))
goto error_ret;
if (sw <= 0 || sw > RECTW (psdc->DevRC) - sx) sw = RECTW (psdc->DevRC) - sx;
if (sh <= 0 || sh > RECTH (psdc->DevRC) - sy) sh = RECTH (psdc->DevRC) - sy;
if (dw <= 0 || dw > RECTW (pddc->DevRC) - dx) dw = RECTW (pddc->DevRC) - dx;
if (dh <= 0 || dh > RECTH (pddc->DevRC) - dy) dh = RECTH (pddc->DevRC) - dy;
coor_DP2SP (psdc, &sx, &sy);
SetRect (&srcOutput, sx, sy, sx + sw, sy + sh);
coor_DP2SP (pddc, &dx, &dy);
SetRect (&dstOutput, dx, dy, dx + dw, dy + dh);
#endif
retv = TRUE;
if (pddc->surface == psdc->surface)
GetBoundRect (&pddc->rc_output, &srcOutput, &dstOutput);
+10 -12
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2020, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -2462,7 +2462,7 @@ void GUIAPI ReleaseDC (HDC hDC)
}
}
static BOOL dc_InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y,
static BOOL InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y,
int width, int height)
{
int parent_width,parent_height;
@@ -2564,11 +2564,7 @@ HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height)
if (pdc == NULL)
return HDC_INVALID;
InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList);
MAKE_REGION_INFINITE(&pdc->lcrgn);
InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList);
if (!dc_InitSubDC((HDC)pdc, hdc, off_x, off_y, width, height)) {
if (!InitSubDC((HDC)pdc, hdc, off_x, off_y, width, height)) {
pdc->bInUse = FALSE;
return HDC_INVALID;
}
@@ -2658,16 +2654,16 @@ HDC GUIAPI CreatePrivateSubDC (HDC hdc, int off_x, int off_y,
if (!(pdc = malloc(sizeof(DC))))
return HDC_INVALID;
InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList);
MAKE_REGION_INFINITE(&pdc->lcrgn);
InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList);
pdc->bInUse = TRUE;
pdc->DataType = TYPE_HDC;
/* XXX: use the parent's type */
pdc->DCType = pdc_parent->DCType;
InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList);
MAKE_REGION_INFINITE(&pdc->lcrgn);
InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList);
if (!dc_InitSubDC ((HDC)pdc, hdc, off_x, off_y, width, height)) {
if (!InitSubDC ((HDC)pdc, hdc, off_x, off_y, width, height)) {
free (pdc);
return HDC_INVALID;
}
@@ -4349,6 +4345,8 @@ static void on_surface_changed_for_control (struct _travel_context* ctxt,
RECT rc_surface, rc_minimal;
PDC pdc = dc_HDC2PDC (ctrl->privCDC);
_WRN_PRINTF ("called\n");
pdc->surface = ctxt->surface;
if (pdc->surface != __gal_screen) {
+4
View File
@@ -2,5 +2,9 @@ AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
noinst_LTLIBRARIES = libstandalone.la
if MG_MINIMALGDI
libstandalone_la_SOURCES =
else
libstandalone_la_SOURCES = standalone.c
endif
+5 -1
View File
@@ -2,14 +2,18 @@ AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
SUBDIRS = bmp icon font cursor
if MG_ENABLE_SPLASH
if MG_ENABLE_SCREENSAVER
if MG_ENABLE_SCREENSAVER
SUBDIRS+=license
endif
endif
noinst_LTLIBRARIES = libsysres.la
if MG_MINIMALGDI
libsysres_la_SOURCES = mgetc.c
else
libsysres_la_SOURCES = resource.c incoreres.c mgetc.c resmgr.c resmgr.h
endif
SRC_FILES=$(libsysres_la_SOURCES)
LIB_NAME=libsysres