Compare commits

..
Author SHA1 Message Date
Vincent Wei 2f72f24a49 debug 2022-08-20 17:29:43 +08:00
Vincent Wei 43e174a604 set dirty_rc empty initially 2022-08-20 17:23:16 +08:00
Vincent Wei 13d36a2785 add double_buffering options in fbcon section in MiniGUI.cfg 2022-08-20 16:26:23 +08:00
Vincent Wei 9ec3e9f7e6 support for double buffering for fbcon 2022-08-20 16:21:15 +08:00
Vincent Wei 148f1b1745 fix a typo 2022-04-24 11:48:37 +08:00
Vincent Wei f76c9187a8 remove _ERR_PRINTF 2022-03-21 17:52:01 +08:00
Vincent Wei 2e8eba7dd0 fix a deadlock bug: https://github.com/VincentWei/minigui/issues/83 2022-03-21 17:48:03 +08:00
Vincent Wei abeafa313d tune 2022-02-02 15:19:44 +08:00
Vincent Wei 310c0f3e7a The coordinates should be in device space for BitBlt and StretchBlt 2022-01-30 19:03:46 +08:00
Vincent Wei c426894ac9 change version to 5.0.9; change copyright year to 2022 2022-01-14 11:46:31 +08:00
Vincent Wei bf6998672f tune the fix 2021-12-17 15:02:21 +08:00
Vincent Wei ea83e92a16 Fix a bug: InitClipRgn on lrgn and ergn in InitSubDC; rename InitSubDC to dc_InitSubDC 2021-12-17 14:39:56 +08:00
Vincent Wei d95e827e93 update release notes for version 5.0.8 2021-10-20 16:36:28 +08:00
Vincent Wei 40f53732ff support for WebP is ready now (animation not supported) 2021-10-20 16:22:26 +08:00
Vincent Wei e2d2544ce6 cleanup 2021-10-20 16:20:50 +08:00
Vincent Wei 7cefc7d5ab initial support for WebP images 2021-10-20 12:09:40 +08:00
Vincent Wei b59ed4b7d1 implement __mg_check_webp, __mg_init_webp and __mg_cleanup_webp 2021-10-19 18:46:53 +08:00
Vincent Wei 5e43b76753 skeleton to support WebP file 2021-10-19 16:39:24 +08:00
Vincent Wei 894d0f64a2 Merge branch 'px30' into 'rel-5-0'
add option for platform px30

