mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-25 02:33:59 +08:00
Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abeafa313d | ||
|
|
310c0f3e7a | ||
|
|
c426894ac9 | ||
|
|
bf6998672f | ||
|
|
ea83e92a16 | ||
|
|
d95e827e93 | ||
|
|
40f53732ff | ||
|
|
e2d2544ce6 | ||
|
|
7cefc7d5ab | ||
|
|
b59ed4b7d1 | ||
|
|
5e43b76753 | ||
|
|
894d0f64a2 | ||
|
|
c18e0f3479 | ||
|
|
8756b5de9f | ||
|
|
54a51ab02f | ||
|
|
741a93aebd | ||
|
|
aeb6642aad |
@@ -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
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
Version 5.0.7 (2021/06/30)
|
||||
Version 5.0.9 (2022/01/14)
|
||||
|
||||
This is a bugfix 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:
|
||||
|
||||
|
||||
+33
-6
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT(libminigui, 5.0.7)
|
||||
AC_INIT(libminigui, 5.0.9)
|
||||
AC_CONFIG_SRCDIR(src/main/main.c)
|
||||
|
||||
dnl Set various version strings - taken gratefully from the SDL sources
|
||||
@@ -16,9 +16,9 @@ dnl Set various version strings - taken gratefully from the SDL sources
|
||||
#
|
||||
MINIGUI_MAJOR_VERSION=5
|
||||
MINIGUI_MINOR_VERSION=0
|
||||
MINIGUI_MICRO_VERSION=7
|
||||
MINIGUI_INTERFACE_AGE=1
|
||||
MINIGUI_BINARY_AGE=1
|
||||
MINIGUI_MICRO_VERSION=9
|
||||
MINIGUI_INTERFACE_AGE=3
|
||||
MINIGUI_BINARY_AGE=3
|
||||
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
||||
|
||||
AC_SUBST(MINIGUI_MAJOR_VERSION)
|
||||
@@ -222,6 +222,7 @@ build_save_bitmap="yes"
|
||||
build_gif_support="yes"
|
||||
build_jpg_support="yes"
|
||||
build_png_support="yes"
|
||||
build_webp_support="yes"
|
||||
build_pcx_support="no"
|
||||
build_lbm_support="no"
|
||||
build_tga_support="no"
|
||||
@@ -727,6 +728,10 @@ AC_ARG_ENABLE(pngsupport,
|
||||
[ --enable-pngsupport include PNG file support <default=yes>],
|
||||
build_png_support=$enableval)
|
||||
|
||||
AC_ARG_ENABLE(webpsupport,
|
||||
[ --enable-webpsupport include WebP file support <default=yes>],
|
||||
build_webp_support=$enableval)
|
||||
|
||||
AC_ARG_ENABLE(menu,
|
||||
[ --enable-menu include menu support <default=yes>],
|
||||
build_menu=$enableval)
|
||||
@@ -1438,6 +1443,12 @@ case "$libpng_version" in
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Check for WebP library.
|
||||
if test "x$build_webp_support" = "xyes"; then
|
||||
PKG_CHECK_MODULES([WEBP], [libwebp >= 0.6.0], [foo=bar],
|
||||
[build_webp_support="no; support WebP file requires libwebp 0.6.0 or later."])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(MINIGUI_MAJOR_VERSION, $MINIGUI_MAJOR_VERSION,
|
||||
[Major version of MiniGUI])
|
||||
AC_DEFINE_UNQUOTED(MINIGUI_MINOR_VERSION, $MINIGUI_MINOR_VERSION,
|
||||
@@ -2436,16 +2447,30 @@ fi
|
||||
|
||||
if test "x$build_jpg_support" = "xyes"; then
|
||||
AC_DEFINE(_MGIMAGE_JPG, 1,
|
||||
[Define if support JPEG bmp file format])
|
||||
[Define if support JPEG file format])
|
||||
fi
|
||||
|
||||
if test "x$build_png_support" = "xyes"; then
|
||||
AC_DEFINE(_MGIMAGE_PNG, 1,
|
||||
[Define if support PNG bmp file format])
|
||||
[Define if support PNG file format])
|
||||
AC_DEFINE_UNQUOTED(_MGLIBPNG_VER, $libpng_version,
|
||||
[Define version of libpng])
|
||||
fi
|
||||
|
||||
if test "x$build_webp_support" = "xyes"; then
|
||||
AC_DEFINE(_MGIMAGE_WEBP, 1,
|
||||
[Define if support WebP file format])
|
||||
AC_ARG_WITH(webp_includes,
|
||||
[ --with-webp-includes=DIR where the libwebp includes are])
|
||||
|
||||
if test "x$with_webp_includes" != "x"; then
|
||||
WEBP_CFLAGS="-I$with_webp_includes"
|
||||
fi
|
||||
|
||||
DEP_LIBS="$DEP_LIBS $WEBP_LIBS"
|
||||
AC_SUBST(WEBP_CFLAGS)
|
||||
fi
|
||||
|
||||
if test "x$build_menu" = "xyes"; then
|
||||
AC_DEFINE(_MGHAVE_MENU, 1,
|
||||
[Define if support menu])
|
||||
@@ -2774,6 +2799,7 @@ AC_MSG_NOTICE([
|
||||
## Other Features:
|
||||
* JPEG: ${build_jpg_support}
|
||||
* PNG: ${build_png_support}
|
||||
* WebP: ${build_webp_support}
|
||||
* Unicode: ${build_unicode_support}
|
||||
* Complex Scripts: ${build_complex_scripts}
|
||||
|
||||
@@ -2782,6 +2808,7 @@ AC_MSG_NOTICE([
|
||||
* CPP flags: ${CPPFLAGS}
|
||||
* CC flags: ${CFLAGS}
|
||||
* CXX flags: ${CXXFLAGS}
|
||||
* LibWebP includes: ${WEBP_CFLAGS}
|
||||
* Pixman includes: ${PIXMAN_CFLAGS}
|
||||
* FreeType2 includes: ${FT2_INC_DIR}
|
||||
* HarfBuzz includes: ${HB_INC_DIR}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 */
|
||||
|
||||
+4
-2
@@ -375,6 +375,8 @@ int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst)
|
||||
src->msk_img = NULL;
|
||||
}
|
||||
|
||||
pixman_image_set_clip_region32 (dst->pix_img, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -384,7 +386,7 @@ 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;
|
||||
|
||||
@@ -399,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),
|
||||
|
||||
@@ -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)
|
||||
@@ -1094,11 +1100,7 @@ static int open_drm_device(GAL_VideoDevice *device)
|
||||
|
||||
_DBG_PRINTF("Try to load DRM driver: %s\n", driver_name);
|
||||
|
||||
#if defined(__TARGET_PX30__)
|
||||
fd = drmOpen("rockchip", NULL);
|
||||
#else
|
||||
fd = drmOpen(driver_name, NULL);
|
||||
#endif
|
||||
|
||||
if (fd < 0) {
|
||||
_ERR_PRINTF("NEWGAL>DRM: drmOpen failed\n");
|
||||
|
||||
+75
-14
@@ -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
-8
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user