1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

arch: use a flatter directory structure

This commit is contained in:
Gabor Kiss-Vamosi 2022-07-20 11:27:46 +02:00
parent d6e5200013
commit c79501bdce
146 changed files with 10529 additions and 10096 deletions

71
lvgl.h
View File

@ -43,30 +43,69 @@ extern "C" {
#include "src/font/lv_font_loader.h"
#include "src/font/lv_font_fmt_txt.h"
#include "src/widgets/lv_arc.h"
#include "src/widgets/lv_btn.h"
#include "src/widgets/lv_img.h"
#include "src/widgets/lv_label.h"
#include "src/widgets/lv_line.h"
#include "src/widgets/lv_table.h"
#include "src/widgets/lv_checkbox.h"
#include "src/widgets/lv_bar.h"
#include "src/widgets/lv_slider.h"
#include "src/widgets/lv_btnmatrix.h"
#include "src/widgets/lv_dropdown.h"
#include "src/widgets/lv_roller.h"
#include "src/widgets/lv_textarea.h"
#include "src/widgets/lv_canvas.h"
#include "src/widgets/lv_switch.h"
#include "src/widgets/animimg/lv_animimg.h"
#include "src/widgets/arc/lv_arc.h"
#include "src/widgets/bar/lv_bar.h"
#include "src/widgets/btn/lv_btn.h"
#include "src/widgets/btnmatrix/lv_btnmatrix.h"
#include "src/widgets/calendar/lv_calendar.h"
#include "src/widgets/canvas/lv_canvas.h"
#include "src/widgets/chart/lv_chart.h"
#include "src/widgets/checkbox/lv_checkbox.h"
#include "src/widgets/colorwheel/lv_colorwheel.h"
#include "src/widgets/dropdown/lv_dropdown.h"
#include "src/widgets/img/lv_img.h"
#include "src/widgets/imgbtn/lv_imgbtn.h"
#include "src/widgets/keyboard/lv_keyboard.h"
#include "src/widgets/label/lv_label.h"
#include "src/widgets/led/lv_led.h"
#include "src/widgets/line/lv_line.h"
#include "src/widgets/list/lv_list.h"
#include "src/widgets/menu/lv_menu.h"
#include "src/widgets/meter/lv_meter.h"
#include "src/widgets/msgbox/lv_msgbox.h"
#include "src/widgets/roller/lv_roller.h"
#include "src/widgets/slider/lv_slider.h"
#include "src/widgets/span/lv_span.h"
#include "src/widgets/spinbox/lv_spinbox.h"
#include "src/widgets/spinner/lv_spinner.h"
#include "src/widgets/switch/lv_switch.h"
#include "src/widgets/table/lv_table.h"
#include "src/widgets/tabview/lv_tabview.h"
#include "src/widgets/textarea/lv_textarea.h"
#include "src/widgets/tileview/lv_tileview.h"
#include "src/widgets/win/lv_win.h"
#include "src/others/snapshot/lv_snapshot.h"
#include "src/others/monkey/lv_monkey.h"
#include "src/others/gridnav/lv_gridnav.h"
#include "src/others/fragment/lv_fragment.h"
#include "src/others/imgfont/lv_imgfont.h"
#include "src/others/msg/lv_msg.h"
#include "src/others/ime/lv_ime_pinyin.h"
#include "src/libs/bmp/lv_bmp.h"
#include "src/libs/fsdrv/lv_fsdrv.h"
#include "src/libs/png/lv_png.h"
#include "src/libs/gif/lv_gif.h"
#include "src/libs/qrcode/lv_qrcode.h"
#include "src/libs/sjpg/lv_sjpg.h"
#include "src/libs/freetype/lv_freetype.h"
#include "src/libs/rlottie/lv_rlottie.h"
#include "src/libs/ffmpeg/lv_ffmpeg.h"
#include "src/layouts/flex/lv_flex.h"
#include "src/layouts/grid/lv_grid.h"
#include "src/draw/lv_draw.h"
#include "src/themes/lv_themes.h"
#include "src/lv_api_map.h"
/*-----------------
* EXTRAS
*----------------*/
#include "src/extra/lv_extra.h"
/*********************
* DEFINES

13
lvgl.mk
View File

@ -1,9 +1,4 @@
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/demos/lv_demos.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples/lv_examples.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/core/lv_core.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/lv_draw.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra/lv_extra.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font/lv_font.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/hal/lv_hal.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/misc/lv_misc.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/widgets/lv_widgets.mk
CSRCS += $(shell find $(LVGL_DIR_NAME)/src -type f -name '*.c')
CSRCS += $(shell find $(LVGL_DIR_NAME)/demos -type f -name '*.c')
CSRCS += $(shell find $(LVGL_DIR_NAME)/examples -type f -name '*.c')
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)"

View File

@ -21,11 +21,20 @@
#include "../misc/lv_gc.h"
#include "../misc/lv_math.h"
#include "../misc/lv_log.h"
#include "../libs/bmp/lv_bmp.h"
#include "../libs/ffmpeg/lv_ffmpeg.h"
#include "../libs/freetype/lv_freetype.h"
#include "../libs/fsdrv/lv_fsdrv.h"
#include "../libs/gif/lv_gif.h"
#include "../libs/png/lv_png.h"
#include "../libs/sjpg/lv_sjpg.h"
#include "../layouts/flex/lv_flex.h"
#include "../layouts/grid/lv_grid.h"
#if LV_USE_BUILTIN_MALLOC
#include "../misc/lv_mem_builtin.h"
#endif
#include "../hal/lv_hal.h"
#include "../extra/lv_extra.h"
#include <stdint.h>
#include <string.h>
@ -180,7 +189,59 @@ void lv_init(void)
LV_LOG_WARN("Log level is set to 'Trace' which makes LVGL much slower");
#endif
lv_extra_init();
#if LV_USE_FLEX
lv_flex_init();
#endif
#if LV_USE_GRID
lv_grid_init();
#endif
#if LV_USE_MSG
lv_msg_init();
#endif
#if LV_USE_FS_FATFS != '\0'
lv_fs_fatfs_init();
#endif
#if LV_USE_FS_STDIO != '\0'
lv_fs_stdio_init();
#endif
#if LV_USE_FS_POSIX != '\0'
lv_fs_posix_init();
#endif
#if LV_USE_FS_WIN32 != '\0'
lv_fs_win32_init();
#endif
#if LV_USE_FFMPEG
lv_ffmpeg_init();
#endif
#if LV_USE_PNG
lv_png_init();
#endif
#if LV_USE_SJPG
lv_split_jpeg_init();
#endif
#if LV_USE_BMP
lv_bmp_init();
#endif
#if LV_USE_FREETYPE
/*Init freetype library*/
# if LV_FREETYPE_CACHE_SIZE >= 0
lv_freetype_init(LV_FREETYPE_CACHE_FT_FACES, LV_FREETYPE_CACHE_FT_SIZES, LV_FREETYPE_CACHE_SIZE);
# else
lv_freetype_init(0, 0, 0);
# endif
#endif
lv_initialized = true;

View File

@ -17,10 +17,10 @@
#include "../misc/lv_gc.h"
#include "../draw/lv_draw.h"
#include "../font/lv_font_fmt_txt.h"
#include "../extra/others/snapshot/lv_snapshot.h"
#include "../others/snapshot/lv_snapshot.h"
#if LV_USE_PERF_MONITOR || LV_USE_MEM_MONITOR
#include "../widgets/lv_label.h"
#include "../widgets/label/lv_label.h"
#endif
/*********************

View File

@ -1,31 +0,0 @@
# Extra components
This directory contains extra (optional) components to lvgl.
It's a good place for contributions as there are less strict expectations about the completeness and flexibility of the components here.
In other words, if you have created a complex widget from other widgets, or modified an existing widget with special events, styles or animations, or have a new feature that could work as a plugin to lvgl feel free to the share it here.
## How to contribute
- Create a [Pull request](https://docs.lvgl.io/8.0/CONTRIBUTING.html#pull-request) with your new content
- Please and follow the [Coding style](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md) of LVGL
- Add setter/getter functions in pair
- Update [lv_conf_template.h](https://github.com/lvgl/lvgl/blob/master/lv_conf_template.h)
- Add description in the [docs](https://github.com/lvgl/lvgl/tree/master/docs)
- Add [examples](https://github.com/lvgl/lvgl/tree/master/examples)
- Update the [changelog](https://github.com/lvgl/lvgl/tree/master/docs/CHANGELOG.md)
- Add yourself to the [Contributors](#contributors) section below.
## Ideas
Here some ideas as inspiration feel free to contribute with ideas too.
- New [Calendar headers](https://github.com/lvgl/lvgl/tree/master/src/extra/widgets/calendar)
- Color picker with RGB and or HSV bars
- Ruler, horizontal or vertical with major and minor ticks and labels
- New [List items types](https://github.com/lvgl/lvgl/tree/master/src/extra/widgets/list)
- [Preloaders](https://www.google.com/search?q=preloader&sxsrf=ALeKk01ddA4YB0WEgLLN1bZNSm8YER7pkg:1623080551559&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiwoN6d7oXxAhVuw4sKHVedBB4Q_AUoAXoECAEQAw&biw=952&bih=940)
- Drop-down list with a container to which content can be added
- 9 patch button: Similar to [lv_imgbtn](https://docs.lvgl.io/8.0/widgets/extra/imgbtn.html) but 9 images for 4 corner, 4 sides and the center
## Contributors
- lv_animimg: @ZhaoQiang-b45475
- lv_span: @guoweilkd
- lv_menu: @HX2003

View File

@ -1,44 +0,0 @@
/**
* @file lv_layouts.h
*
*/
#ifndef LV_LAYOUTS_H
#define LV_LAYOUTS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "flex/lv_flex.h"
#include "grid/lv_grid.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#if LV_USE_LOG && LV_LOG_TRACE_LAYOUT
# define LV_TRACE_LAYOUT(...) LV_LOG_TRACE(__VA_ARGS__)
#else
# define LV_TRACE_LAYOUT(...)
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LAYOUTS_H*/

View File

@ -1,46 +0,0 @@
/**
* @file lv_libs.h
*
*/
#ifndef LV_LIBS_H
#define LV_LIBS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "bmp/lv_bmp.h"
#include "fsdrv/lv_fsdrv.h"
#include "png/lv_png.h"
#include "gif/lv_gif.h"
#include "qrcode/lv_qrcode.h"
#include "sjpg/lv_sjpg.h"
#include "freetype/lv_freetype.h"
#include "rlottie/lv_rlottie.h"
#include "ffmpeg/lv_ffmpeg.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LIBS_H*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +0,0 @@
/*----------------------------------------------------------------------------/
/ TJpgDec - Tiny JPEG Decompressor R0.03 include file (C)ChaN, 2021
/----------------------------------------------------------------------------*/
#ifndef DEF_TJPGDEC
#define DEF_TJPGDEC
#ifdef __cplusplus
extern "C" {
#endif
#include "../../../lv_conf_internal.h"
#if LV_USE_SJPG
#include "tjpgdcnf.h"
#include <string.h>
#include <stdint.h>
#if JD_FASTDECODE >= 1
typedef int16_t jd_yuv_t;
#else
typedef uint8_t jd_yuv_t;
#endif
/* Error code */
typedef enum {
JDR_OK = 0, /* 0: Succeeded */
JDR_INTR, /* 1: Interrupted by output function */
JDR_INP, /* 2: Device error or wrong termination of input stream */
JDR_MEM1, /* 3: Insufficient memory pool for the image */
JDR_MEM2, /* 4: Insufficient stream input buffer */
JDR_PAR, /* 5: Parameter error */
JDR_FMT1, /* 6: Data format error (may be broken data) */
JDR_FMT2, /* 7: Right format but not supported */
JDR_FMT3 /* 8: Not supported JPEG standard */
} JRESULT;
/* Rectangular region in the output image */
typedef struct {
uint16_t left; /* Left end */
uint16_t right; /* Right end */
uint16_t top; /* Top end */
uint16_t bottom; /* Bottom end */
} JRECT;
/* Decompressor object structure */
typedef struct JDEC JDEC;
struct JDEC {
size_t dctr; /* Number of bytes available in the input buffer */
uint8_t* dptr; /* Current data read ptr */
uint8_t* inbuf; /* Bit stream input buffer */
uint8_t dbit; /* Number of bits availavble in wreg or reading bit mask */
uint8_t scale; /* Output scaling ratio */
uint8_t msx, msy; /* MCU size in unit of block (width, height) */
uint8_t qtid[3]; /* Quantization table ID of each component, Y, Cb, Cr */
uint8_t ncomp; /* Number of color components 1:grayscale, 3:color */
int16_t dcv[3]; /* Previous DC element of each component */
uint16_t nrst; /* Restart inverval */
uint16_t width, height; /* Size of the input image (pixel) */
uint8_t* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
uint16_t* huffcode[2][2]; /* Huffman code word tables [id][dcac] */
uint8_t* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
int32_t* qttbl[4]; /* Dequantizer tables [id] */
#if JD_FASTDECODE >= 1
uint32_t wreg; /* Working shift register */
uint8_t marker; /* Detected marker (0:None) */
#if JD_FASTDECODE == 2
uint8_t longofs[2][2]; /* Table offset of long code [id][dcac] */
uint16_t* hufflut_ac[2]; /* Fast huffman decode tables for AC short code [id] */
uint8_t* hufflut_dc[2]; /* Fast huffman decode tables for DC short code [id] */
#endif
#endif
void* workbuf; /* Working buffer for IDCT and RGB output */
jd_yuv_t* mcubuf; /* Working buffer for the MCU */
void* pool; /* Pointer to available memory pool */
size_t sz_pool; /* Size of momory pool (bytes available) */
size_t (*infunc)(JDEC*, uint8_t*, size_t); /* Pointer to jpeg stream input function */
void* device; /* Pointer to I/O device identifiler for the session */
};
/* TJpgDec API functions */
JRESULT jd_prepare (JDEC* jd, size_t (*infunc)(JDEC*,uint8_t*,size_t), void* pool, size_t sz_pool, void* dev);
JRESULT jd_decomp (JDEC* jd, int (*outfunc)(JDEC*,void*,JRECT*), uint8_t scale);
#endif /*LV_USE_SJPG*/
#ifdef __cplusplus
}
#endif
#endif /* _TJPGDEC */

View File

@ -1,93 +0,0 @@
/**
* @file lv_extra.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_extra_init(void)
{
#if LV_USE_FLEX
lv_flex_init();
#endif
#if LV_USE_GRID
lv_grid_init();
#endif
#if LV_USE_MSG
lv_msg_init();
#endif
#if LV_USE_FS_FATFS != '\0'
lv_fs_fatfs_init();
#endif
#if LV_USE_FS_STDIO != '\0'
lv_fs_stdio_init();
#endif
#if LV_USE_FS_POSIX != '\0'
lv_fs_posix_init();
#endif
#if LV_USE_FS_WIN32 != '\0'
lv_fs_win32_init();
#endif
#if LV_USE_FFMPEG
lv_ffmpeg_init();
#endif
#if LV_USE_PNG
lv_png_init();
#endif
#if LV_USE_SJPG
lv_split_jpeg_init();
#endif
#if LV_USE_BMP
lv_bmp_init();
#endif
#if LV_USE_FREETYPE
/*Init freetype library*/
# if LV_FREETYPE_CACHE_SIZE >= 0
lv_freetype_init(LV_FREETYPE_CACHE_FT_FACES, LV_FREETYPE_CACHE_FT_SIZES, LV_FREETYPE_CACHE_SIZE);
# else
lv_freetype_init(0, 0, 0);
# endif
#endif
}
/**********************
* STATIC FUNCTIONS
**********************/