See merge request VincentWei/minigui!17
2021-06-21 16:29:17 +08:00
gengyue c18e0f3479 add option for platform px30 2021-06-21 16:24:31 +08:00
gengyue 8756b5de9f use inline for find_driver_for_device 2021-06-21 16:07:37 +08:00
gengyue 54a51ab02f add option for platform px30 2021-06-21 15:47:47 +08:00
gengyue 741a93aebd modifed find_driver_for_device for platfrom px30 2021-06-21 15:26:14 +08:00
gengyue aeb6642aad add option for platform px30 2021-06-21 14:45:53 +08:00
Vincent Wei 2fe23fa95b tune version 2021-06-08 14:26:14 +08:00
Vincent Wei a6eb81e916 cleanup: mark as deprected for old configuration options 2021-06-08 14:24:34 +08:00
Vincent Wei 93ec7e48b6 uncomment FBIO_ENABLE_CACHE for R818 2021-06-07 17:08:05 +08:00
Vincent Wei 956003092e fix conditional compilation errors 2021-06-07 16:46:13 +08:00
Vincent Wei 96b75c41c1 cleanup 2021-06-07 15:48:43 +08:00
Vincent Wei d6933b83e3 cleanup for the default values of TTF caches 2021-06-07 15:27:31 +08:00
Vincent Wei e2ba3681a1 cleanup: bad usage of __TARGET_UNKNOWN__ 2021-06-07 14:49:31 +08:00
Vincent Wei 0b47b83849 do not enable cache in fbvideo.c for R818 2021-06-07 10:53:26 +08:00
Vincent Wei 08419c0c95 tune fbcon code for compositing schema 2021-06-04 21:21:26 +08:00
Vincent Wei 03bc5befd5 tune fbcon code for r818 2021-06-04 19:50:41 +08:00
Vincent Wei ed37fa4fc2 tune fbcon code for r818 2021-06-04 19:29:58 +08:00
Vincent Wei 7268bcf92e tune fbcon code for r818 2021-06-04 19:12:30 +08:00
Vincent Wei 2d462ec749 tune fbcon code for r8181 2021-06-04 19:03:04 +08:00
Vincent Wei 11a4941dc7 tune 2021-06-04 17:22:45 +08:00
Vincent Wei d6281fd804 optimize calling of FBIO_CACHE_SYNC for R818 2021-06-04 16:50:41 +08:00
Vincent Wei 550fb04731 ioctls for FBVIDEO on R818 2021-06-04 15:52:03 +08:00
Vincent Wei e08a87fc93 add --with-target=r818 option 2021-06-04 15:29:11 +08:00
Vincent Wei cac16f1324 optimize to avoid using malloc/free for blit_ctxt; reset filter and transform of pixman images 2021-06-03 18:33:31 +08:00
Vincent Wei 2efb66cae0 change version to 5.0.7 2021-06-03 18:32:21 +08:00
Vincent Wei ad49fe0e0e fix warnings for conditional compilation 2021-05-19 13:16:19 +08:00
Vincent Wei ed0521df84 tune constants 2021-05-19 12:00:53 +08:00
Vincent Wei 002a03c087 shrink heap size for fixed string 2021-05-19 11:47:55 +08:00
41 changed files with 777 additions and 870 deletions
+2 -1
View File
@@ -566,6 +566,7 @@ 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
@@ -573,7 +574,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 ~ 2021, Beijing FMSoft Technologies Co., Ltd.
Copyright (C) 2002 ~ 2022, 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,5 +1,9 @@
# 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)
@@ -20,6 +24,43 @@
+ [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.6 (2021/05/20)
Version 5.0.9 (2022/01/14)
This is the first official release of MiniGUI 5.0.x, the stable version.
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
Other packages for MiniGUI resource, tools, components, and samples:
+126 -154
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -105,6 +105,12 @@ 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
+14 -23
View File
@@ -1,28 +1,19 @@
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
endif
textedit/libtextedit.la
if MGRM_STANDALONE
LITE_LADD = standalone/libstandalone.la
@@ -45,8 +36,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
+1 -1
View File
@@ -735,9 +735,9 @@ get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
pcache->valid_advance = 1;
}
}
done:
#endif
done:
FT_UNLOCK(&ft_lock);
if (px) {
+2 -2
View File
@@ -162,13 +162,13 @@ extern void __mg_ttc_sys_deinit(void);
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache, Glyph32 gv, int *size);
extern void __mg_ttc_refer(HCACHE hCache);
#endif /* _MGFONT_TTF_CACHE */
#ifdef _MGCOMPLEX_SCRIPTS
extern void __mg_init_harzbuff_funcs(void);
extern void __mg_term_harzbuff_funcs(void);
#endif
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
-3
View File
@@ -75,9 +75,6 @@
#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. */
+4 -20
View File
@@ -107,11 +107,7 @@ enum {
#define ZNIDX_DESKTOP 0
/* The heap size for mask rectangles */
#ifdef _MGRM_PROCESSES
# define DEF_NR_MASKRECTS 4096
#else
# define DEF_NR_MASKRECTS 1024
#endif
#define DEF_NR_MASKRECTS 1024
#if IS_COMPOSITING_SCHEMA
/* max number of shared surfaces (512) */
@@ -159,21 +155,9 @@ enum {
#endif
/* constants for fix string module */
#if defined (__NOUNIX__) || defined (__uClinux__)
#define MAX_LEN_FIXSTR 64
#define NR_HEAP 5
#define LEN_BITMAP (1+2+4+8+16)
#else
#ifdef _MGRM_THREADS
#define MAX_LEN_FIXSTR 2048
#define NR_HEAP 10
#define LEN_BITMAP (1+2+4+8+16+32+64+128+256+512)
#else
#define MAX_LEN_FIXSTR 1024
#define NR_HEAP 9
#define LEN_BITMAP (1+2+4+8+16+32+64+128+256)
#endif
#endif
#define MAX_LEN_FIXSTR 64
#define NR_HEAP 5
#define LEN_BITMAP (1+2+4+8+16)
/* constants for engine name and video mode */
#define LEN_SO_NAME 127 // name length of a shared object (library)
+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) __mg_lock_recalc_gcrinfo (pdc)
#define LOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_lock_recalc_gcrinfo (pdc)
#define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc)
# endif /* not defined _MGSCHEMA_COMPOSITING */
+9 -111
View File
@@ -54,26 +54,12 @@
# 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
};
@@ -85,14 +71,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 _MG_ENABLE_SPLASH or _MG_ENABLE_SCREENSAVER or _MG_ENABLE_WATERMARK*/
#endif
#ifdef _MG_ENABLE_SCREENSAVER
MG_LOCAL void __mg_screensaver_create(void);
@@ -102,9 +88,6 @@ 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);
@@ -115,96 +98,11 @@ MG_LOCAL void __mg_splash_delay(void);
# define __mg_splash_delay() /* NULL */
#endif /* endif _MG_ENABLE_SPLASH */
/*
* 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__ */
#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 */
#endif /* LICENSE_H */
+6 -10
View File
@@ -216,7 +216,10 @@ typedef struct GAL_Surface {
#ifdef _MGUSE_PIXMAN
pixman_image_t *pix_img; /* The pixman image object for this surface */
void *blit_ctxt; /* blitting context */
pixman_image_t *msk_img;
uint16_t pix_op;
uint16_t pix_filter;
uint32_t pix_alpha_bits;
#endif
#if IS_COMPOSITING_SCHEMA
@@ -818,13 +821,6 @@ 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);
@@ -1071,8 +1067,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,6 +138,14 @@ 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,17 +3,12 @@ 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: %u (times: %u)\n", total_time_ms / total_times, total_times);
_DBG_PRINTF ("Average time to composite the layers: %ums (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,6 +3641,9 @@ 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);
@@ -3680,9 +3683,6 @@ 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,9 +67,6 @@
#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
_MG_PRINTF("MGSlice: MemChecker: root=NULL\n");
_DBG_PRINTF("MGSlice: MemChecker: root=NULL\n");
pthread_mutex_unlock (&smc_tree_mutex);
-4
View File
@@ -5,13 +5,9 @@ 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
+7 -339
View File
@@ -69,11 +69,7 @@
#include "license.h"
#undef _MG_ENABLE_WATERMARK /* XXX: Always disable watermark */
#if defined(_MG_ENABLE_SPLASH) || \
defined(_MG_ENABLE_SCREENSAVER) || \
defined(_MG_ENABLE_WATERMARK)
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
BITMAP g_license_bitmaps[LICENSE_BITMAP_NR];
#ifndef _MG_LICENSE_SCREENSAVER_TIMEOUT
@@ -94,90 +90,16 @@ BITMAP g_license_bitmaps[LICENSE_BITMAP_NR];
#define _MG_LICENSE_SPLASH_MSEC (40)
#endif
#if defined(_MG_ENABLE_SCREENSAVER) || \
defined(_MG_ENABLE_WATERMARK)
#if defined(_MG_ENABLE_SCREENSAVER)
static int s_tick_last_input;
static BOOL screensaver_running;
extern int dskCreateTopZOrderNode (int cli, const RECT *rc);
extern int dskDestroyTopZOrderNode (int cli, int idx_znode);
extern void dskRefreshAllClient (const RECT* invrc);
#endif
#endif
/***********************************************************
* Product ID
***********************************************************/
#ifdef _MG_PRODUCTID
static unsigned char product_id_buffer[40] = {
PRODUCT_ID_PREFIX,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/* use this for splash display customer id by humingming 2010.8.12 */
int license_get_customer_id(void) {
return ((product_id_t*)product_id_buffer)->customer_id;
}
#else
//# warning PRODUCT_ID_is_DISABLED
#endif
/***********************************************************
* Watermark
***********************************************************/
#ifdef _MG_ENABLE_WATERMARK
#define MARGINSPACE 5
typedef struct _CornerInfo{
POINT pos;
HWND hwnd;
BITMAP* bmp;
}CornerInfo;
static CornerInfo fourcorner_info[4] = {
{{MARGINSPACE, MARGINSPACE} },
{{-MARGINSPACE, MARGINSPACE} },
{{MARGINSPACE, -MARGINSPACE} },
{{-MARGINSPACE, -MARGINSPACE} }
};
static void watermark_update(void)
{
int i = 0;
for (i = 0; i < TABLESIZE(fourcorner_info); i++)
FillBoxWithBitmap (HDC_SCREEN_SYS,
fourcorner_info[i].pos.x, fourcorner_info[i].pos.y,
0, 0, fourcorner_info[i].bmp);
}
static void watermark_init(void)
{
RECT rcScr = GetScreenRect();
fourcorner_info[0].bmp = &g_license_bitmaps[WATERMARK_1];
fourcorner_info[1].bmp = &g_license_bitmaps[WATERMARK_2];
fourcorner_info[2].bmp = &g_license_bitmaps[WATERMARK_3];
fourcorner_info[3].bmp = &g_license_bitmaps[WATERMARK_3];
/* right-top.*/
fourcorner_info[1].pos.x += RECTW(rcScr) - fourcorner_info[1].bmp->bmWidth;
/* left-bottom.*/
fourcorner_info[2].pos.y += RECTH(rcScr) - fourcorner_info[2].bmp->bmHeight;
/* right-bottom.*/
fourcorner_info[3].pos.x += RECTW(rcScr) - fourcorner_info[3].bmp->bmWidth;
fourcorner_info[3].pos.y += RECTH(rcScr) - fourcorner_info[3].bmp->bmHeight;
}
#else
# define watermark_update() /* NULL */
# define watermark_init() /* NULL */
#endif /* _MG_ENABLE_WATERMARK */
/***********************************************************
* Screensaver
***********************************************************/
@@ -291,16 +213,7 @@ void __mg_splash_draw_framework (void)
memset(text, 0, sizeof(text));
SetRect(&rc_text, SPLASH_ID_X, SPLASH_ID_Y, SPLASH_ID_X+SPLASH_ID_W, RECTH(rcScr));
#ifdef _MG_PRODUCTID
int customer_id = license_get_customer_id();
if (customer_id <= 0) {
sprintf(text, "SN: N/A");
} else {
sprintf(text, "SN: %d", customer_id);
}
#else
sprintf(text, "SN: N/A");
#endif
SetBkMode(HDC_SCREEN_SYS, BM_TRANSPARENT);
DrawText(HDC_SCREEN_SYS, text, -1, &rc_text, DT_TOP | DT_RIGHT | DT_SINGLELINE);
@@ -351,133 +264,9 @@ void __mg_splash_delay (void)
# define splash_init() /* NULL */
#endif /* _MG_ENABLE_SPLASH.*/
/***********************************************************
* License common
***********************************************************/
static unsigned char const_trans_table[] = {
0x16, 0xfe, 0xaf, 0x06, 0xd6, 0x9d, 0x54, 0x98,
0x77, 0x36, 0xc1, 0xc7, 0x29, 0xf8, 0x64, 0x93,
0x2e, 0x6b, 0x2a, 0x3c, 0x12, 0x13, 0x23, 0xc9,
0xe2, 0xa3, 0xbd, 0xbe, 0xac, 0xdf, 0x91, 0xe5,
0xdc, 0x4a, 0xc0, 0xb8, 0xd3, 0x2c, 0x61, 0x60,
0x5b, 0x32, 0x37, 0x7e, 0xb7, 0x8e, 0x2b, 0x0b,
0x19, 0x50, 0x40, 0xf3, 0x5f, 0x5d, 0x0d, 0x59,
0x21, 0xb1, 0xf6, 0xb5, 0xe3, 0xb3, 0x94, 0xa6,
0x31, 0x78, 0x84, 0xcc, 0x9c, 0x1b, 0x7b, 0x2f,
0x46, 0xa9, 0x9b, 0xda, 0xee, 0xd0, 0xc5, 0x7f,
0x4f, 0xc2, 0xa0, 0x9f, 0xe8, 0xb6, 0x3e, 0xbc,
0xf5, 0xae, 0x1c, 0x7d, 0xca, 0xf2, 0x65, 0xe0,
0x5a, 0x33, 0xfc, 0x3f, 0x49, 0x6d, 0xa1, 0x83,
0xcb, 0x4d, 0x0f, 0xf4, 0x55, 0xec, 0x8a, 0x04,
0x03, 0x7c, 0x86, 0x0e, 0xe4, 0xb4, 0x30, 0x99,
0xa2, 0xdb, 0x43, 0x8d, 0x92, 0x11, 0xef, 0x8f,
0x3a, 0xfb, 0xc6, 0x74, 0x0c, 0xb2, 0x97, 0x57,
0x48, 0x69, 0x70, 0x15, 0x22, 0x67, 0x18, 0x24,
0xf0, 0x82, 0xe7, 0x44, 0x9e, 0x53, 0x26, 0x81,
0x1f, 0xc8, 0x63, 0x96, 0x00, 0x20, 0x4e, 0xe1,
0x45, 0xd2, 0x75, 0x4c, 0x1d, 0x95, 0xbf, 0x52,
0x05, 0xd8, 0x09, 0x1e, 0x73, 0x1a, 0xd5, 0xab,
0x76, 0x08, 0xaa, 0xc4, 0x85, 0xb9, 0xd7, 0x8c,
0x02, 0x58, 0x4b, 0x47, 0x89, 0xdd, 0x62, 0xa5,
0xbb, 0x51, 0x10, 0xeb, 0x80, 0x79, 0xce, 0xfa,
0x87, 0xf1, 0xcf, 0xfd, 0x6a, 0x07, 0x2d, 0x38,
0xde, 0x41, 0x90, 0xb0, 0x25, 0x5e, 0xf7, 0xe6,
0x42, 0x9a, 0xe9, 0xed, 0x6c, 0xc3, 0x88, 0xd1,
0x6f, 0xd9, 0x7a, 0x0a, 0x68, 0x3d, 0x34, 0xcd,
0xff, 0x28, 0x3b, 0x35, 0x01, 0xea, 0x39, 0x8b,
0x14, 0x27, 0x56, 0xd4, 0x17, 0x72, 0xad, 0xa4,
0xf9, 0x5c, 0x66, 0xa8, 0x6e, 0xba, 0xa7, 0x71,
};
static unsigned char decrypt_byte(unsigned int ch) {
return const_trans_table[(ch-17)%256];
}
static void decrypt_mem(void *_data, int len) {
unsigned char *data = (unsigned char *)_data;
int i;
for (i=0; i<len; ++i) {
data[i] = decrypt_byte(data[i]);
}
}
unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int src){
decrypt_mem(&src, sizeof(src));
return src;
}
char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *src, int len){
decrypt_mem(src, len);
src[len] = 0;
return (char *)src;
}
#if defined(_MG_ENABLE_SPLASH) || \
defined(_MG_ENABLE_SCREENSAVER) || \
defined(_MG_ENABLE_WATERMARK)
/* disable cryptool */
#undef ENCRYPTED
#ifdef ENCRYPTED
# include "../sysres/license/c_files/key.c"
#endif
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
#include "../sysres/license/c_files/_splash_inner_res.c"
/* XXX: Other resource files are included in desktop.c event.c message.c zorder.c and window.c */
#if 0 /* XXX: WaterMark is REMOVED */
#ifdef _MG_ENABLE_LICENSE
# include "../sysres/license/c_files/05_watermark-fmsoft.dat.c"
# include "../sysres/license/c_files/06_watermark-minigui.dat.c"
# include "../sysres/license/c_files/07_watermark-evaluation.dat.c"
#endif /* _MG_ENABLE_SPLASH */
#endif
#ifdef ENCRYPTED
# include "rc4.c"
# define FRAGMENT_SIZE 512
static unsigned char calc_sum(int len, const unsigned char *data) {
unsigned char sum;
int i;
for (i=0, sum=0; i<len; ++i) {
sum -= data[i];
}
return sum;
}
static int decrypted_len(int len) {
return len - ((len-1) / FRAGMENT_SIZE + 1) * sizeof(unsigned char);
}
static int my_decrypt(RC4_KEY *key, int in_len, unsigned char *in) {
int out_len = 0;
int i;
unsigned char sum;
for (i=0; i<in_len; /* NULL */) {
int n;
RC4(key, sizeof(unsigned char), &in[i], (unsigned char *)&sum);
i += sizeof(unsigned char);
n = (in_len - i > FRAGMENT_SIZE - sizeof(unsigned char)) ? (FRAGMENT_SIZE - sizeof(unsigned char)) : (in_len - i);
RC4(key, n, &in[i], &in[out_len]);
if (calc_sum(n, &in[out_len]) != sum) {
assert(0);
return -1;
}
i += n;
out_len += n;
}
assert(out_len == decrypted_len(in_len));
return out_len;
}
#endif /* ENCRYPTED */
void __mg_license_create(void) {
int i;
@@ -485,26 +274,20 @@ void __mg_license_create(void) {
for (i=0; i<LICENSE_BITMAP_NR; ++i) {
unsigned char *data;
int len;
#ifdef ENCRYPTED
RC4_KEY rc4key;
#endif
data = (unsigned char *)malloc(__mg_splash_splash_inner_res[i].data_len);
memcpy(data, __mg_splash_splash_inner_res[i].data, __mg_splash_splash_inner_res[i].data_len);
len = __mg_splash_splash_inner_res[i].data_len;
#ifdef ENCRYPTED
RC4_set_key(&rc4key, sizeof(splash_crypto_key), splash_crypto_key);
len = my_decrypt(&rc4key, len, data);
#endif
LoadBitmapFromMem(HDC_SCREEN_SYS, &g_license_bitmaps[i], data, len, "png");
free(data);
}
splash_init();
#ifdef _MG_ENABLE_SCREENSAVER
watermark_init();
#endif
}
void __mg_license_destroy (void) {
@@ -514,120 +297,5 @@ void __mg_license_destroy (void) {
}
}
#endif /* _MG_ENABLE_SPLASH || _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
#endif /* defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER) */
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
void __mg_license_on_input(void)
{
#ifdef _MGRM_PROCESSES
RECT rcScr = GetScreenRect();
#endif
s_tick_last_input = GetTickCount();
if (screensaver_running == TRUE) {
screensaver_running = FALSE;
#if defined(_MGRM_THREADS)
{
HWND activeWnd = GetActiveWindow();
if (activeWnd) {
SendNotifyMessage(activeWnd, MSG_CANCELSCREENSAVER, 0, 0);
} else {
__mg_screensaver_hide();
SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
}
}
#else
__mg_screensaver_hide();
#if defined(_MGRM_PROCESSES)
dskRefreshAllClient (&rcScr);
#elif defined(_MGRM_STANDALONE)
SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
#else
# error
#endif
#endif
}
}
void __mg_license_on_timeout(void)
{
static unsigned int old_tick_count;
unsigned int current_tick_count;
#ifdef _MGRM_PROCESSES
if (!mgIsServer) {
return;
}
#endif
current_tick_count = GetTickCount();
if (screensaver_running == TRUE) {
/* screensaver is running, update the picture */
if ((current_tick_count - old_tick_count) > _MG_LICENSE_SCREENSAVER_UPDATE_TIME) {
old_tick_count = current_tick_count;
screensaver_update();
}
} else {
/* screensaver is not running, show it */
if ((current_tick_count - s_tick_last_input) > _MG_LICENSE_SCREENSAVER_TIMEOUT) {
screensaver_running = TRUE;
__mg_screensaver_show();
}
}
}
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
/***********************************************************
* Processor ID
***********************************************************/
#ifndef __TARGET_UNKNOWN__
void license_get_processor_id (void) {
g_license_processor_id = LICENSE_PROCESSOR_ID_NONE;
#if defined(_WITH_TARGET_S3C6410) || defined(_WITH_TARGET_S3C2440) || defined(_WITH_TARGET_S3C2410) \
|| defined (_WITH_TARGET_HI3560A)
{
int fd;
unsigned char *addr;
off_t SFR_offest;
size_t cpuid_offest;
unsigned char path[8] = "\x58\x1f\x6f\xc1\x58\x76\x6f\x76" /* "/dev/mem" */;
fd = open(LICENSE_ENCRYPTED_CONST_STRING(path, sizeof(path)), O_RDWR);
if (fd <= 0) {
return;
}
#ifdef _WITH_TARGET_S3C6410
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0x3CADA1AD /* 0x7E00F000 */);
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADADFD9F /* 0x00000118 */);
#elif _WITH_TARGET_HI3560A
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0xD3BCADAD /* 0x101E0000 */);
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADAD8470 /* 0x00000EE0 */);
#else /* 2440, 2410 */
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0x03ADADAD /* 0x56000000 */);
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADADADE4 /* 0x000000B0 */);
#endif
addr = mmap(NULL, (4<<10), PROT_READ, MAP_SHARED, fd, SFR_offest);
#if _WITH_TARGET_HI3560A
g_license_processor_id = *(unsigned int*)(addr+cpuid_offest+12) << 24 |
*(unsigned int*)(addr+cpuid_offest+8) << 16 |
*(unsigned int*)(addr+cpuid_offest+4) << 8 |
*(unsigned int*)(addr+cpuid_offest);
#else
g_license_processor_id = *(unsigned int*)(addr+cpuid_offest);
#endif
munmap(addr, (4<<10));
close(fd);
}
#else
//# warning PROCESSOR_ID_verfication_is_DISABLED_on_this_target
#endif
}
#endif /* __TARGET_UNKNOWN__ */
+3 -2
View File
@@ -1,8 +1,9 @@
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CPPFLAGS = $(WEBP_CFLAGS)
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 lbm.c pcx.c tga.c
SRC_FILES = mybmp.c winbmp.c gif.c jpeg.c png12.c png16.c webp.c lbm.c pcx.c tga.c
libmybmp_la_SOURCES = $(SRC_FILES)
+3 -2
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,7 +353,8 @@ 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,6 +98,9 @@ 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
@@ -0,0 +1,273 @@
///////////////////////////////////////////////////////////////////////////////
//
// 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~2021, 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/>.
*/
/*
** webp.c: Low-level WebP file read routines (based on LibWebP 0.6)
**
** Current maintainer: Wei Yongming
**
** Create date: 2021/10/19
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#ifdef _MGIMAGE_WEBP
#include "gdi.h"
#include "constants.h"
#include <webp/decode.h>
#define RIFF_HEADER_SIZE 12
#define HEADER_CHUNK_SIZE 32
#define READ_BUFF_SIZE 1024
struct webp_decode_info {
WebPDecoderConfig config;
size_t sz_data;
char data[READ_BUFF_SIZE];
};
void* __mg_init_webp(MG_RWops *fp, MYBITMAP *mybmp, RGB *pal)
{
int n;
size_t pitch;
struct webp_decode_info *info = NULL;
if ((info = malloc(sizeof(struct webp_decode_info))) == NULL) {
_ERR_PRINTF ("__mg_init_webp: failed to allocate memory\n");
return NULL;
}
if (!WebPInitDecoderConfig(&info->config)) {
_ERR_PRINTF ("__mg_init_webp: WebPInitDecoderConfig failed\n");
goto error;
}
info->sz_data = 0;
do {
VP8StatusCode sc;
if (info->sz_data + HEADER_CHUNK_SIZE > READ_BUFF_SIZE) {
_ERR_PRINTF ("__mg_init_webp: two small buffer\n");
goto error;
}
n = MGUI_RWread(fp, info->data + info->sz_data, 1, HEADER_CHUNK_SIZE);
if (n > 0) {
info->sz_data += n;
}
else
goto error;
sc = WebPGetFeatures(info->data, info->sz_data, &info->config.input);
if (sc == VP8_STATUS_OK) {
break;
}
else if (sc == VP8_STATUS_NOT_ENOUGH_DATA) {
continue;
}
else {
_ERR_PRINTF ("__mg_init_webp: WebPGetFeatures failed: %d\n", sc);
goto error;
}
} while (1);
if (info->config.input.has_animation) {
_ERR_PRINTF ("__mg_init_webp: animation not supported\n");
goto error;
}
#if SIZEOF_PTR == 8
info->config.options.no_fancy_upsampling = 0;
/* use default
info->config.options.dithering_strength = 100; */
/* use default
info->config.options.alpha_dithering_strength = 100; */
#else
info->config.options.no_fancy_upsampling = 1;
info->config.options.dithering_strength = 67;
info->config.options.alpha_dithering_strength = 33;
#endif
mybmp->w = info->config.input.width;
mybmp->h = info->config.input.height;
mybmp->frames = 1;
if (info->config.input.has_alpha) {
info->config.output.colorspace = MODE_RGBA;
mybmp->depth = 32;
mybmp->flags |= MYBMP_FLOW_DOWN | MYBMP_ALPHA | MYBMP_TYPE_RGBA;
mybmp->flags |= MYBMP_RGBSIZE_4;
pitch = (size_t)info->config.input.width * 4;
}
else {
info->config.output.colorspace = MODE_RGB;
mybmp->depth = 24;
mybmp->flags |= MYBMP_FLOW_DOWN | MYBMP_TYPE_RGB;
mybmp->flags |= MYBMP_RGBSIZE_3;
pitch = (size_t)info->config.input.width * 3;
}
pitch = ROUND_TO_MULTIPLE(pitch, 8);
mybmp->pitch = pitch;
info->config.output.width = info->config.input.width;
info->config.output.height = info->config.input.height;
return info;
error:
if (info)
free(info);
return NULL;
}
void __mg_cleanup_webp(void *init_info)
{
struct webp_decode_info *info = init_info;
if (info) {
free(info);
}
}
int __mg_load_webp(MG_RWops *fp, void *init_info, MYBITMAP *mybmp,
CB_ONE_SCANLINE cb, void *context)
{
int rc = ERR_BMP_OK;
struct webp_decode_info *info = init_info;
WebPIDecoder* idec = NULL;
int last_last_y = -1, last_y;
// Have config.output point to an external buffer:
info->config.output.is_external_memory = 1;
if (mybmp->flags & MYBMP_LOAD_ALLOCATE_ONE) {
info->config.output.u.RGBA.stride = mybmp->pitch;
info->config.output.u.RGBA.size = mybmp->pitch * mybmp->h;
mybmp->bits = realloc(mybmp->bits, info->config.output.u.RGBA.size);
}
else {
info->config.output.u.RGBA.stride = mybmp->pitch;
info->config.output.u.RGBA.size = mybmp->pitch * mybmp->h;
}
info->config.output.u.RGBA.rgba = (uint8_t*)mybmp->bits;
idec = WebPINewDecoder(&info->config.output);
if (idec == NULL) {
rc = ERR_BMP_MEM;
goto ret;
}
while (1) {
int n;
VP8StatusCode status = WebPIAppend(idec, info->data, info->sz_data);
if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
_ERR_PRINTF ("__mg_load_webp: WebPIAppend failed: %d\n", status);
rc = ERR_BMP_LOAD;
break;
}
if (WebPIDecGetRGB(idec, &last_y, NULL, NULL, NULL) &&
(--last_y > last_last_y)) {
int y;
for (y = last_last_y + 1; y <= last_y; y++) {
if (mybmp->flags & MYBMP_LOAD_ALLOCATE_ONE) {
mybmp->bits = info->config.output.u.RGBA.rgba;
mybmp->bits += mybmp->pitch * y;
}
if (cb)
cb(context, mybmp, y);
}
last_last_y = last_y;
}
/* read more data */
n = MGUI_RWread(fp, info->data, 1, sizeof(info->data));
if (n > 0) {
info->sz_data = n;
}
else if (n == 0) {
break;
}
else {
_ERR_PRINTF ("__mg_load_webp: MGUI_RWread failed: %d\n", n);
rc = ERR_BMP_LOAD;
break;
}
}
mybmp->bits = info->config.output.u.RGBA.rgba;
ret:
if (idec)
WebPIDelete(idec);
WebPFreeDecBuffer(&info->config.output);
return rc;
}
BOOL __mg_check_webp(MG_RWops* fp)
{
unsigned char header[RIFF_HEADER_SIZE];
if (MGUI_RWread(fp, header, 1, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
return FALSE;
return WebPGetInfo(header, RIFF_HEADER_SIZE, NULL, NULL);
}
#endif /* _MGIMAGE_WEBP */
+25 -35
View File
@@ -332,39 +332,37 @@ 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 (&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);
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);
}
else
ctxt->msk_img = NULL;
src->msk_img = NULL;
ops &= COLOR_BLEND_FLAGS_MASK;
if (ops == COLOR_BLEND_LEGACY) {
if ((src->flags & GAL_SRCPIXELALPHA) && src->format->Amask && src != dst) {
ctxt->op = PIXMAN_OP_OVER;
src->pix_op = PIXMAN_OP_OVER;
}
else {
ctxt->op = PIXMAN_OP_SRC;
src->pix_op = PIXMAN_OP_SRC;
}
}
else {
ctxt->op = ops;
src->pix_op = ops;
}
if (ctxt->op > PIXMAN_OP_HSL_LUMINOSITY ||
ctxt->op < PIXMAN_OP_CLEAR) {
ctxt->op = PIXMAN_OP_SRC;
if (src->pix_op > PIXMAN_OP_HSL_LUMINOSITY ||
src->pix_op < PIXMAN_OP_CLEAR) {
src->pix_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;
@@ -372,14 +370,13 @@ int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops)
int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst)
{
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;
if (src->msk_img) {
pixman_image_unref (src->msk_img);
src->msk_img = NULL;
}
pixman_image_set_clip_region32 (dst->pix_img, NULL);
return 0;
}
@@ -389,16 +386,9 @@ 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;
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;
}
msk_img = src->msk_img;
op = (pixman_op_t)src->pix_op;
_DBG_PRINTF ("srcrect: %d, %d, %dx%d; dstrect: %d, %d, %dx%d\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
@@ -411,8 +401,8 @@ static int GAL_PixmanBlit (struct GAL_Surface *src, GAL_Rect *srcrect,
pixman_image_set_clip_region32 (dst_img, &clip_region);
#endif
#if 0
// pixman_blt does not work
#if 0
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),
+5 -12
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,13 +1547,6 @@ 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);
}
+9 -2
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->blit_ctxt = NULL;
surface->msk_img = NULL;
#endif
#if IS_COMPOSITING_SCHEMA
surface->shared_header = NULL;
@@ -952,6 +952,11 @@ 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;
@@ -996,6 +1001,7 @@ 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)
@@ -1095,6 +1101,7 @@ 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);
@@ -3568,7 +3575,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,
unsigned long size, uint32_t drm_format, uint32_t pixels_off,
size_t size, uint32_t drm_format, uint32_t pixels_off,
uint32_t width, uint32_t height, uint32_t pitch)
{
GAL_VideoDevice *this = (GAL_VideoDevice *)video;
+84 -27
View File
@@ -62,9 +62,6 @@
#include "common.h"
#include "minigui.h"
#ifdef _MGRM_PROCESSES
#include "client.h"
#endif
#include "newgal.h"
#include "sysvideo.h"
#include "pixels_c.h"
@@ -73,6 +70,11 @@
#include "fbmatrox.h"
#include "fbneomagic.h"
#ifdef _MGRM_PROCESSES
#include "client.h"
#include "sharedres.h"
#endif
// #define FBCON_DEBUG 1
// #define FBACCEL_DEBUG 1
@@ -100,30 +102,35 @@ static void FB_FreeHWSurface(_THIS, GAL_Surface *surface);
static void FB_WaitVBL(_THIS);
static void FB_WaitIdle(_THIS);
#ifdef _MGSCHEMA_COMPOSITING
#include "../shadow-screen.h"
#include "debug.h"
#if defined(__TARGET_R818__)
#define FBIO_CACHE_SYNC 0x4630
#define FBIO_ENABLE_CACHE 0x4631
#endif
static BOOL FB_SyncUpdate (_THIS)
{
if (IsRectEmpty (&this->hidden->dirty_rc))
return FALSE;
if (shadowScreen_BlitToReal (this) == 0) {
#if defined(__TARGET_R818__)
uintptr_t args[2];
args[0] = (uintptr_t)this->hidden->real_screen->pixels;
args[0] += this->hidden->real_screen->pitch * this->hidden->dirty_rc.top;
args[1] = this->hidden->real_screen->pitch * RECTH(this->hidden->dirty_rc);
if (ioctl (console_fd, FBIO_CACHE_SYNC, args) < 0) {
_WRN_PRINTF ("failed to sync cache\n");
}
#endif
SetRectEmpty (&this->hidden->dirty_rc);
return TRUE;
}
return FALSE;
}
#endif /* _MGSCHEMA_COMPOSITING */
#if 0
static int FB_LockHWSurface(_THIS, GAL_Surface *surface);
static void FB_UnlockHWSurface(_THIS, GAL_Surface *surface);
static int FB_FlipHWSurface(_THIS, GAL_Surface *surface);
#endif
/* Internal palette functions */
static void FB_SavePalette(_THIS, struct fb_fix_screeninfo *finfo,
@@ -153,11 +160,9 @@ static int FB_Available(void)
static void FB_DeleteDevice(GAL_VideoDevice *device)
{
#ifdef _MGSCHEMA_COMPOSITING
if (device->hidden->shadow_screen) {
GAL_FreeSurface (device->hidden->real_screen);
}
#endif /* _MGSCHEMA_COMPOSITING */
free(device->hidden);
free(device);
@@ -181,11 +186,8 @@ static GAL_VideoDevice *FB_CreateDevice(int devindex)
return(0);
}
memset(this->hidden, 0, (sizeof *this->hidden));
/* For compositing schema, we force to use double buffering */
#ifdef _MGSCHEMA_COMPOSITING
this->hidden->magic = MAGIC_SHADOW_SCREEN_HEADER;
this->hidden->version = 0;
#endif
wait_vbl = FB_WaitVBL;
wait_idle = FB_WaitIdle;
@@ -262,7 +264,7 @@ static int FB_EnterGraphicsMode (_THIS)
if (ioctl (ttyfd, KDSETMODE, KD_GRAPHICS) == -1) {
_WRN_PRINTF ("Error when setting the terminal (%s) "
"to graphics mode: %m\n", tty_dev);
_WRN_PRINTF ("It might is not a console.\n");
_WRN_PRINTF ("It might not be a console.\n");
goto fail;
}
#ifdef _MGRM_PROCESSES
@@ -344,6 +346,18 @@ static int FB_VideoInit(_THIS, GAL_PixelFormat *vformat)
int i;
const char *GAL_fbdev;
#ifdef _MGSCHEMA_COMPOSITING
if (!mgIsServer) {
vformat->Amask = SHAREDRES_VIDEO_AMASK;
vformat->Rmask = SHAREDRES_VIDEO_RMASK;
vformat->Gmask = SHAREDRES_VIDEO_GMASK;
vformat->Bmask = SHAREDRES_VIDEO_BMASK;
vformat->BitsPerPixel = SHAREDRES_VIDEO_DEPTH;
vformat->BytesPerPixel = (SHAREDRES_VIDEO_DEPTH + 7) >> 3;
return 0;
}
#endif
/* Initialize the library */
GAL_fbdev = getenv("FRAMEBUFFER");
if (GAL_fbdev == NULL) {
@@ -571,6 +585,7 @@ static GAL_Surface *FB_SetVideoMode(_THIS, GAL_Surface *current,
Uint32 Amask;
char *surfaces_mem;
int surfaces_len;
BOOL dblbuff = FALSE;
#ifdef __TARGET_STB810__
bpp = 32;
@@ -755,6 +770,30 @@ static GAL_Surface *FB_SetVideoMode(_THIS, GAL_Surface *current,
// allocate hardware surface first.
GAL_PublicSurface = current;
dblbuff = TRUE;
}
else {
// client never call SetVideoMode
assert (0);
}
#elif !IS_SHAREDFB_SCHEMA_PROC
{
char tmp [8];
if (GetMgEtcValue ("fbcon", "double_buffering", tmp, 8) >= 0 &&
(strcasecmp (tmp, "true") == 0 || strcasecmp (tmp, "yes") == 0)) {
dblbuff = TRUE;
}
}
#endif /* !IS_SHAREDFB_SCHEMA_PROC */
if (dblbuff) {
#if defined(__TARGET_R818__)
uintptr_t args[2] = { 1, 0 };
if (ioctl(console_fd, FBIO_ENABLE_CACHE, args) < 0) {
GAL_SetError("NEWGAL/FBCON: FBIO_ENABLE_CACHE failed\n");
}
#endif
/* create shadow screen */
this->hidden->shadow_screen = GAL_CreateRGBSurface (GAL_HWSURFACE,
current->w, current->h,
@@ -763,10 +802,12 @@ static GAL_Surface *FB_SetVideoMode(_THIS, GAL_Surface *current,
current->format->Bmask, current->format->Amask);
if (this->hidden->shadow_screen) {
#if IS_COMPOSITING_SCHEMA
this->info.hw_cursor = 1;
this->hidden->cursor = NULL;
this->SetCursor = shadowScreen_SetCursor;
this->MoveCursor = shadowScreen_MoveCursor;
#endif
this->UpdateRects = shadowScreen_UpdateRects;
this->SyncUpdate = FB_SyncUpdate;
@@ -776,6 +817,7 @@ static GAL_Surface *FB_SetVideoMode(_THIS, GAL_Surface *current,
GAL_SetClipRect (this->hidden->real_screen, NULL);
GAL_SetColorKey (this->hidden->shadow_screen, 0, 0);
GAL_SetAlpha (this->hidden->shadow_screen, 0, 0);
SetRectEmpty (&this->hidden->dirty_rc);
}
else {
this->hidden->real_screen = NULL;
@@ -783,10 +825,9 @@ static GAL_Surface *FB_SetVideoMode(_THIS, GAL_Surface *current,
}
}
else {
// client never call SetVideoMode
assert (0);
this->hidden->real_screen = current;
this->hidden->shadow_screen = NULL;
}
#endif /* _MGSCHEMA_COMPOSITING */
/* We're done */
return (current);
@@ -997,11 +1038,16 @@ static int FB_AllocHWSurface (_THIS, GAL_Surface *surface)
REP_HWSURFACE reply = {0, 0, NULL};
#ifdef _MGRM_PROCESSES
if (mgIsServer)
if (mgIsServer) {
FB_RequestHWSurface (this, &request, &reply);
}
else {
REQUEST req;
#ifdef _MGSCHEMA_COMPOSITING
if (!mgIsServer)
return -1;
#endif
req.id = REQID_HWSURFACE;
req.data = &request;
req.len_data = sizeof (REQ_HWSURFACE);
@@ -1032,11 +1078,18 @@ static void FB_FreeHWSurface(_THIS, GAL_Surface *surface)
request.offset = (char*)surface->pixels - (char*)mapped_mem;
#ifdef _MGRM_PROCESSES
if (mgIsServer)
if (mgIsServer) {
FB_RequestHWSurface (this, &request, &reply);
}
else {
REQUEST req;
#ifdef _MGSCHEMA_COMPOSITING
surface->pixels = NULL;
surface->hwdata = NULL;
return;
#endif
if (surface->hwdata == NULL) {
surface->pixels = NULL;
return;
@@ -1132,7 +1185,7 @@ static void FB_SavePalette(_THIS, struct fb_fix_screeninfo *finfo,
/* Allocate new identity colormap */
for (i=0; i<256; ++i) {
new_entries[(0*256)+i] =
new_entries[(0*256)+i] =
new_entries[(1*256)+i] =
new_entries[(2*256)+i] = (i<<8)|i;
}
@@ -1218,6 +1271,12 @@ static int FB_SetColors(_THIS, int firstcolor, int ncolors, GAL_Color *colors)
*/
static void FB_VideoQuit(_THIS)
{
#ifdef _MGSCHEMA_COMPOSITING
if (!mgIsServer) {
return;
}
#endif
#ifdef _MGRM_PROCESSES
if (mgIsServer && this->screen) {
#else
@@ -1240,11 +1299,9 @@ static void FB_VideoQuit(_THIS)
}
}
#ifdef _MGSCHEMA_COMPOSITING
if (mgIsServer && this->hidden->shadow_screen) {
if (this->hidden->shadow_screen) {
GAL_FreeSurface (this->hidden->shadow_screen);
}
#endif
/* Clean up the memory bucket list */
#ifdef _MGRM_PROCESSES
+10 -10
View File
@@ -68,19 +68,26 @@ typedef struct vidmem_bucket {
/* Private display data */
struct GAL_PrivateVideoData {
/* For compositing schema, we force to use double buffering */
#ifdef _MGSCHEMA_COMPOSITING
/* 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.
*/
/* 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;
@@ -104,13 +111,6 @@ 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 */
+25 -44
View File
@@ -273,44 +273,38 @@ 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 (&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);
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);
}
else
ctxt->msk_img = NULL;
src->msk_img = NULL;
ctxt->filter = ops >> SCALING_FILTER_SHIFT;
if (ctxt->filter > PIXMAN_FILTER_CONVOLUTION) {
ctxt->filter = PIXMAN_FILTER_FAST;
src->pix_filter = ops >> SCALING_FILTER_SHIFT;
if (src->pix_filter > PIXMAN_FILTER_CONVOLUTION) {
src->pix_filter = PIXMAN_FILTER_FAST;
}
ops &= COLOR_BLEND_FLAGS_MASK;
if (ops == COLOR_BLEND_LEGACY) {
if ((src->flags & GAL_SRCPIXELALPHA) && src->format->Amask && src != dst) {
ctxt->op = PIXMAN_OP_OVER;
src->pix_op = PIXMAN_OP_OVER;
}
else {
ctxt->op = PIXMAN_OP_SRC;
src->pix_op = PIXMAN_OP_SRC;
}
}
else {
ctxt->op = ops;
src->pix_op = ops;
}
if (ctxt->op > PIXMAN_OP_HSL_LUMINOSITY ||
ctxt->op < PIXMAN_OP_CLEAR) {
ctxt->op = PIXMAN_OP_SRC;
if (src->pix_op > PIXMAN_OP_HSL_LUMINOSITY ||
src->pix_op < PIXMAN_OP_CLEAR) {
src->pix_op = PIXMAN_OP_SRC;
}
pixman_f_transform_init_identity (&ftransform);
@@ -350,7 +344,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)ctxt->filter, NULL, 0);
pixman_image_set_filter (src->pix_img, (pixman_filter_t)src->pix_filter, NULL, 0);
#endif
}
@@ -359,21 +353,15 @@ int GAL_SetupStretchBlit (GAL_Surface *src, GAL_Rect *srcrect,
int GAL_CleanupStretchBlit (GAL_Surface *src, GAL_Surface *dst)
{
if (src->blit_ctxt) {
pixman_transform_t transform;
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);
if (src->msk_img) {
pixman_image_unref (src->msk_img);
src->msk_img = NULL;
}
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);
return 0;
}
@@ -390,15 +378,8 @@ int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
return GAL_StretchBltLegacy (src, srcrect, dst, dstrect,
ops & COLOR_BLEND_FLAGS_MASK);
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;
}
msk_img = src->msk_img;
op = (pixman_op_t)src->pix_op;
_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,
+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->blit_ctxt = NULL;
surface->msk_img = 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->blit_ctxt = NULL;
surface->msk_img = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
@@ -278,7 +278,7 @@ error:
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->blit_ctxt = NULL;
surface->msk_img = 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->blit_ctxt = NULL;
surface->msk_img = 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->blit_ctxt = NULL;
surface->msk_img = 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->blit_ctxt = NULL;
surface->msk_img = NULL;
#endif
surface->shared_header = NULL;
surface->dirty_info = NULL;
+6 -4
View File
@@ -144,7 +144,7 @@ GAL_Surface * GAL_CreateRGBSurface (Uint32 flags,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->blit_ctxt = NULL;
surface->msk_img = NULL;
#endif
#if IS_COMPOSITING_SCHEMA
surface->shared_header = NULL;
@@ -1870,13 +1870,15 @@ 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->blit_ctxt) {
_WRN_PRINTF ("There is not cleaned up blitting context: %p\n", surface->blit_ctxt);
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;
}
#endif
+1 -1
View File
@@ -1257,7 +1257,7 @@ static GAL_Surface *Slave_CreateSurface (GAL_VideoDevice *this,
surface->format_version = 0;
#ifdef _MGUSE_PIXMAN
surface->pix_img = NULL;
surface->blit_ctxt = NULL;
surface->msk_img = NULL;
#endif
#if IS_COMPOSITING_SCHEMA
surface->shared_header = NULL;
-6
View File
@@ -3,11 +3,6 @@ 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 \
@@ -20,7 +15,6 @@ 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 \
+75 -14
View File
@@ -1108,6 +1108,11 @@ 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);
@@ -1123,6 +1128,16 @@ 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)
@@ -1378,12 +1393,11 @@ void GUIAPI StretchBltLegacy (HDC hsdc, int sx, int sy, int sw, int sh,
if (!(pddc = __mg_check_ecrgn (hddc)))
return;
// Transfer logical to device to screen here.
/* The coordinates should be in device space. */
#if 0
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;
@@ -1392,8 +1406,6 @@ 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;
@@ -1401,15 +1413,41 @@ 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 < 0 || sx >= RECTW(psdc->DevRC) || (sx + sw) > RECTW(psdc->DevRC))
if ((sx + sw) < 0 || sx >= psdc->DevRC.right)
goto error_ret;
if (sy < 0 || sy >= RECTH(psdc->DevRC) || (sy + sh) > RECTH(psdc->DevRC))
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))
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;
@@ -1492,12 +1530,11 @@ BOOL GUIAPI StretchBltEx (HDC hsdc, int sx, int sy, int sw, int sh,
if (!(pddc = __mg_check_ecrgn (hddc)))
return retv;
// Transfer logical to device to screen here.
/* The coordinates should be in device space. */
#if 0
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;
@@ -1506,8 +1543,6 @@ 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;
@@ -1515,15 +1550,41 @@ 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 < 0 || sx >= RECTW(psdc->DevRC) || (sx + sw) > RECTW(psdc->DevRC))
if ((sx + sw) < 0 || sx >= psdc->DevRC.right)
goto error_ret;
if (sy < 0 || sy >= RECTH(psdc->DevRC) || (sy + sh) > RECTH(psdc->DevRC))
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))
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);
+12 -10
View File
@@ -15,7 +15,7 @@
* 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) 2002~2022, 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 InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y,
static BOOL dc_InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y,
int width, int height)
{
int parent_width,parent_height;
@@ -2564,7 +2564,11 @@ HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height)
if (pdc == NULL)
return HDC_INVALID;
if (!InitSubDC((HDC)pdc, hdc, off_x, off_y, width, height)) {
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)) {
pdc->bInUse = FALSE;
return HDC_INVALID;
}
@@ -2654,16 +2658,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;
if (!InitSubDC ((HDC)pdc, hdc, off_x, off_y, width, height)) {
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)) {
free (pdc);
return HDC_INVALID;
}
@@ -4345,8 +4349,6 @@ 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,9 +2,5 @@ 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
+1 -5
View File
@@ -2,18 +2,14 @@ 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