View File

@ -1,48 +0,0 @@
/**
* @file lv_extra.h
*
*/
#ifndef LV_EXTRA_H
#define LV_EXTRA_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "layouts/lv_layouts.h"
#include "libs/lv_libs.h"
#include "others/lv_others.h"
#include "themes/lv_themes.h"
#include "widgets/lv_widgets.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the extra components
*/
void lv_extra_init(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_EXTRA_H*/

View File

@ -1 +0,0 @@
CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra -name \*.c)

View File

@ -1,44 +0,0 @@
/**
* @file lv_others.h
*
*/
#ifndef LV_OTHERS_H
#define LV_OTHERS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "snapshot/lv_snapshot.h"
#include "monkey/lv_monkey.h"
#include "gridnav/lv_gridnav.h"
#include "fragment/lv_fragment.h"
#include "imgfont/lv_imgfont.h"
#include "msg/lv_msg.h"
#include "ime/lv_ime_pinyin.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OTHERS_H*/

View File

@ -1,56 +0,0 @@
/**
* @file lv_widgets.h
*
*/
#ifndef LV_WIDGETS_H
#define LV_WIDGETS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "animimg/lv_animimg.h"
#include "calendar/lv_calendar.h"
#include "calendar/lv_calendar_header_arrow.h"
#include "calendar/lv_calendar_header_dropdown.h"
#include "chart/lv_chart.h"
#include "keyboard/lv_keyboard.h"
#include "list/lv_list.h"
#include "menu/lv_menu.h"
#include "msgbox/lv_msgbox.h"
#include "meter/lv_meter.h"
#include "spinbox/lv_spinbox.h"
#include "spinner/lv_spinner.h"
#include "tabview/lv_tabview.h"
#include "tileview/lv_tileview.h"
#include "win/lv_win.h"
#include "colorwheel/lv_colorwheel.h"
#include "led/lv_led.h"
#include "imgbtn/lv_imgbtn.h"
#include "span/lv_span.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WIDGETS_H*/

View File

@ -28,7 +28,7 @@
#endif
#if LV_USE_THEME_DEFAULT
#include "../extra/themes/default/lv_theme_default.h"
#include "../themes/default/lv_theme_default.h"
#endif
/*********************

View File

@ -6,7 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "../lv_layouts.h"
#include "lv_flex.h"
#if LV_USE_FLEX
@ -72,7 +72,6 @@ lv_style_prop_t LV_STYLE_FLEX_CROSS_PLACE;
lv_style_prop_t LV_STYLE_FLEX_TRACK_PLACE;
lv_style_prop_t LV_STYLE_FLEX_GROW;
/**********************
* STATIC VARIABLES
**********************/
@ -80,6 +79,11 @@ lv_style_prop_t LV_STYLE_FLEX_GROW;
/**********************
* MACROS
**********************/
#if LV_USE_LOG && LV_LOG_TRACE_LAYOUT
#define LV_TRACE_LAYOUT(...) LV_LOG_TRACE(__VA_ARGS__)
#else
#define LV_TRACE_LAYOUT(...)
#endif
/**********************
* GLOBAL FUNCTIONS

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_FLEX
/*********************

View File

@ -6,7 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "../lv_layouts.h"
#include "lv_grid.h"
#if LV_USE_GRID
@ -40,7 +40,6 @@ typedef struct {
lv_coord_t grid_h;
} _lv_grid_calc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -121,6 +120,11 @@ lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN;
/**********************
* MACROS
**********************/
#if LV_USE_LOG && LV_LOG_TRACE_LAYOUT
#define LV_TRACE_LAYOUT(...) LV_LOG_TRACE(__VA_ARGS__)
#else
#define LV_TRACE_LAYOUT(...)
#endif
/**********************
* GLOBAL FUNCTIONS

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_GRID
/*********************

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_BMP
/*********************

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
/*********************
* DEFINES

View File

@ -1,7 +1,7 @@
#include "gifdec.h"
#include "../../../misc/lv_log.h"
#include "../../../misc/lv_mem.h"
#include "../../../misc/lv_color.h"
#include "../../misc/lv_log.h"
#include "../../misc/lv_mem.h"
#include "../../misc/lv_color.h"
#if LV_USE_GIF
#include <stdlib.h>
@ -20,7 +20,7 @@ typedef struct Entry {
typedef struct Table {
int bulk;
int nentries;
Entry *entries;
Entry * entries;
} Table;
static gd_GIF * gif_open(gd_GIF * gif);
@ -41,7 +41,7 @@ read_num(gd_GIF * gif)
gd_GIF *
gd_open_gif_file(const char *fname)
gd_open_gif_file(const char * fname)
{
gd_GIF gif_base;
memset(&gif_base, 0, sizeof(gif_base));
@ -54,7 +54,7 @@ gd_open_gif_file(const char *fname)
gd_GIF *
gd_open_gif_data(const void *data)
gd_open_gif_data(const void * data)
{
gd_GIF gif_base;
memset(&gif_base, 0, sizeof(gif_base));
@ -71,19 +71,19 @@ static gd_GIF * gif_open(gd_GIF * gif_base)
uint16_t width, height, depth;
uint8_t fdsz, bgidx, aspect;
int i;
uint8_t *bgcolor;
uint8_t * bgcolor;
int gct_sz;
gd_GIF *gif = NULL;
gd_GIF * gif = NULL;
/* Header */
f_gif_read(gif_base, sigver, 3);
if (memcmp(sigver, "GIF", 3) != 0) {
if(memcmp(sigver, "GIF", 3) != 0) {
LV_LOG_WARN("invalid signature\n");
goto fail;
}
/* Version */
f_gif_read(gif_base, sigver, 3);
if (memcmp(sigver, "89a", 3) != 0) {
if(memcmp(sigver, "89a", 3) != 0) {
LV_LOG_WARN("invalid version\n");
goto fail;
}
@ -93,7 +93,7 @@ static gd_GIF * gif_open(gd_GIF * gif_base)
/* FDSZ */
f_gif_read(gif_base, &fdsz, 1);
/* Presence of GCT */
if (!(fdsz & 0x80)) {
if(!(fdsz & 0x80)) {
LV_LOG_WARN("no global color table\n");
goto fail;
}
@ -115,7 +115,7 @@ static gd_GIF * gif_open(gd_GIF * gif_base)
gif = lv_malloc(sizeof(gd_GIF) + 3 * width * height);
#endif
if (!gif) goto fail;
if(!gif) goto fail;
memcpy(gif, gif_base, sizeof(gd_GIF));
gif->width = width;
gif->height = height;
@ -133,30 +133,30 @@ static gd_GIF * gif_open(gd_GIF * gif_base)
#elif LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
gif->frame = &gif->canvas[2 * width * height];
#endif
if (gif->bgindex) {
if(gif->bgindex) {
memset(gif->frame, gif->bgindex, gif->width * gif->height);
}
bgcolor = &gif->palette->colors[gif->bgindex*3];
bgcolor = &gif->palette->colors[gif->bgindex * 3];
for (i = 0; i < gif->width * gif->height; i++) {
for(i = 0; i < gif->width * gif->height; i++) {
#if LV_COLOR_DEPTH == 32
gif->canvas[i*4 + 0] = *(bgcolor + 2);
gif->canvas[i*4 + 1] = *(bgcolor + 1);
gif->canvas[i*4 + 2] = *(bgcolor + 0);
gif->canvas[i*4 + 3] = 0xff;
gif->canvas[i * 4 + 0] = *(bgcolor + 2);
gif->canvas[i * 4 + 1] = *(bgcolor + 1);
gif->canvas[i * 4 + 2] = *(bgcolor + 0);
gif->canvas[i * 4 + 3] = 0xff;
#elif LV_COLOR_DEPTH == 16
lv_color_t c = lv_color_make(*(bgcolor + 0), *(bgcolor + 1), *(bgcolor + 2));
gif->canvas[i*3 + 0] = c.full & 0xff;
gif->canvas[i*3 + 1] = (c.full >> 8) & 0xff;
gif->canvas[i*3 + 2] = 0xff;
gif->canvas[i * 3 + 0] = c.full & 0xff;
gif->canvas[i * 3 + 1] = (c.full >> 8) & 0xff;
gif->canvas[i * 3 + 2] = 0xff;
#elif LV_COLOR_DEPTH == 8
lv_color_t c = lv_color_make(*(bgcolor + 0), *(bgcolor + 1), *(bgcolor + 2));
gif->canvas[i*2 + 0] = c.full;
gif->canvas[i*2 + 1] = 0xff;
gif->canvas[i * 2 + 0] = c.full;
gif->canvas[i * 2 + 1] = 0xff;
#elif LV_COLOR_DEPTH == 1
lv_color_t c = lv_color_make(*(bgcolor + 0), *(bgcolor + 1), *(bgcolor + 2));
gif->canvas[i*2 + 0] = c.ch.red > 128 ? 1 : 0;
gif->canvas[i*2 + 1] = 0xff;
gif->canvas[i * 2 + 0] = c.ch.red > 128 ? 1 : 0;
gif->canvas[i * 2 + 1] = 0xff;
#endif
}
gif->anim_start = f_gif_seek(gif, 0, LV_FS_SEEK_CUR);
@ -168,20 +168,20 @@ ok:
}
static void
discard_sub_blocks(gd_GIF *gif)
discard_sub_blocks(gd_GIF * gif)
{
uint8_t size;
do {
f_gif_read(gif, &size, 1);
f_gif_seek(gif, size, LV_FS_SEEK_CUR);
} while (size);
} while(size);
}
static void
read_plain_text_ext(gd_GIF *gif)
read_plain_text_ext(gd_GIF * gif)
{
if (gif->plain_text) {
if(gif->plain_text) {
uint16_t tx, ty, tw, th;
uint8_t cw, ch, fg, bg;
size_t sub_block;
@ -197,7 +197,8 @@ read_plain_text_ext(gd_GIF *gif)
sub_block = f_gif_seek(gif, 0, LV_FS_SEEK_CUR);
gif->plain_text(gif, tx, ty, tw, th, cw, ch, fg, bg);
f_gif_seek(gif, sub_block, LV_FS_SEEK_SET);
} else {
}
else {
/* Discard plain text metadata. */
f_gif_seek(gif, 13, LV_FS_SEEK_CUR);
}
@ -206,7 +207,7 @@ read_plain_text_ext(gd_GIF *gif)
}
static void
read_graphic_control_ext(gd_GIF *gif)
read_graphic_control_ext(gd_GIF * gif)
{
uint8_t rdit;
@ -223,9 +224,9 @@ read_graphic_control_ext(gd_GIF *gif)
}
static void
read_comment_ext(gd_GIF *gif)
read_comment_ext(gd_GIF * gif)
{
if (gif->comment) {
if(gif->comment) {
size_t sub_block = f_gif_seek(gif, 0, LV_FS_SEEK_CUR);
gif->comment(gif);
f_gif_seek(gif, sub_block, LV_FS_SEEK_SET);
@ -235,7 +236,7 @@ read_comment_ext(gd_GIF *gif)
}
static void
read_application_ext(gd_GIF *gif)
read_application_ext(gd_GIF * gif)
{
char app_id[8];
char app_auth_code[3];
@ -246,29 +247,31 @@ read_application_ext(gd_GIF *gif)
f_gif_read(gif, app_id, 8);
/* Application Authentication Code. */
f_gif_read(gif, app_auth_code, 3);
if (!strncmp(app_id, "NETSCAPE", sizeof(app_id))) {
if(!strncmp(app_id, "NETSCAPE", sizeof(app_id))) {
/* Discard block size (0x03) and constant byte (0x01). */
f_gif_seek(gif, 2, LV_FS_SEEK_CUR);
gif->loop_count = read_num(gif);
/* Skip block terminator. */
f_gif_seek(gif, 1, LV_FS_SEEK_CUR);
} else if (gif->application) {
}
else if(gif->application) {
size_t sub_block = f_gif_seek(gif, 0, LV_FS_SEEK_CUR);
gif->application(gif, app_id, app_auth_code);
f_gif_seek(gif, sub_block, LV_FS_SEEK_SET);
discard_sub_blocks(gif);
} else {
}
else {
discard_sub_blocks(gif);
}
}
static void
read_ext(gd_GIF *gif)
read_ext(gd_GIF * gif)
{
uint8_t label;
f_gif_read(gif, &label, 1);
switch (label) {
switch(label) {
case 0x01:
read_plain_text_ext(gif);
break;
@ -291,13 +294,15 @@ new_table(int key_size)
{
int key;
int init_bulk = MAX(1 << (key_size + 1), 0x100);
Table *table = lv_malloc(sizeof(*table) + sizeof(Entry) * init_bulk);
if (table) {
Table * table = lv_malloc(sizeof(*table) + sizeof(Entry) * init_bulk);
if(table) {
table->bulk = init_bulk;
table->nentries = (1 << key_size) + 2;
table->entries = (Entry *) &table[1];
for (key = 0; key < (1 << key_size); key++)
table->entries[key] = (Entry) {1, 0xFFF, key};
for(key = 0; key < (1 << key_size); key++)
table->entries[key] = (Entry) {
1, 0xFFF, key
};
}
return table;
}
@ -307,25 +312,27 @@ new_table(int key_size)
* +1 if key size must be incremented after this addition
* -1 if could not realloc table */
static int
add_entry(Table **tablep, uint16_t length, uint16_t prefix, uint8_t suffix)
add_entry(Table ** tablep, uint16_t length, uint16_t prefix, uint8_t suffix)
{
Table *table = *tablep;
if (table->nentries == table->bulk) {
Table * table = *tablep;
if(table->nentries == table->bulk) {
table->bulk *= 2;
table = lv_realloc(table, sizeof(*table) + sizeof(Entry) * table->bulk);
if (!table) return -1;
if(!table) return -1;
table->entries = (Entry *) &table[1];
*tablep = table;
}
table->entries[table->nentries] = (Entry) {length, prefix, suffix};
table->entries[table->nentries] = (Entry) {
length, prefix, suffix
};
table->nentries++;
if ((table->nentries & (table->nentries - 1)) == 0)
if((table->nentries & (table->nentries - 1)) == 0)
return 1;
return 0;
}
static uint16_t
get_key(gd_GIF *gif, int key_size, uint8_t *sub_len, uint8_t *shift, uint8_t *byte)
get_key(gd_GIF * gif, int key_size, uint8_t * sub_len, uint8_t * shift, uint8_t * byte)
{
int bits_read;
int rpad;
@ -333,19 +340,19 @@ get_key(gd_GIF *gif, int key_size, uint8_t *sub_len, uint8_t *shift, uint8_t *by
uint16_t key;
key = 0;
for (bits_read = 0; bits_read < key_size; bits_read += frag_size) {
for(bits_read = 0; bits_read < key_size; bits_read += frag_size) {
rpad = (*shift + bits_read) % 8;
if (rpad == 0) {
if(rpad == 0) {
/* Update byte. */
if (*sub_len == 0) {
if(*sub_len == 0) {
f_gif_read(gif, sub_len, 1); /* Must be nonzero! */
if (*sub_len == 0) return 0x1000;
if(*sub_len == 0) return 0x1000;
}
f_gif_read(gif, byte, 1);
(*sub_len)--;
}
frag_size = MIN(key_size - bits_read, 8 - rpad);
key |= ((uint16_t) ((*byte) >> rpad)) << bits_read;
key |= ((uint16_t)((*byte) >> rpad)) << bits_read;
}
/* Clear extra bits to the left. */
key &= (1 << key_size) - 1;
@ -360,15 +367,15 @@ interlaced_line_index(int h, int y)
int p; /* number of lines in current pass */
p = (h - 1) / 8 + 1;
if (y < p) /* pass 1 */
if(y < p) /* pass 1 */
return y * 8;
y -= p;
p = (h - 5) / 8 + 1;
if (y < p) /* pass 2 */
if(y < p) /* pass 2 */
return y * 8 + 4;
y -= p;
p = (h - 3) / 4 + 1;
if (y < p) /* pass 3 */
if(y < p) /* pass 3 */
return y * 4 + 2;
y -= p;
/* pass 4 */
@ -378,14 +385,14 @@ interlaced_line_index(int h, int y)
/* Decompress image pixels.
* Return 0 on success or -1 on out-of-memory (w.r.t. LZW code table). */
static int
read_image_data(gd_GIF *gif, int interlace)
read_image_data(gd_GIF * gif, int interlace)
{
uint8_t sub_len, shift, byte;
int init_key_size, key_size, table_is_full=0;
int frm_off, frm_size, str_len=0, i, p, x, y;
int init_key_size, key_size, table_is_full = 0;
int frm_off, frm_size, str_len = 0, i, p, x, y;
uint16_t key, clear, stop;
int ret;
Table *table;
Table * table;
Entry entry = {0};
size_t start, end;
@ -404,47 +411,48 @@ read_image_data(gd_GIF *gif, int interlace)
key = get_key(gif, key_size, &sub_len, &shift, &byte); /* clear code */
frm_off = 0;
ret = 0;
frm_size = gif->fw*gif->fh;
while (frm_off < frm_size) {
if (key == clear) {
frm_size = gif->fw * gif->fh;
while(frm_off < frm_size) {
if(key == clear) {
key_size = init_key_size;
table->nentries = (1 << (key_size - 1)) + 2;
table_is_full = 0;
} else if (!table_is_full) {
}
else if(!table_is_full) {
ret = add_entry(&table, str_len + 1, key, entry.suffix);
if (ret == -1) {
if(ret == -1) {
lv_free(table);
return -1;
}
if (table->nentries == 0x1000) {
if(table->nentries == 0x1000) {
ret = 0;
table_is_full = 1;
}
}
key = get_key(gif, key_size, &sub_len, &shift, &byte);
if (key == clear) continue;
if (key == stop || key == 0x1000) break;
if (ret == 1) key_size++;
if(key == clear) continue;
if(key == stop || key == 0x1000) break;
if(ret == 1) key_size++;
entry = table->entries[key];
str_len = entry.length;
for (i = 0; i < str_len; i++) {
for(i = 0; i < str_len; i++) {
p = frm_off + entry.length - 1;
x = p % gif->fw;
y = p / gif->fw;
if (interlace)
if(interlace)
y = interlaced_line_index((int) gif->fh, y);
gif->frame[(gif->fy + y) * gif->width + gif->fx + x] = entry.suffix;
if (entry.prefix == 0xFFF)
if(entry.prefix == 0xFFF)
break;
else
entry = table->entries[entry.prefix];
}
frm_off += str_len;
if (key < table->nentries - 1 && !table_is_full)
if(key < table->nentries - 1 && !table_is_full)
table->entries[table->nentries - 1].suffix = entry.suffix;
}
lv_free(table);
if (key == stop) f_gif_read(gif, &sub_len, 1); /* Must be zero! */
if(key == stop) f_gif_read(gif, &sub_len, 1); /* Must be zero! */
f_gif_seek(gif, end, LV_FS_SEEK_SET);
return 0;
}
@ -452,7 +460,7 @@ read_image_data(gd_GIF *gif, int interlace)
/* Read image.
* Return 0 on success or -1 on out-of-memory (w.r.t. LZW code table). */
static int
read_image(gd_GIF *gif)
read_image(gd_GIF * gif)
{
uint8_t fisrz;
int interlace;
@ -466,46 +474,47 @@ read_image(gd_GIF *gif)
interlace = fisrz & 0x40;
/* Ignore Sort Flag. */
/* Local Color Table? */
if (fisrz & 0x80) {
if(fisrz & 0x80) {
/* Read LCT */
gif->lct.size = 1 << ((fisrz & 0x07) + 1);
f_gif_read(gif, gif->lct.colors, 3 * gif->lct.size);
gif->palette = &gif->lct;
} else
}
else
gif->palette = &gif->gct;
/* Image Data. */
return read_image_data(gif, interlace);
}
static void
render_frame_rect(gd_GIF *gif, uint8_t *buffer)
render_frame_rect(gd_GIF * gif, uint8_t * buffer)
{
int i, j, k;
uint8_t index, *color;
i = gif->fy * gif->width + gif->fx;
for (j = 0; j < gif->fh; j++) {
for (k = 0; k < gif->fw; k++) {
for(j = 0; j < gif->fh; j++) {
for(k = 0; k < gif->fw; k++) {
index = gif->frame[(gif->fy + j) * gif->width + gif->fx + k];
color = &gif->palette->colors[index*3];
if (!gif->gce.transparency || index != gif->gce.tindex) {
color = &gif->palette->colors[index * 3];
if(!gif->gce.transparency || index != gif->gce.tindex) {
#if LV_COLOR_DEPTH == 32
buffer[(i+k)*4 + 0] = *(color + 2);
buffer[(i+k)*4 + 1] = *(color + 1);
buffer[(i+k)*4 + 2] = *(color + 0);
buffer[(i+k)*4 + 3] = 0xFF;
buffer[(i + k) * 4 + 0] = *(color + 2);
buffer[(i + k) * 4 + 1] = *(color + 1);
buffer[(i + k) * 4 + 2] = *(color + 0);
buffer[(i + k) * 4 + 3] = 0xFF;
#elif LV_COLOR_DEPTH == 16
lv_color_t c = lv_color_make(*(color + 0), *(color + 1), *(color + 2));
buffer[(i+k)*3 + 0] = c.full & 0xff;
buffer[(i+k)*3 + 1] = (c.full >> 8) & 0xff;
buffer[(i+k)*3 + 2] = 0xff;
buffer[(i + k) * 3 + 0] = c.full & 0xff;
buffer[(i + k) * 3 + 1] = (c.full >> 8) & 0xff;
buffer[(i + k) * 3 + 2] = 0xff;
#elif LV_COLOR_DEPTH == 8
lv_color_t c = lv_color_make(*(color + 0), *(color + 1), *(color + 2));
buffer[(i+k)*2 + 0] = c.full;
buffer[(i+k)*2 + 1] = 0xff;
buffer[(i + k) * 2 + 0] = c.full;
buffer[(i + k) * 2 + 1] = 0xff;
#elif LV_COLOR_DEPTH == 1
uint8_t b = (*(color + 0)) | (*(color + 1)) | (*(color + 2));
buffer[(i+k)*2 + 0] = b > 128 ? 1 : 0;
buffer[(i+k)*2 + 1] = 0xff;
buffer[(i + k) * 2 + 0] = b > 128 ? 1 : 0;
buffer[(i + k) * 2 + 1] = 0xff;
#endif
}
}
@ -514,38 +523,38 @@ render_frame_rect(gd_GIF *gif, uint8_t *buffer)
}
static void
dispose(gd_GIF *gif)
dispose(gd_GIF * gif)
{
int i, j, k;
uint8_t *bgcolor;
switch (gif->gce.disposal) {
uint8_t * bgcolor;
switch(gif->gce.disposal) {
case 2: /* Restore to background color. */
bgcolor = &gif->palette->colors[gif->bgindex*3];
bgcolor = &gif->palette->colors[gif->bgindex * 3];
uint8_t opa = 0xff;
if(gif->gce.transparency) opa = 0x00;
i = gif->fy * gif->width + gif->fx;
for (j = 0; j < gif->fh; j++) {
for (k = 0; k < gif->fw; k++) {
for(j = 0; j < gif->fh; j++) {
for(k = 0; k < gif->fw; k++) {
#if LV_COLOR_DEPTH == 32
gif->canvas[(i+k)*4 + 0] = *(bgcolor + 2);
gif->canvas[(i+k)*4 + 1] = *(bgcolor + 1);
gif->canvas[(i+k)*4 + 2] = *(bgcolor + 0);
gif->canvas[(i+k)*4 + 3] = opa;
gif->canvas[(i + k) * 4 + 0] = *(bgcolor + 2);
gif->canvas[(i + k) * 4 + 1] = *(bgcolor + 1);
gif->canvas[(i + k) * 4 + 2] = *(bgcolor + 0);
gif->canvas[(i + k) * 4 + 3] = opa;
#elif LV_COLOR_DEPTH == 16
lv_color_t c = lv_color_make(*(bgcolor + 0), *(bgcolor + 1), *(bgcolor + 2));
gif->canvas[(i+k)*3 + 0] = c.full & 0xff;
gif->canvas[(i+k)*3 + 1] = (c.full >> 8) & 0xff;
gif->canvas[(i+k)*3 + 2] = opa;
gif->canvas[(i + k) * 3 + 0] = c.full & 0xff;
gif->canvas[(i + k) * 3 + 1] = (c.full >> 8) & 0xff;
gif->canvas[(i + k) * 3 + 2] = opa;
#elif LV_COLOR_DEPTH == 8
lv_color_t c = lv_color_make(*(bgcolor + 0), *(bgcolor + 1), *(bgcolor + 2));
gif->canvas[(i+k)*2 + 0] = c.full;
gif->canvas[(i+k)*2 + 1] = opa;
gif->canvas[(i + k) * 2 + 0] = c.full;
gif->canvas[(i + k) * 2 + 1] = opa;
#elif LV_COLOR_DEPTH == 1
uint8_t b = (*(bgcolor + 0)) | (*(bgcolor + 1)) | (*(bgcolor + 2));
gif->canvas[(i+k)*2 + 0] = b > 128 ? 1 : 0;
gif->canvas[(i+k)*2 + 1] = opa;
gif->canvas[(i + k) * 2 + 0] = b > 128 ? 1 : 0;
gif->canvas[(i + k) * 2 + 1] = opa;
#endif
}
i += gif->width;
@ -561,48 +570,48 @@ dispose(gd_GIF *gif)
/* Return 1 if got a frame; 0 if got GIF trailer; -1 if error. */
int
gd_get_frame(gd_GIF *gif)
gd_get_frame(gd_GIF * gif)
{
char sep;
dispose(gif);
f_gif_read(gif, &sep, 1);
while (sep != ',') {
if (sep == ';')
while(sep != ',') {
if(sep == ';')
return 0;
if (sep == '!')
if(sep == '!')
read_ext(gif);
else return -1;
f_gif_read(gif, &sep, 1);
}
if (read_image(gif) == -1)
if(read_image(gif) == -1)
return -1;
return 1;
}
void
gd_render_frame(gd_GIF *gif, uint8_t *buffer)
gd_render_frame(gd_GIF * gif, uint8_t * buffer)
{
// uint32_t i;
// uint32_t j;
// for(i = 0, j = 0; i < gif->width * gif->height * 3; i+= 3, j+=4) {
// buffer[j + 0] = gif->canvas[i + 2];
// buffer[j + 1] = gif->canvas[i + 1];
// buffer[j + 2] = gif->canvas[i + 0];
// buffer[j + 3] = 0xFF;
// }
// memcpy(buffer, gif->canvas, gif->width * gif->height * 3);
// uint32_t i;
// uint32_t j;
// for(i = 0, j = 0; i < gif->width * gif->height * 3; i+= 3, j+=4) {
// buffer[j + 0] = gif->canvas[i + 2];
// buffer[j + 1] = gif->canvas[i + 1];
// buffer[j + 2] = gif->canvas[i + 0];
// buffer[j + 3] = 0xFF;
// }
// memcpy(buffer, gif->canvas, gif->width * gif->height * 3);
render_frame_rect(gif, buffer);
}
void
gd_rewind(gd_GIF *gif)
gd_rewind(gd_GIF * gif)
{
f_gif_seek(gif, gif->anim_start, LV_FS_SEEK_SET);
}
void
gd_close_gif(gd_GIF *gif)
gd_close_gif(gd_GIF * gif)
{
f_gif_close(gif);
lv_free(gif);
@ -618,7 +627,8 @@ static bool f_gif_open(gd_GIF * gif, const void * path, bool is_file)
lv_fs_res_t res = lv_fs_open(&gif->fd, path, LV_FS_MODE_RD);
if(res != LV_FS_RES_OK) return false;
else return true;
} else {
}
else {
gif->data = path;
return true;
}
@ -628,8 +638,8 @@ static void f_gif_read(gd_GIF * gif, void * buf, size_t len)
{
if(gif->is_file) {
lv_fs_read(&gif->fd, buf, len, NULL);
} else
{
}
else {
memcpy(buf, &gif->data[gif->f_rw_p], len);
gif->f_rw_p += len;
}
@ -642,7 +652,8 @@ static int f_gif_seek(gd_GIF * gif, size_t pos, int k)
uint32_t x;
lv_fs_tell(&gif->fd, &x);
return x;
} else {
}
else {
if(k == LV_FS_SEEK_CUR) gif->f_rw_p += pos;
else if(k == LV_FS_SEEK_SET) gif->f_rw_p = pos;
return gif->f_rw_p;

View File

@ -2,7 +2,7 @@
#define GIFDEC_H
#include <stdint.h>
#include "../../../misc/lv_fs.h"
#include "../../misc/lv_fs.h"
#if LV_USE_GIF
@ -31,29 +31,29 @@ typedef struct gd_GIF {
uint16_t depth;
uint16_t loop_count;
gd_GCE gce;
gd_Palette *palette;
gd_Palette * palette;
gd_Palette lct, gct;
void (*plain_text)(
struct gd_GIF *gif, uint16_t tx, uint16_t ty,
struct gd_GIF * gif, uint16_t tx, uint16_t ty,
uint16_t tw, uint16_t th, uint8_t cw, uint8_t ch,
uint8_t fg, uint8_t bg
);
void (*comment)(struct gd_GIF *gif);
void (*application)(struct gd_GIF *gif, char id[8], char auth[3]);
void (*comment)(struct gd_GIF * gif);
void (*application)(struct gd_GIF * gif, char id[8], char auth[3]);
uint16_t fx, fy, fw, fh;
uint8_t bgindex;
uint8_t *canvas, *frame;
uint8_t * canvas, *frame;
} gd_GIF;
gd_GIF * gd_open_gif_file(const char *fname);
gd_GIF * gd_open_gif_file(const char * fname);
gd_GIF * gd_open_gif_data(const void *data);
gd_GIF * gd_open_gif_data(const void * data);
void gd_render_frame(gd_GIF *gif, uint8_t *buffer);
void gd_render_frame(gd_GIF * gif, uint8_t * buffer);
int gd_get_frame(gd_GIF *gif);
void gd_rewind(gd_GIF *gif);
void gd_close_gif(gd_GIF *gif);
int gd_get_frame(gd_GIF * gif);
void gd_rewind(gd_GIF * gif);
void gd_close_gif(gd_GIF * gif);
#endif /*LV_USE_GIF*/

7040
src/libs/png/lodepng.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ freely, subject to the following restrictions:
#include "../../../lvgl.h"
#if LV_USE_PNG
extern const char* LODEPNG_VERSION_STRING;
extern const char * LODEPNG_VERSION_STRING;
/*
The following #defines are used to create code sections. They can be disabled
@ -44,56 +44,56 @@ allow implementing a custom lodepng_crc32.
/*deflate & zlib. If disabled, you must specify alternative zlib functions in
the custom_zlib field of the compress and decompress settings*/
#ifndef LODEPNG_NO_COMPILE_ZLIB
#define LODEPNG_COMPILE_ZLIB
#define LODEPNG_COMPILE_ZLIB
#endif
/*png encoder and png decoder*/
#ifndef LODEPNG_NO_COMPILE_PNG
#define LODEPNG_COMPILE_PNG
#define LODEPNG_COMPILE_PNG
#endif
/*deflate&zlib decoder and png decoder*/
#ifndef LODEPNG_NO_COMPILE_DECODER
#define LODEPNG_COMPILE_DECODER
#define LODEPNG_COMPILE_DECODER
#endif
/*deflate&zlib encoder and png encoder*/
#ifndef LODEPNG_NO_COMPILE_ENCODER
#define LODEPNG_COMPILE_ENCODER
#define LODEPNG_COMPILE_ENCODER
#endif
/*the optional built in harddisk file loading and saving functions*/
#ifndef LODEPNG_NO_COMPILE_DISK
#define LODEPNG_COMPILE_DISK
#define LODEPNG_COMPILE_DISK
#endif
/*support for chunks other than IHDR, IDAT, PLTE, tRNS, IEND: ancillary and unknown chunks*/
#ifndef LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS
#define LODEPNG_COMPILE_ANCILLARY_CHUNKS
#define LODEPNG_COMPILE_ANCILLARY_CHUNKS
#endif
/*ability to convert error numerical codes to English text string*/
#ifndef LODEPNG_NO_COMPILE_ERROR_TEXT
#define LODEPNG_COMPILE_ERROR_TEXT
#define LODEPNG_COMPILE_ERROR_TEXT
#endif
/*Compile the default allocators (C's free, malloc and realloc). If you disable this,
you can define the functions lodepng_free, lodepng_malloc and lodepng_realloc in your
source files with custom allocators.*/
#ifndef LODEPNG_NO_COMPILE_ALLOCATORS
#define LODEPNG_COMPILE_ALLOCATORS
#define LODEPNG_COMPILE_ALLOCATORS
#endif
/*compile the C++ version (you can disable the C++ wrapper here even when compiling for C++)*/
#ifdef __cplusplus
#ifndef LODEPNG_NO_COMPILE_CPP
#define LODEPNG_COMPILE_CPP
#endif
#ifndef LODEPNG_NO_COMPILE_CPP
#define LODEPNG_COMPILE_CPP
#endif
#endif
#ifdef LODEPNG_COMPILE_CPP
#include <vector>
#include <string>
#include <vector>
#include <string>
#endif /*LODEPNG_COMPILE_CPP*/
#ifdef LODEPNG_COMPILE_PNG
@ -128,34 +128,34 @@ colortype: the desired color type for the raw output image. See explanation on P
bitdepth: the desired bit depth for the raw output image. See explanation on PNG color types.
Return value: LodePNG error code (0 means no error).
*/
unsigned lodepng_decode_memory(unsigned char** out, unsigned* w, unsigned* h,
const unsigned char* in, size_t insize,
unsigned lodepng_decode_memory(unsigned char ** out, unsigned * w, unsigned * h,
const unsigned char * in, size_t insize,
LodePNGColorType colortype, unsigned bitdepth);
/*Same as lodepng_decode_memory, but always decodes to 32-bit RGBA raw image*/
unsigned lodepng_decode32(unsigned char** out, unsigned* w, unsigned* h,
const unsigned char* in, size_t insize);
unsigned lodepng_decode32(unsigned char ** out, unsigned * w, unsigned * h,
const unsigned char * in, size_t insize);
/*Same as lodepng_decode_memory, but always decodes to 24-bit RGB raw image*/
unsigned lodepng_decode24(unsigned char** out, unsigned* w, unsigned* h,
const unsigned char* in, size_t insize);
unsigned lodepng_decode24(unsigned char ** out, unsigned * w, unsigned * h,
const unsigned char * in, size_t insize);
#ifdef LODEPNG_COMPILE_DISK
/*
Load PNG from disk, from file with given name.
Same as the other decode functions, but instead takes a filename as input.
*/
unsigned lodepng_decode_file(unsigned char** out, unsigned* w, unsigned* h,
const char* filename,
unsigned lodepng_decode_file(unsigned char ** out, unsigned * w, unsigned * h,
const char * filename,
LodePNGColorType colortype, unsigned bitdepth);
/*Same as lodepng_decode_file, but always decodes to 32-bit RGBA raw image.*/
unsigned lodepng_decode32_file(unsigned char** out, unsigned* w, unsigned* h,
const char* filename);
unsigned lodepng_decode32_file(unsigned char ** out, unsigned * w, unsigned * h,
const char * filename);
/*Same as lodepng_decode_file, but always decodes to 24-bit RGB raw image.*/
unsigned lodepng_decode24_file(unsigned char** out, unsigned* w, unsigned* h,
const char* filename);
unsigned lodepng_decode24_file(unsigned char ** out, unsigned * w, unsigned * h,
const char * filename);
#endif /*LODEPNG_COMPILE_DISK*/
#endif /*LODEPNG_COMPILE_DECODER*/
@ -177,17 +177,17 @@ colortype: the color type of the raw input image. See explanation on PNG color t
bitdepth: the bit depth of the raw input image. See explanation on PNG color types.
Return value: LodePNG error code (0 means no error).
*/
unsigned lodepng_encode_memory(unsigned char** out, size_t* outsize,
const unsigned char* image, unsigned w, unsigned h,
unsigned lodepng_encode_memory(unsigned char ** out, size_t * outsize,
const unsigned char * image, unsigned w, unsigned h,
LodePNGColorType colortype, unsigned bitdepth);
/*Same as lodepng_encode_memory, but always encodes from 32-bit RGBA raw image.*/
unsigned lodepng_encode32(unsigned char** out, size_t* outsize,
const unsigned char* image, unsigned w, unsigned h);
unsigned lodepng_encode32(unsigned char ** out, size_t * outsize,
const unsigned char * image, unsigned w, unsigned h);
/*Same as lodepng_encode_memory, but always encodes from 24-bit RGB raw image.*/
unsigned lodepng_encode24(unsigned char** out, size_t* outsize,
const unsigned char* image, unsigned w, unsigned h);
unsigned lodepng_encode24(unsigned char ** out, size_t * outsize,
const unsigned char * image, unsigned w, unsigned h);
#ifdef LODEPNG_COMPILE_DISK
/*
@ -195,39 +195,40 @@ Converts raw pixel data into a PNG file on disk.
Same as the other encode functions, but instead takes a filename as output.
NOTE: This overwrites existing files without warning!
*/
unsigned lodepng_encode_file(const char* filename,
const unsigned char* image, unsigned w, unsigned h,
unsigned lodepng_encode_file(const char * filename,
const unsigned char * image, unsigned w, unsigned h,
LodePNGColorType colortype, unsigned bitdepth);
/*Same as lodepng_encode_file, but always encodes from 32-bit RGBA raw image.*/
unsigned lodepng_encode32_file(const char* filename,
const unsigned char* image, unsigned w, unsigned h);
unsigned lodepng_encode32_file(const char * filename,
const unsigned char * image, unsigned w, unsigned h);
/*Same as lodepng_encode_file, but always encodes from 24-bit RGB raw image.*/
unsigned lodepng_encode24_file(const char* filename,
const unsigned char* image, unsigned w, unsigned h);
unsigned lodepng_encode24_file(const char * filename,
const unsigned char * image, unsigned w, unsigned h);
#endif /*LODEPNG_COMPILE_DISK*/
#endif /*LODEPNG_COMPILE_ENCODER*/
#ifdef LODEPNG_COMPILE_CPP
namespace lodepng {
namespace lodepng
{
#ifdef LODEPNG_COMPILE_DECODER
/*Same as lodepng_decode_memory, but decodes to an std::vector. The colortype
is the format to output the pixels to. Default is RGBA 8-bit per channel.*/
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
const unsigned char* in, size_t insize,
unsigned decode(std::vector<unsigned char> & out, unsigned & w, unsigned & h,
const unsigned char * in, size_t insize,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
const std::vector<unsigned char>& in,
unsigned decode(std::vector<unsigned char> & out, unsigned & w, unsigned & h,
const std::vector<unsigned char> & in,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
#ifdef LODEPNG_COMPILE_DISK
/*
Converts PNG file from disk to raw pixel data in memory.
Same as the other decode functions, but instead takes a filename as input.
*/
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
const std::string& filename,
unsigned decode(std::vector<unsigned char> & out, unsigned & w, unsigned & h,
const std::string & filename,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
#endif /* LODEPNG_COMPILE_DISK */
#endif /* LODEPNG_COMPILE_DECODER */
@ -235,11 +236,11 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
#ifdef LODEPNG_COMPILE_ENCODER
/*Same as lodepng_encode_memory, but encodes to an std::vector. colortype
is that of the raw input data. The output PNG color type will be auto chosen.*/
unsigned encode(std::vector<unsigned char>& out,
const unsigned char* in, unsigned w, unsigned h,
unsigned encode(std::vector<unsigned char> & out,
const unsigned char * in, unsigned w, unsigned h,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
unsigned encode(std::vector<unsigned char>& out,
const std::vector<unsigned char>& in, unsigned w, unsigned h,
unsigned encode(std::vector<unsigned char> & out,
const std::vector<unsigned char> & in, unsigned w, unsigned h,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
#ifdef LODEPNG_COMPILE_DISK
/*
@ -247,11 +248,11 @@ Converts 32-bit RGBA raw pixel data into a PNG file on disk.
Same as the other encode functions, but instead takes a filename as output.
NOTE: This overwrites existing files without warning!
*/
unsigned encode(const std::string& filename,
const unsigned char* in, unsigned w, unsigned h,
unsigned encode(const std::string & filename,
const unsigned char * in, unsigned w, unsigned h,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
unsigned encode(const std::string& filename,
const std::vector<unsigned char>& in, unsigned w, unsigned h,
unsigned encode(const std::string & filename,
const std::vector<unsigned char> & in, unsigned w, unsigned h,
LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8);
#endif /* LODEPNG_COMPILE_DISK */
#endif /* LODEPNG_COMPILE_ENCODER */
@ -260,8 +261,8 @@ unsigned encode(const std::string& filename,
#endif /*LODEPNG_COMPILE_PNG*/
#ifdef LODEPNG_COMPILE_ERROR_TEXT
/*Returns an English description of the numerical error code.*/
const char* lodepng_error_text(unsigned code);
/*Returns an English description of the numerical error code.*/
const char * lodepng_error_text(unsigned code);
#endif /*LODEPNG_COMPILE_ERROR_TEXT*/
#ifdef LODEPNG_COMPILE_DECODER
@ -281,21 +282,21 @@ struct LodePNGDecompressSettings {
/*use custom zlib decoder instead of built in one (default: null).
Should return 0 if success, any non-0 if error (numeric value not exposed).*/
unsigned (*custom_zlib)(unsigned char**, size_t*,
const unsigned char*, size_t,
const LodePNGDecompressSettings*);
unsigned(*custom_zlib)(unsigned char **, size_t *,
const unsigned char *, size_t,
const LodePNGDecompressSettings *);
/*use custom deflate decoder instead of built in one (default: null)
if custom_zlib is not null, custom_inflate is ignored (the zlib format uses deflate).
Should return 0 if success, any non-0 if error (numeric value not exposed).*/
unsigned (*custom_inflate)(unsigned char**, size_t*,
const unsigned char*, size_t,
const LodePNGDecompressSettings*);
unsigned(*custom_inflate)(unsigned char **, size_t *,
const unsigned char *, size_t,
const LodePNGDecompressSettings *);
const void* custom_context; /*optional custom settings for custom functions*/
const void * custom_context; /*optional custom settings for custom functions*/
};
extern const LodePNGDecompressSettings lodepng_default_decompress_settings;
void lodepng_decompress_settings_init(LodePNGDecompressSettings* settings);
void lodepng_decompress_settings_init(LodePNGDecompressSettings * settings);
#endif /*LODEPNG_COMPILE_DECODER*/
#ifdef LODEPNG_COMPILE_ENCODER
@ -304,7 +305,7 @@ Settings for zlib compression. Tweaking these settings tweaks the balance
between speed and compression ratio.
*/
typedef struct LodePNGCompressSettings LodePNGCompressSettings;
struct LodePNGCompressSettings /*deflate = compress*/ {
struct LodePNGCompressSettings { /*deflate = compress*/
/*LZ77 related settings*/
unsigned btype; /*the block type for LZ (0, 1, 2 or 3, see zlib standard). Should be 2 for proper compression.*/
unsigned use_lz77; /*whether or not to use LZ77. Should be 1 for proper compression.*/
@ -314,21 +315,21 @@ struct LodePNGCompressSettings /*deflate = compress*/ {
unsigned lazymatching; /*use lazy matching: better compression but a bit slower. Default: true*/
/*use custom zlib encoder instead of built in one (default: null)*/
unsigned (*custom_zlib)(unsigned char**, size_t*,
const unsigned char*, size_t,
const LodePNGCompressSettings*);
unsigned(*custom_zlib)(unsigned char **, size_t *,
const unsigned char *, size_t,
const LodePNGCompressSettings *);
/*use custom deflate encoder instead of built in one (default: null)
if custom_zlib is used, custom_deflate is ignored since only the built in
zlib function will call custom_deflate*/
unsigned (*custom_deflate)(unsigned char**, size_t*,
const unsigned char*, size_t,
const LodePNGCompressSettings*);
unsigned(*custom_deflate)(unsigned char **, size_t *,
const unsigned char *, size_t,
const LodePNGCompressSettings *);
const void* custom_context; /*optional custom settings for custom functions*/
const void * custom_context; /*optional custom settings for custom functions*/
};
extern const LodePNGCompressSettings lodepng_default_compress_settings;
void lodepng_compress_settings_init(LodePNGCompressSettings* settings);
void lodepng_compress_settings_init(LodePNGCompressSettings * settings);
#endif /*LODEPNG_COMPILE_ENCODER*/
#ifdef LODEPNG_COMPILE_PNG
@ -357,7 +358,7 @@ typedef struct LodePNGColorMode {
The palette is only supported for color type 3.
*/
unsigned char* palette; /*palette in RGBARGBA... order. Must be either 0, or when allocated must have 1024 bytes*/
unsigned char * palette; /*palette in RGBARGBA... order. Must be either 0, or when allocated must have 1024 bytes*/
size_t palettesize; /*palette size in number of colors (amount of used bytes is 4 * palettesize)*/
/*
@ -378,32 +379,32 @@ typedef struct LodePNGColorMode {
} LodePNGColorMode;
/*init, cleanup and copy functions to use with this struct*/
void lodepng_color_mode_init(LodePNGColorMode* info);
void lodepng_color_mode_cleanup(LodePNGColorMode* info);
void lodepng_color_mode_init(LodePNGColorMode * info);
void lodepng_color_mode_cleanup(LodePNGColorMode * info);
/*return value is error code (0 means no error)*/
unsigned lodepng_color_mode_copy(LodePNGColorMode* dest, const LodePNGColorMode* source);
unsigned lodepng_color_mode_copy(LodePNGColorMode * dest, const LodePNGColorMode * source);
/* Makes a temporary LodePNGColorMode that does not need cleanup (no palette) */
LodePNGColorMode lodepng_color_mode_make(LodePNGColorType colortype, unsigned bitdepth);
void lodepng_palette_clear(LodePNGColorMode* info);
void lodepng_palette_clear(LodePNGColorMode * info);
/*add 1 color to the palette*/
unsigned lodepng_palette_add(LodePNGColorMode* info,
unsigned lodepng_palette_add(LodePNGColorMode * info,
unsigned char r, unsigned char g, unsigned char b, unsigned char a);
/*get the total amount of bits per pixel, based on colortype and bitdepth in the struct*/
unsigned lodepng_get_bpp(const LodePNGColorMode* info);
unsigned lodepng_get_bpp(const LodePNGColorMode * info);
/*get the amount of color channels used, based on colortype in the struct.
If a palette is used, it counts as 1 channel.*/
unsigned lodepng_get_channels(const LodePNGColorMode* info);
unsigned lodepng_get_channels(const LodePNGColorMode * info);
/*is it a grayscale type? (only colortype 0 or 4)*/
unsigned lodepng_is_greyscale_type(const LodePNGColorMode* info);
unsigned lodepng_is_greyscale_type(const LodePNGColorMode * info);
/*has it got an alpha channel? (only colortype 2 or 6)*/
unsigned lodepng_is_alpha_type(const LodePNGColorMode* info);
unsigned lodepng_is_alpha_type(const LodePNGColorMode * info);
/*has it got a palette? (only colortype 3)*/
unsigned lodepng_is_palette_type(const LodePNGColorMode* info);
unsigned lodepng_is_palette_type(const LodePNGColorMode * info);
/*only returns true if there is a palette and there is a value in the palette with alpha < 255.
Loops through the palette to check this.*/
unsigned lodepng_has_palette_alpha(const LodePNGColorMode* info);
unsigned lodepng_has_palette_alpha(const LodePNGColorMode * info);
/*
Check if the given color info indicates the possibility of having non-opaque pixels in the PNG image.
Returns true if the image can have translucent or invisible pixels (it still be opaque if it doesn't use such pixels).
@ -411,9 +412,9 @@ Returns false if the image can only have opaque pixels.
In detail, it returns true only if it's a color type with alpha, or has a palette with non-opaque values,
or if "key_defined" is true.
*/
unsigned lodepng_can_have_alpha(const LodePNGColorMode* info);
unsigned lodepng_can_have_alpha(const LodePNGColorMode * info);
/*Returns the byte size of a raw image buffer with given width, height and color mode*/
size_t lodepng_get_raw_size(unsigned w, unsigned h, const LodePNGColorMode* color);
size_t lodepng_get_raw_size(unsigned w, unsigned h, const LodePNGColorMode * color);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
/*The information of a Time chunk in PNG.*/
@ -485,8 +486,8 @@ typedef struct LodePNGInfo {
Standard text chunk keywords and strings are encoded using Latin-1.
*/
size_t text_num; /*the amount of texts in these char** buffers (there may be more texts in itext)*/
char** text_keys; /*the keyword of a text chunk (e.g. "Comment")*/
char** text_strings; /*the actual text*/
char ** text_keys; /*the keyword of a text chunk (e.g. "Comment")*/
char ** text_strings; /*the actual text*/
/*
International text chunks (iTXt)
@ -497,10 +498,10 @@ typedef struct LodePNGInfo {
strings are any length.
*/
size_t itext_num; /*the amount of international texts in this PNG*/
char** itext_keys; /*the English keyword of the text chunk (e.g. "Comment")*/
char** itext_langtags; /*language tag for this text's language, ISO/IEC 646 string, e.g. ISO 639 language tag*/
char** itext_transkeys; /*keyword translated to the international language - UTF-8 string*/
char** itext_strings; /*the actual international text - UTF-8 string*/
char ** itext_keys; /*the English keyword of the text chunk (e.g. "Comment")*/
char ** itext_langtags; /*language tag for this text's language, ISO/IEC 646 string, e.g. ISO 639 language tag*/
char ** itext_transkeys; /*keyword translated to the international language - UTF-8 string*/
char ** itext_strings; /*the actual international text - UTF-8 string*/
/*time chunk (tIME)*/
unsigned time_defined; /*set to 1 to make the encoder generate a tIME chunk*/
@ -567,13 +568,13 @@ typedef struct LodePNGInfo {
make sure you compute it carefully to avoid the above problems.
*/
unsigned iccp_defined; /* Whether an iCCP chunk is present (0 = not present, 1 = present). */
char* iccp_name; /* Null terminated string with profile name, 1-79 bytes */
char * iccp_name; /* Null terminated string with profile name, 1-79 bytes */
/*
The ICC profile in iccp_profile_size bytes.
Don't allocate this buffer yourself. Use the init/cleanup functions
correctly and use lodepng_set_icc and lodepng_clear_icc.
*/
unsigned char* iccp_profile;
unsigned char * iccp_profile;
unsigned iccp_profile_size; /* The size of iccp_profile in bytes */
/* End of color profile related chunks */
@ -596,28 +597,28 @@ typedef struct LodePNGInfo {
Do not allocate or traverse this data yourself. Use the chunk traversing functions declared
later, such as lodepng_chunk_next and lodepng_chunk_append, to read/write this struct.
*/
unsigned char* unknown_chunks_data[3];
unsigned char * unknown_chunks_data[3];
size_t unknown_chunks_size[3]; /*size in bytes of the unknown chunks, given for protection*/
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
} LodePNGInfo;
/*init, cleanup and copy functions to use with this struct*/
void lodepng_info_init(LodePNGInfo* info);
void lodepng_info_cleanup(LodePNGInfo* info);
void lodepng_info_init(LodePNGInfo * info);
void lodepng_info_cleanup(LodePNGInfo * info);
/*return value is error code (0 means no error)*/
unsigned lodepng_info_copy(LodePNGInfo* dest, const LodePNGInfo* source);
unsigned lodepng_info_copy(LodePNGInfo * dest, const LodePNGInfo * source);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str); /*push back both texts at once*/
void lodepng_clear_text(LodePNGInfo* info); /*use this to clear the texts again after you filled them in*/
unsigned lodepng_add_text(LodePNGInfo * info, const char * key, const char * str); /*push back both texts at once*/
void lodepng_clear_text(LodePNGInfo * info); /*use this to clear the texts again after you filled them in*/
unsigned lodepng_add_itext(LodePNGInfo* info, const char* key, const char* langtag,
const char* transkey, const char* str); /*push back the 4 texts of 1 chunk at once*/
void lodepng_clear_itext(LodePNGInfo* info); /*use this to clear the itexts again after you filled them in*/
unsigned lodepng_add_itext(LodePNGInfo * info, const char * key, const char * langtag,
const char * transkey, const char * str); /*push back the 4 texts of 1 chunk at once*/
void lodepng_clear_itext(LodePNGInfo * info); /*use this to clear the itexts again after you filled them in*/
/*replaces if exists*/
unsigned lodepng_set_icc(LodePNGInfo* info, const char* name, const unsigned char* profile, unsigned profile_size);
void lodepng_clear_icc(LodePNGInfo* info); /*use this to clear the texts again after you filled them in*/
unsigned lodepng_set_icc(LodePNGInfo * info, const char * name, const unsigned char * profile, unsigned profile_size);
void lodepng_clear_icc(LodePNGInfo * info); /*use this to clear the texts again after you filled them in*/
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
/*
@ -631,8 +632,8 @@ For < 8 bpp images, there should not be padding bits at the end of scanlines.
For 16-bit per channel colors, uses big endian format like PNG does.
Return value is LodePNG error code
*/
unsigned lodepng_convert(unsigned char* out, const unsigned char* in,
const LodePNGColorMode* mode_out, const LodePNGColorMode* mode_in,
unsigned lodepng_convert(unsigned char * out, const unsigned char * in,
const LodePNGColorMode * mode_out, const LodePNGColorMode * mode_in,
unsigned w, unsigned h);
#ifdef LODEPNG_COMPILE_DECODER
@ -672,7 +673,7 @@ typedef struct LodePNGDecoderSettings {
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
} LodePNGDecoderSettings;
void lodepng_decoder_settings_init(LodePNGDecoderSettings* settings);
void lodepng_decoder_settings_init(LodePNGDecoderSettings * settings);
#endif /*LODEPNG_COMPILE_DECODER*/
#ifdef LODEPNG_COMPILE_ENCODER
@ -710,7 +711,8 @@ typedef struct LodePNGColorStats {
unsigned short key_b;
unsigned alpha; /*image is not opaque and alpha channel or alpha palette required*/
unsigned numcolors; /*amount of colors, up to 257. Not valid if bits == 16 or allow_palette is disabled.*/
unsigned char palette[1024]; /*Remembers up to the first 256 RGBA colors, in no particular order, only valid when numcolors is valid*/
unsigned char
palette[1024]; /*Remembers up to the first 256 RGBA colors, in no particular order, only valid when numcolors is valid*/
unsigned bits; /*bits per channel (not for palette). 1,2 or 4 for grayscale only. 16 if 16-bit per channel required.*/
size_t numpixels;
@ -719,13 +721,13 @@ typedef struct LodePNGColorStats {
unsigned allow_greyscale; /*default 1. if 0, choose RGB or RGBA even if the image only has gray colors*/
} LodePNGColorStats;
void lodepng_color_stats_init(LodePNGColorStats* stats);
void lodepng_color_stats_init(LodePNGColorStats * stats);
/*Get a LodePNGColorStats of the image. The stats must already have been inited.
Returns error code (e.g. alloc fail) or 0 if ok.*/
unsigned lodepng_compute_color_stats(LodePNGColorStats* stats,
const unsigned char* image, unsigned w, unsigned h,
const LodePNGColorMode* mode_in);
unsigned lodepng_compute_color_stats(LodePNGColorStats * stats,
const unsigned char * image, unsigned w, unsigned h,
const LodePNGColorMode * mode_in);
/*Settings for the encoder.*/
typedef struct LodePNGEncoderSettings {
@ -745,7 +747,7 @@ typedef struct LodePNGEncoderSettings {
the same length as the amount of scanlines in the image, and each value must <= 5. You
have to cleanup this buffer, LodePNG will never free it. Don't forget that filter_palette_zero
must be set to 0 to ensure this is also used on palette or low bitdepth images.*/
const unsigned char* predefined_filters;
const unsigned char * predefined_filters;
/*force creating a PLTE chunk if colortype is 2 or 6 (= a suggested palette).
If colortype is 3, PLTE is _always_ created.*/
@ -758,7 +760,7 @@ typedef struct LodePNGEncoderSettings {
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
} LodePNGEncoderSettings;
void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings);
void lodepng_encoder_settings_init(LodePNGEncoderSettings * settings);
#endif /*LODEPNG_COMPILE_ENCODER*/
@ -777,9 +779,9 @@ typedef struct LodePNGState {
} LodePNGState;
/*init, cleanup and copy functions to use with this struct*/
void lodepng_state_init(LodePNGState* state);
void lodepng_state_cleanup(LodePNGState* state);
void lodepng_state_copy(LodePNGState* dest, const LodePNGState* source);
void lodepng_state_init(LodePNGState * state);
void lodepng_state_cleanup(LodePNGState * state);
void lodepng_state_copy(LodePNGState * dest, const LodePNGState * source);
#endif /* defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER) */
#ifdef LODEPNG_COMPILE_DECODER
@ -787,18 +789,18 @@ void lodepng_state_copy(LodePNGState* dest, const LodePNGState* source);
Same as lodepng_decode_memory, but uses a LodePNGState to allow custom settings and
getting much more information about the PNG image and color mode.
*/
unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h,
LodePNGState* state,
const unsigned char* in, size_t insize);
unsigned lodepng_decode(unsigned char ** out, unsigned * w, unsigned * h,
LodePNGState * state,
const unsigned char * in, size_t insize);
/*
Read the PNG header, but not the actual data. This returns only the information
that is in the IHDR chunk of the PNG, such as width, height and color type. The
information is placed in the info_png field of the LodePNGState.
*/
unsigned lodepng_inspect(unsigned* w, unsigned* h,
LodePNGState* state,
const unsigned char* in, size_t insize);
unsigned lodepng_inspect(unsigned * w, unsigned * h,
LodePNGState * state,
const unsigned char * in, size_t insize);
#endif /*LODEPNG_COMPILE_DECODER*/
/*
@ -813,14 +815,14 @@ Requirements: &in[pos] must point to start of a chunk, must use regular
lodepng_inspect first since format of most other chunks depends on IHDR, and if
there is a PLTE chunk, that one must be inspected before tRNS or bKGD.
*/
unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
const unsigned char* in, size_t insize);
unsigned lodepng_inspect_chunk(LodePNGState * state, size_t pos,
const unsigned char * in, size_t insize);
#ifdef LODEPNG_COMPILE_ENCODER
/*This function allocates the out buffer with standard malloc and stores the size in *outsize.*/
unsigned lodepng_encode(unsigned char** out, size_t* outsize,
const unsigned char* image, unsigned w, unsigned h,
LodePNGState* state);
unsigned lodepng_encode(unsigned char ** out, size_t * outsize,
const unsigned char * image, unsigned w, unsigned h,
LodePNGState * state);
#endif /*LODEPNG_COMPILE_ENCODER*/
/*
@ -852,32 +854,32 @@ Gets the length of the data of the chunk. Total chunk length has 12 bytes more.
There must be at least 4 bytes to read from. If the result value is too large,
it may be corrupt data.
*/
unsigned lodepng_chunk_length(const unsigned char* chunk);
unsigned lodepng_chunk_length(const unsigned char * chunk);
/*puts the 4-byte type in null terminated string*/
void lodepng_chunk_type(char type[5], const unsigned char* chunk);
void lodepng_chunk_type(char type[5], const unsigned char * chunk);
/*check if the type is the given type*/
unsigned char lodepng_chunk_type_equals(const unsigned char* chunk, const char* type);
unsigned char lodepng_chunk_type_equals(const unsigned char * chunk, const char * type);
/*0: it's one of the critical chunk types, 1: it's an ancillary chunk (see PNG standard)*/
unsigned char lodepng_chunk_ancillary(const unsigned char* chunk);
unsigned char lodepng_chunk_ancillary(const unsigned char * chunk);
/*0: public, 1: private (see PNG standard)*/
unsigned char lodepng_chunk_private(const unsigned char* chunk);
unsigned char lodepng_chunk_private(const unsigned char * chunk);
/*0: the chunk is unsafe to copy, 1: the chunk is safe to copy (see PNG standard)*/
unsigned char lodepng_chunk_safetocopy(const unsigned char* chunk);
unsigned char lodepng_chunk_safetocopy(const unsigned char * chunk);
/*get pointer to the data of the chunk, where the input points to the header of the chunk*/
unsigned char* lodepng_chunk_data(unsigned char* chunk);
const unsigned char* lodepng_chunk_data_const(const unsigned char* chunk);
unsigned char * lodepng_chunk_data(unsigned char * chunk);
const unsigned char * lodepng_chunk_data_const(const unsigned char * chunk);
/*returns 0 if the crc is correct, 1 if it's incorrect (0 for OK as usual!)*/
unsigned lodepng_chunk_check_crc(const unsigned char* chunk);
unsigned lodepng_chunk_check_crc(const unsigned char * chunk);
/*generates the correct CRC from the data and puts it in the last 4 bytes of the chunk*/
void lodepng_chunk_generate_crc(unsigned char* chunk);
void lodepng_chunk_generate_crc(unsigned char * chunk);
/*
Iterate to next chunks, allows iterating through all chunks of the PNG file.
@ -890,19 +892,20 @@ is no more chunk after this or possibly if the chunk is corrupt.
Start this process at the 8th byte of the PNG file.
In a non-corrupt PNG file, the last chunk should have name "IEND".
*/
unsigned char* lodepng_chunk_next(unsigned char* chunk, unsigned char* end);
const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk, const unsigned char* end);
unsigned char * lodepng_chunk_next(unsigned char * chunk, unsigned char * end);
const unsigned char * lodepng_chunk_next_const(const unsigned char * chunk, const unsigned char * end);
/*Finds the first chunk with the given type in the range [chunk, end), or returns NULL if not found.*/
unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, const char type[5]);
const unsigned char* lodepng_chunk_find_const(const unsigned char* chunk, const unsigned char* end, const char type[5]);
unsigned char * lodepng_chunk_find(unsigned char * chunk, unsigned char * end, const char type[5]);
const unsigned char * lodepng_chunk_find_const(const unsigned char * chunk, const unsigned char * end,
const char type[5]);
/*
Appends chunk to the data in out. The given chunk should already have its chunk header.
The out variable and outsize are updated to reflect the new reallocated buffer.
Returns error code (0 if it went ok)
*/
unsigned lodepng_chunk_append(unsigned char** out, size_t* outsize, const unsigned char* chunk);
unsigned lodepng_chunk_append(unsigned char ** out, size_t * outsize, const unsigned char * chunk);
/*
Appends new chunk to out. The chunk to append is given by giving its length, type
@ -910,12 +913,12 @@ and data separately. The type is a 4-letter string.
The out variable and outsize are updated to reflect the new reallocated buffer.
Returne error code (0 if it went ok)
*/
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, unsigned length,
const char* type, const unsigned char* data);
unsigned lodepng_chunk_create(unsigned char ** out, size_t * outsize, unsigned length,
const char * type, const unsigned char * data);
/*Calculate CRC32 of buffer*/
unsigned lodepng_crc32(const unsigned char* buf, size_t len);
unsigned lodepng_crc32(const unsigned char * buf, size_t len);
#endif /*LODEPNG_COMPILE_PNG*/
@ -928,9 +931,9 @@ part of zlib that is required for PNG, it does not support dictionaries.
#ifdef LODEPNG_COMPILE_DECODER
/*Inflate a buffer. Inflate is the decompression step of deflate. Out buffer must be freed after use.*/
unsigned lodepng_inflate(unsigned char** out, size_t* outsize,
const unsigned char* in, size_t insize,
const LodePNGDecompressSettings* settings);
unsigned lodepng_inflate(unsigned char ** out, size_t * outsize,
const unsigned char * in, size_t insize,
const LodePNGDecompressSettings * settings);
/*
Decompresses Zlib data. Reallocates the out buffer and appends the data. The
@ -938,9 +941,9 @@ data must be according to the zlib specification.
Either, *out must be NULL and *outsize must be 0, or, *out must be a valid
buffer and *outsize its size in bytes. out must be freed by user after usage.
*/
unsigned lodepng_zlib_decompress(unsigned char** out, size_t* outsize,
const unsigned char* in, size_t insize,
const LodePNGDecompressSettings* settings);
unsigned lodepng_zlib_decompress(unsigned char ** out, size_t * outsize,
const unsigned char * in, size_t insize,
const LodePNGDecompressSettings * settings);
#endif /*LODEPNG_COMPILE_DECODER*/
#ifdef LODEPNG_COMPILE_ENCODER
@ -951,113 +954,115 @@ The data is output in the format of the zlib specification.
Either, *out must be NULL and *outsize must be 0, or, *out must be a valid
buffer and *outsize its size in bytes. out must be freed by user after usage.
*/
unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize,
const unsigned char* in, size_t insize,
const LodePNGCompressSettings* settings);
unsigned lodepng_zlib_compress(unsigned char ** out, size_t * outsize,
const unsigned char * in, size_t insize,
const LodePNGCompressSettings * settings);
/*
Find length-limited Huffman code for given frequencies. This function is in the
public interface only for tests, it's used internally by lodepng_deflate.
*/
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
unsigned lodepng_huffman_code_lengths(unsigned * lengths, const unsigned * frequencies,
size_t numcodes, unsigned maxbitlen);
/*Compress a buffer with deflate. See RFC 1951. Out buffer must be freed after use.*/
unsigned lodepng_deflate(unsigned char** out, size_t* outsize,
const unsigned char* in, size_t insize,
const LodePNGCompressSettings* settings);
unsigned lodepng_deflate(unsigned char ** out, size_t * outsize,
const unsigned char * in, size_t insize,
const LodePNGCompressSettings * settings);
#endif /*LODEPNG_COMPILE_ENCODER*/
#endif /*LODEPNG_COMPILE_ZLIB*/
#ifdef LODEPNG_COMPILE_DISK
/*
Load a file from disk into buffer. The function allocates the out buffer, and
after usage you should free it.
out: output parameter, contains pointer to loaded buffer.
outsize: output parameter, size of the allocated out buffer
filename: the path to the file to load
return value: error code (0 means ok)
*/
unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename);
/*
Load a file from disk into buffer. The function allocates the out buffer, and
after usage you should free it.
out: output parameter, contains pointer to loaded buffer.
outsize: output parameter, size of the allocated out buffer
filename: the path to the file to load
return value: error code (0 means ok)
*/
unsigned lodepng_load_file(unsigned char ** out, size_t * outsize, const char * filename);
/*
Save a file from buffer to disk. Warning, if it exists, this function overwrites
the file without warning!
buffer: the buffer to write
buffersize: size of the buffer to write
filename: the path to the file to save to
return value: error code (0 means ok)
*/
unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename);
/*
Save a file from buffer to disk. Warning, if it exists, this function overwrites
the file without warning!
buffer: the buffer to write
buffersize: size of the buffer to write
filename: the path to the file to save to
return value: error code (0 means ok)
*/
unsigned lodepng_save_file(const unsigned char * buffer, size_t buffersize, const char * filename);
#endif /*LODEPNG_COMPILE_DISK*/
#ifdef LODEPNG_COMPILE_CPP
/* The LodePNG C++ wrapper uses std::vectors instead of manually allocated memory buffers. */
namespace lodepng {
namespace lodepng
{
#ifdef LODEPNG_COMPILE_PNG
class State : public LodePNGState {
class State : public LodePNGState
{
public:
State();
State(const State& other);
State(const State & other);
~State();
State& operator=(const State& other);
State & operator=(const State & other);
};
#ifdef LODEPNG_COMPILE_DECODER
/* Same as other lodepng::decode, but using a State for more settings and information. */
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
State& state,
const unsigned char* in, size_t insize);
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
State& state,
const std::vector<unsigned char>& in);
unsigned decode(std::vector<unsigned char> & out, unsigned & w, unsigned & h,
State & state,
const unsigned char * in, size_t insize);
unsigned decode(std::vector<unsigned char> & out, unsigned & w, unsigned & h,
State & state,
const std::vector<unsigned char> & in);
#endif /*LODEPNG_COMPILE_DECODER*/
#ifdef LODEPNG_COMPILE_ENCODER
/* Same as other lodepng::encode, but using a State for more settings and information. */
unsigned encode(std::vector<unsigned char>& out,
const unsigned char* in, unsigned w, unsigned h,
State& state);
unsigned encode(std::vector<unsigned char>& out,
const std::vector<unsigned char>& in, unsigned w, unsigned h,
State& state);
unsigned encode(std::vector<unsigned char> & out,
const unsigned char * in, unsigned w, unsigned h,
State & state);
unsigned encode(std::vector<unsigned char> & out,
const std::vector<unsigned char> & in, unsigned w, unsigned h,
State & state);
#endif /*LODEPNG_COMPILE_ENCODER*/
#ifdef LODEPNG_COMPILE_DISK
/*
Load a file from disk into an std::vector.
return value: error code (0 means ok)
*/
unsigned load_file(std::vector<unsigned char>& buffer, const std::string& filename);
/*
Load a file from disk into an std::vector.
return value: error code (0 means ok)
*/
unsigned load_file(std::vector<unsigned char> & buffer, const std::string & filename);
/*
Save the binary data in an std::vector to a file on disk. The file is overwritten
without warning.
*/
unsigned save_file(const std::vector<unsigned char>& buffer, const std::string& filename);
/*
Save the binary data in an std::vector to a file on disk. The file is overwritten
without warning.
*/
unsigned save_file(const std::vector<unsigned char> & buffer, const std::string & filename);
#endif /* LODEPNG_COMPILE_DISK */
#endif /* LODEPNG_COMPILE_PNG */
#ifdef LODEPNG_COMPILE_ZLIB
#ifdef LODEPNG_COMPILE_DECODER
/* Zlib-decompress an unsigned char buffer */
unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize,
const LodePNGDecompressSettings& settings = lodepng_default_decompress_settings);
unsigned decompress(std::vector<unsigned char> & out, const unsigned char * in, size_t insize,
const LodePNGDecompressSettings & settings = lodepng_default_decompress_settings);
/* Zlib-decompress an std::vector */
unsigned decompress(std::vector<unsigned char>& out, const std::vector<unsigned char>& in,
const LodePNGDecompressSettings& settings = lodepng_default_decompress_settings);
unsigned decompress(std::vector<unsigned char> & out, const std::vector<unsigned char> & in,
const LodePNGDecompressSettings & settings = lodepng_default_decompress_settings);
#endif /* LODEPNG_COMPILE_DECODER */
#ifdef LODEPNG_COMPILE_ENCODER
/* Zlib-compress an unsigned char buffer */
unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize,
const LodePNGCompressSettings& settings = lodepng_default_compress_settings);
unsigned compress(std::vector<unsigned char> & out, const unsigned char * in, size_t insize,
const LodePNGCompressSettings & settings = lodepng_default_compress_settings);
/* Zlib-compress an std::vector */
unsigned compress(std::vector<unsigned char>& out, const std::vector<unsigned char>& in,
const LodePNGCompressSettings& settings = lodepng_default_compress_settings);
unsigned compress(std::vector<unsigned char> & out, const std::vector<unsigned char> & in,
const LodePNGCompressSettings & settings = lodepng_default_compress_settings);
#endif /* LODEPNG_COMPILE_ENCODER */
#endif /* LODEPNG_COMPILE_ZLIB */
} /* namespace lodepng */

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_PNG
/*********************

1113
src/libs/qrcode/qrcodegen.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -57,10 +57,10 @@ extern "C" {
enum qrcodegen_Ecc {
// Must be declared in ascending order of error protection
// so that an internal qrcodegen function works properly
qrcodegen_Ecc_LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords
qrcodegen_Ecc_MEDIUM , // The QR Code can tolerate about 15% erroneous codewords
qrcodegen_Ecc_LOW = 0, // The QR Code can tolerate about 7% erroneous codewords
qrcodegen_Ecc_MEDIUM, // The QR Code can tolerate about 15% erroneous codewords
qrcodegen_Ecc_QUARTILE, // The QR Code can tolerate about 25% erroneous codewords
qrcodegen_Ecc_HIGH , // The QR Code can tolerate about 30% erroneous codewords
qrcodegen_Ecc_HIGH, // The QR Code can tolerate about 30% erroneous codewords
};
@ -117,7 +117,7 @@ struct qrcodegen_Segment {
// The data bits of this segment, packed in bitwise big endian.
// Can be null if the bit length is zero.
uint8_t *data;
uint8_t * data;
// The number of valid data bits used in the buffer. Requires
// 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
@ -166,7 +166,7 @@ struct qrcodegen_Segment {
* - Please consult the QR Code specification for information on
* data capacities per version, ECC level, and text encoding mode.
*/
bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[],
bool qrcodegen_encodeText(const char * text, uint8_t tempBuffer[], uint8_t qrcode[],
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
@ -234,14 +234,14 @@ bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], siz
* A string is encodable iff each character is in the following set: 0 to 9, A to Z
* (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
*/
bool qrcodegen_isAlphanumeric(const char *text);
bool qrcodegen_isAlphanumeric(const char * text);
/*
* Tests whether the given string can be encoded as a segment in numeric mode.
* A string is encodable iff each character is in the range 0 to 9.
*/
bool qrcodegen_isNumeric(const char *text);
bool qrcodegen_isNumeric(const char * text);
/*
@ -269,7 +269,7 @@ struct qrcodegen_Segment qrcodegen_makeBytes(const uint8_t data[], size_t len, u
/*
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
*/
struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[]);
struct qrcodegen_Segment qrcodegen_makeNumeric(const char * digits, uint8_t buf[]);
/*
@ -277,7 +277,7 @@ struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[]
* The characters allowed are: 0 to 9, A to Z (uppercase only), space,
* dollar, percent, asterisk, plus, hyphen, period, slash, colon.
*/
struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char *text, uint8_t buf[]);
struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char * text, uint8_t buf[]);
/*

View File

@ -50,7 +50,7 @@
#include "tjpgd.h"
#include "lv_sjpg.h"
#include "../../../misc/lv_fs.h"
#include "../../misc/lv_fs.h"
/*********************
* DEFINES

1209
src/libs/sjpg/tjpgd.c Normal file

File diff suppressed because it is too large Load Diff

93
src/libs/sjpg/tjpgd.h Normal file
View File

@ -0,0 +1,93 @@
/*----------------------------------------------------------------------------/
/ TJpgDec - Tiny JPEG Decompressor R0.03 include file (C)ChaN, 2021
/----------------------------------------------------------------------------*/
#ifndef DEF_TJPGDEC
#define DEF_TJPGDEC
#ifdef __cplusplus
extern "C" {
#endif
#include "../../lv_conf_internal.h"
#if LV_USE_SJPG
#include "tjpgdcnf.h"
#include <string.h>
#include <stdint.h>
#if JD_FASTDECODE >= 1
typedef int16_t jd_yuv_t;
#else
typedef uint8_t jd_yuv_t;
#endif
/* Error code */
typedef enum {
JDR_OK = 0, /* 0: Succeeded */
JDR_INTR, /* 1: Interrupted by output function */
JDR_INP, /* 2: Device error or wrong termination of input stream */
JDR_MEM1, /* 3: Insufficient memory pool for the image */
JDR_MEM2, /* 4: Insufficient stream input buffer */
JDR_PAR, /* 5: Parameter error */
JDR_FMT1, /* 6: Data format error (may be broken data) */
JDR_FMT2, /* 7: Right format but not supported */
JDR_FMT3 /* 8: Not supported JPEG standard */
} JRESULT;
/* Rectangular region in the output image */
typedef struct {
uint16_t left; /* Left end */
uint16_t right; /* Right end */
uint16_t top; /* Top end */
uint16_t bottom; /* Bottom end */
} JRECT;
/* Decompressor object structure */
typedef struct JDEC JDEC;
struct JDEC {
size_t dctr; /* Number of bytes available in the input buffer */
uint8_t * dptr; /* Current data read ptr */
uint8_t * inbuf; /* Bit stream input buffer */
uint8_t dbit; /* Number of bits availavble in wreg or reading bit mask */
uint8_t scale; /* Output scaling ratio */
uint8_t msx, msy; /* MCU size in unit of block (width, height) */
uint8_t qtid[3]; /* Quantization table ID of each component, Y, Cb, Cr */
uint8_t ncomp; /* Number of color components 1:grayscale, 3:color */
int16_t dcv[3]; /* Previous DC element of each component */
uint16_t nrst; /* Restart inverval */
uint16_t width, height; /* Size of the input image (pixel) */
uint8_t * huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
uint16_t * huffcode[2][2]; /* Huffman code word tables [id][dcac] */
uint8_t * huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
int32_t * qttbl[4]; /* Dequantizer tables [id] */
#if JD_FASTDECODE >= 1
uint32_t wreg; /* Working shift register */
uint8_t marker; /* Detected marker (0:None) */
#if JD_FASTDECODE == 2
uint8_t longofs[2][2]; /* Table offset of long code [id][dcac] */
uint16_t * hufflut_ac[2]; /* Fast huffman decode tables for AC short code [id] */
uint8_t * hufflut_dc[2]; /* Fast huffman decode tables for DC short code [id] */
#endif
#endif
void * workbuf; /* Working buffer for IDCT and RGB output */
jd_yuv_t * mcubuf; /* Working buffer for the MCU */
void * pool; /* Pointer to available memory pool */
size_t sz_pool; /* Size of momory pool (bytes available) */
size_t (*infunc)(JDEC *, uint8_t *, size_t); /* Pointer to jpeg stream input function */
void * device; /* Pointer to I/O device identifiler for the session */
};
/* TJpgDec API functions */
JRESULT jd_prepare(JDEC * jd, size_t (*infunc)(JDEC *, uint8_t *, size_t), void * pool, size_t sz_pool, void * dev);
JRESULT jd_decomp(JDEC * jd, int (*outfunc)(JDEC *, void *, JRECT *), uint8_t scale);
#endif /*LV_USE_SJPG*/
#ifdef __cplusplus
}
#endif
#endif /* _TJPGDEC */

View File

@ -13,11 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_FRAGMENT
#include "../../../core/lv_obj.h"
/*********************
* DEFINES

View File

@ -11,7 +11,7 @@
#if LV_USE_FRAGMENT
#include "../../../misc/lv_ll.h"
#include "../../misc/lv_ll.h"
/*********************
* DEFINES

View File

@ -9,9 +9,9 @@
#include "lv_gridnav.h"
#if LV_USE_GRIDNAV
#include "../../../misc/lv_assert.h"
#include "../../../misc/lv_math.h"
#include "../../../core/lv_indev.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_math.h"
#include "../../core/lv_indev.h"
/*********************
* DEFINES

View File

@ -53,7 +53,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_GRIDNAV

View File

@ -9,8 +9,8 @@
#include "lv_msg.h"
#if LV_USE_MSG
#include "../../../misc/lv_assert.h"
#include "../../../misc/lv_ll.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_ll.h"
/*********************
* DEFINES

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_MSG
/*********************

View File

@ -16,8 +16,7 @@ extern "C" {
#include <stdint.h>
#include <stddef.h>
#include "../../../lv_conf_internal.h"
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
/*********************
* DEFINES

View File

@ -11,7 +11,7 @@
#if LV_USE_THEME_BASIC
#include "lv_theme_basic.h"
#include "../../../misc/lv_gc.h"
#include "../../misc/lv_gc.h"
/*********************
* DEFINES

View File

@ -13,7 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#include "../../core/lv_theme.h"
#if LV_USE_THEME_BASIC

View File

@ -11,7 +11,7 @@
#if LV_USE_THEME_DEFAULT
#include "lv_theme_default.h"
#include "../../../misc/lv_gc.h"
#include "../../misc/lv_gc.h"
/*********************
* DEFINES

View File

@ -13,7 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#include "../../core/lv_theme.h"
#if LV_USE_THEME_DEFAULT

View File

@ -11,7 +11,7 @@
#if LV_USE_THEME_MONO
#include "lv_theme_mono.h"
#include "../../../misc/lv_gc.h"
#include "../../misc/lv_gc.h"
/*********************
* DEFINES

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_THEME_MONO

View File

@ -14,13 +14,13 @@
#error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1) "
#endif
#include "../../../misc/lv_assert.h"
#include "../../../draw/lv_img_decoder.h"
#include "../../../misc/lv_fs.h"
#include "../../../misc/lv_txt.h"
#include "../../../misc/lv_math.h"
#include "../../../misc/lv_log.h"
#include "../../../misc/lv_anim.h"
#include "../../draw/lv_img_decoder.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_fs.h"
#include "../../misc/lv_txt.h"
#include "../../misc/lv_math.h"
#include "../../misc/lv_log.h"
#include "../../misc/lv_anim.h"
/*********************
* DEFINES

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lvgl.h"
#include "../img/lv_img.h"
#if LV_USE_ANIMIMG != 0

View File

@ -9,11 +9,11 @@
#include "lv_arc.h"
#if LV_USE_ARC != 0
#include "../core/lv_group.h"
#include "../core/lv_indev.h"
#include "../misc/lv_assert.h"
#include "../misc/lv_math.h"
#include "../draw/lv_draw_arc.h"
#include "../../core/lv_group.h"
#include "../../core/lv_indev.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_math.h"
#include "../../draw/lv_draw_arc.h"
/*********************
* DEFINES

View File

@ -13,11 +13,11 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_ARC != 0
#include "../core/lv_obj.h"
#include "../../core/lv_obj.h"
/*********************
* DEFINES

View File

@ -9,10 +9,10 @@
#include "lv_bar.h"
#if LV_USE_BAR != 0
#include "../misc/lv_assert.h"
#include "../draw/lv_draw.h"
#include "../misc/lv_anim.h"
#include "../misc/lv_math.h"
#include "../../draw/lv_draw.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_anim.h"
#include "../../misc/lv_math.h"
/*********************
* DEFINES

View File

@ -13,14 +13,13 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_BAR != 0
#include "../core/lv_obj.h"
#include "../misc/lv_anim.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "../../core/lv_obj.h"
#include "../../misc/lv_anim.h"
#include "../label/lv_label.h"
/*********************
* DEFINES

View File

@ -10,8 +10,6 @@
#include "lv_btn.h"
#if LV_USE_BTN != 0
#include "../extra/layouts/flex/lv_flex.h"
/*********************
* DEFINES
*********************/

View File

@ -13,10 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_BTN != 0
#include "../core/lv_obj.h"
#include "../../core/lv_obj.h"
/*********************
* DEFINES

View File

@ -9,13 +9,13 @@
#include "lv_btnmatrix.h"
#if LV_USE_BTNMATRIX != 0
#include "../misc/lv_assert.h"
#include "../core/lv_indev.h"
#include "../core/lv_group.h"
#include "../draw/lv_draw.h"
#include "../core/lv_refr.h"
#include "../misc/lv_txt.h"
#include "../misc/lv_txt_ap.h"
#include "../../misc/lv_assert.h"
#include "../../core/lv_indev.h"
#include "../../core/lv_group.h"
#include "../../draw/lv_draw.h"
#include "../../core/lv_refr.h"
#include "../../misc/lv_txt.h"
#include "../../misc/lv_txt_ap.h"
/*********************
* DEFINES

View File

@ -13,11 +13,11 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_BTNMATRIX != 0
#include "../core/lv_obj.h"
#include "../../core/lv_obj.h"
/*********************
* DEFINES

View File

@ -10,7 +10,7 @@
#include "../../../lvgl.h"
#if LV_USE_CALENDAR
#include "../../../misc/lv_assert.h"
#include "../../misc/lv_assert.h"
/*********************
* DEFINES

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../widgets/lv_btnmatrix.h"
#include "../btnmatrix/lv_btnmatrix.h"
#if LV_USE_CALENDAR
@ -155,6 +155,9 @@ lv_res_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_dat
* MACROS
**********************/
#include "lv_calendar_header_arrow.h"
#include "lv_calendar_header_dropdown.h"
#endif /*LV_USE_CALENDAR*/
#ifdef __cplusplus

View File

@ -10,8 +10,8 @@
#if LV_USE_CALENDAR_HEADER_ARROW
#include "lv_calendar.h"
#include "../../../widgets/lv_btn.h"
#include "../../../widgets/lv_label.h"
#include "../btn/lv_btn.h"
#include "../label/lv_label.h"
#include "../../layouts/flex/lv_flex.h"
/*********************

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_CALENDAR_HEADER_ARROW
/*********************

View File

@ -10,7 +10,7 @@
#if LV_USE_CALENDAR_HEADER_DROPDOWN
#include "lv_calendar.h"
#include "../../../widgets/lv_dropdown.h"
#include "../dropdown/lv_dropdown.h"
#include "../../layouts/flex/lv_flex.h"
/*********************

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../core/lv_obj.h"
#include "../../core/lv_obj.h"
#if LV_USE_CALENDAR_HEADER_DROPDOWN
/*********************

View File

@ -8,12 +8,12 @@
*********************/
#include "lv_canvas.h"
#if LV_USE_CANVAS != 0
#include "../misc/lv_assert.h"
#include "../misc/lv_math.h"
#include "../draw/lv_draw.h"
#include "../core/lv_refr.h"
#include "../core/lv_disp.h"
#include "../draw/sw/lv_draw_sw.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_math.h"
#include "../../draw/lv_draw.h"
#include "../../core/lv_refr.h"
#include "../../core/lv_disp.h"
#include "../../draw/sw/lv_draw_sw.h"
/*********************
* DEFINES

View File

@ -13,13 +13,12 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_CANVAS != 0
#include "../core/lv_obj.h"
#include "../widgets/lv_img.h"
#include "../draw/lv_draw_img.h"
#include "../img/lv_img.h"
#include "../../draw/lv_draw_img.h"
/*********************
* DEFINES

View File

@ -9,7 +9,7 @@
#include "lv_chart.h"
#if LV_USE_CHART != 0
#include "../../../misc/lv_assert.h"
#include "../../misc/lv_assert.h"
/*********************
* DEFINES

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lvgl.h"
#include "../../lvgl.h"
#if LV_USE_CHART != 0

View File

@ -9,10 +9,10 @@
#include "lv_checkbox.h"
#if LV_USE_CHECKBOX != 0
#include "../misc/lv_assert.h"
#include "../misc/lv_txt_ap.h"
#include "../core/lv_group.h"
#include "../draw/lv_draw.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_txt_ap.h"
#include "../../core/lv_group.h"
#include "../../draw/lv_draw.h"
/*********************
* DEFINES

View File

@ -13,8 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../core/lv_obj.h"
#include "../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_CHECKBOX != 0

View File

@ -10,7 +10,7 @@
#include "lv_colorwheel.h"
#if LV_USE_COLORWHEEL
#include "../../../misc/lv_assert.h"
#include "../../misc/lv_assert.h"
/*********************
* DEFINES

View File

@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../../lvgl.h"
#include "../../lvgl.h"
#if LV_USE_COLORWHEEL

View File

@ -6,19 +6,19 @@
/*********************
* INCLUDES
*********************/
#include "../core/lv_obj.h"
#include "../../core/lv_obj.h"
#include "lv_dropdown.h"
#if LV_USE_DROPDOWN != 0
#include "../misc/lv_assert.h"
#include "../draw/lv_draw.h"
#include "../core/lv_group.h"
#include "../core/lv_indev.h"
#include "../core/lv_disp.h"
#include "../font/lv_symbol_def.h"
#include "../misc/lv_anim.h"
#include "../misc/lv_math.h"
#include "../misc/lv_txt_ap.h"
#include "../../misc/lv_assert.h"
#include "../../draw/lv_draw.h"
#include "../../core/lv_group.h"
#include "../../core/lv_indev.h"
#include "../../core/lv_disp.h"
#include "../../font/lv_symbol_def.h"
#include "../../misc/lv_anim.h"
#include "../../misc/lv_math.h"
#include "../../misc/lv_txt_ap.h"
#include <string.h>
/*********************

Some files were not shown because too many files have changed in this diff Show More