initial commit
This commit is contained in:
commit
cff2a21efc
550 files changed
+154887
No files matched your search
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @file lv_draw_vg_lite.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VG_LITE_H
|
||||
#define LV_DRAW_VG_LITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
#include "../lv_draw.h"
|
||||
#include "../../draw/lv_draw_vector.h"
|
||||
#include "../../draw/lv_draw_arc.h"
|
||||
#include "../../draw/lv_draw_rect.h"
|
||||
#include "../../draw/lv_draw_image.h"
|
||||
#include "../../draw/lv_draw_label.h"
|
||||
#include "../../draw/lv_draw_line.h"
|
||||
#include "../../draw/lv_draw_triangle.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_buf_vg_lite_init_handlers(void);
|
||||
|
||||
void lv_draw_vg_lite_init(void);
|
||||
|
||||
void lv_draw_vg_lite_deinit(void);
|
||||
|
||||
void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vg_lite_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
||||
const lv_area_t * coords, bool no_cache);
|
||||
|
||||
void lv_draw_vg_lite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vg_lite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc);
|
||||
|
||||
void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_t * dsc);
|
||||
|
||||
void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
#if LV_USE_VECTOR_GRAPHIC
|
||||
void lv_draw_vg_lite_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VG_LITE_H*/
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @file lv_draw_vg_lite_type.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VG_LITE_TYPE_H
|
||||
#define LV_DRAW_VG_LITE_TYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
#include "../lv_draw_private.h"
|
||||
#include "../../misc/lv_array.h"
|
||||
|
||||
#if LV_USE_VG_LITE_THORVG
|
||||
#include "../../others/vg_lite_tvg/vg_lite.h"
|
||||
#else
|
||||
#include <vg_lite.h>
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_vg_lite_pending_t;
|
||||
|
||||
struct _lv_draw_vg_lite_unit_t {
|
||||
lv_draw_unit_t base_unit;
|
||||
lv_draw_task_t * task_act;
|
||||
|
||||
struct _lv_vg_lite_pending_t * image_dsc_pending;
|
||||
|
||||
lv_cache_t * grad_cache;
|
||||
struct _lv_vg_lite_pending_t * grad_pending;
|
||||
|
||||
lv_cache_t * stroke_cache;
|
||||
|
||||
uint16_t flush_count;
|
||||
uint16_t letter_count;
|
||||
vg_lite_buffer_t target_buffer;
|
||||
vg_lite_matrix_t global_matrix;
|
||||
struct _lv_vg_lite_path_t * global_path;
|
||||
bool path_in_use;
|
||||
};
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VG_LITE_TYPE_H*/
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @file lv_vg_lite_decoder.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_DECODER_H
|
||||
#define LV_VG_LITE_DECODER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lv_image_decoder.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_vg_lite_decoder_init(void);
|
||||
|
||||
void lv_vg_lite_decoder_deinit(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VG_LITE_DECODER_H*/
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @file lv_vg_lite_grad.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_GRAD_H
|
||||
#define LV_VG_LITE_GRAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lvgl.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC
|
||||
|
||||
#include "lv_vg_lite_utils.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_vg_lite_grad_init(struct _lv_draw_vg_lite_unit_t * u, uint32_t cache_cnt);
|
||||
|
||||
void lv_vg_lite_grad_deinit(struct _lv_draw_vg_lite_unit_t * u);
|
||||
|
||||
bool lv_vg_lite_draw_grad(
|
||||
struct _lv_draw_vg_lite_unit_t * u,
|
||||
vg_lite_buffer_t * buffer,
|
||||
vg_lite_path_t * path,
|
||||
const lv_vector_gradient_t * grad,
|
||||
const vg_lite_matrix_t * grad_matrix,
|
||||
const vg_lite_matrix_t * matrix,
|
||||
vg_lite_fill_t fill,
|
||||
vg_lite_blend_t blend);
|
||||
|
||||
bool lv_vg_lite_draw_grad_helper(
|
||||
struct _lv_draw_vg_lite_unit_t * u,
|
||||
vg_lite_buffer_t * buffer,
|
||||
vg_lite_path_t * path,
|
||||
const lv_area_t * area,
|
||||
const lv_grad_dsc_t * grad_dsc,
|
||||
const vg_lite_matrix_t * matrix,
|
||||
vg_lite_fill_t fill,
|
||||
vg_lite_blend_t blend);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VG_LITE_GRAD_H*/
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @file lv_vg_lite_math.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_MATH_H
|
||||
#define LV_VG_LITE_MATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <float.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define MATH_PI 3.14159265358979323846f
|
||||
#define MATH_HALF_PI 1.57079632679489661923f
|
||||
#define MATH_TWO_PI 6.28318530717958647692f
|
||||
#define DEG_TO_RAD 0.017453292519943295769236907684886f
|
||||
#define RAD_TO_DEG 57.295779513082320876798154814105f
|
||||
|
||||
#define MATH_TANF(x) tanf(x)
|
||||
#define MATH_SINF(x) sinf(x)
|
||||
#define MATH_COSF(x) cosf(x)
|
||||
#define MATH_ASINF(x) asinf(x)
|
||||
#define MATH_ACOSF(x) acosf(x)
|
||||
#define MATH_FABSF(x) fabsf(x)
|
||||
#define MATH_SQRTF(x) sqrtf(x)
|
||||
|
||||
#define MATH_RADIANS(deg) ((deg) * DEG_TO_RAD)
|
||||
#define MATH_DEGREES(rad) ((rad) * RAD_TO_DEG)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static inline bool math_zero(float a)
|
||||
{
|
||||
return (MATH_FABSF(a) < FLT_EPSILON);
|
||||
}
|
||||
|
||||
static inline bool math_equal(float a, float b)
|
||||
{
|
||||
return math_zero(a - b);
|
||||
}
|
||||
|
||||
float math_fast_inv_sqrtf(float number);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VG_LITE_MATH_H*/
|
||||
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* @file lv_vg_lite_path.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_PATH_H
|
||||
#define LV_VG_LITE_PATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_vg_lite_utils.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
typedef struct _lv_vg_lite_path_t lv_vg_lite_path_t;
|
||||
typedef struct _lv_draw_vg_lite_unit_t lv_draw_vg_lite_unit_t;
|
||||
|
||||
typedef void (*lv_vg_lite_path_iter_cb_t)(void * user_data, uint8_t op_code, const float * data, uint32_t len);
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_vg_lite_path_init(lv_draw_vg_lite_unit_t * unit);
|
||||
|
||||
void lv_vg_lite_path_deinit(lv_draw_vg_lite_unit_t * unit);
|
||||
|
||||
lv_vg_lite_path_t * lv_vg_lite_path_create(vg_lite_format_t data_format);
|
||||
|
||||
void lv_vg_lite_path_destroy(lv_vg_lite_path_t * path);
|
||||
|
||||
lv_vg_lite_path_t * lv_vg_lite_path_get(lv_draw_vg_lite_unit_t * unit, vg_lite_format_t data_format);
|
||||
|
||||
void lv_vg_lite_path_drop(lv_draw_vg_lite_unit_t * unit, lv_vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_path_reset(lv_vg_lite_path_t * path, vg_lite_format_t data_format);
|
||||
|
||||
void lv_vg_lite_path_set_bonding_box_area(lv_vg_lite_path_t * path, const lv_area_t * area);
|
||||
|
||||
void lv_vg_lite_path_set_bonding_box(lv_vg_lite_path_t * path,
|
||||
float min_x, float min_y,
|
||||
float max_x, float max_y);
|
||||
|
||||
void lv_vg_lite_path_get_bonding_box(lv_vg_lite_path_t * path,
|
||||
float * min_x, float * min_y,
|
||||
float * max_x, float * max_y);
|
||||
|
||||
bool lv_vg_lite_path_update_bonding_box(lv_vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_path_set_transform(lv_vg_lite_path_t * path, const vg_lite_matrix_t * matrix);
|
||||
|
||||
void lv_vg_lite_path_set_quality(lv_vg_lite_path_t * path, vg_lite_quality_t quality);
|
||||
|
||||
vg_lite_path_t * lv_vg_lite_path_get_path(lv_vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_path_move_to(lv_vg_lite_path_t * path,
|
||||
float x, float y);
|
||||
|
||||
void lv_vg_lite_path_line_to(lv_vg_lite_path_t * path,
|
||||
float x, float y);
|
||||
|
||||
void lv_vg_lite_path_quad_to(lv_vg_lite_path_t * path,
|
||||
float cx, float cy,
|
||||
float x, float y);
|
||||
|
||||
void lv_vg_lite_path_cubic_to(lv_vg_lite_path_t * path,
|
||||
float cx1, float cy1,
|
||||
float cx2, float cy2,
|
||||
float x, float y);
|
||||
|
||||
void lv_vg_lite_path_close(lv_vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_path_end(lv_vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_path_append_rect(lv_vg_lite_path_t * path,
|
||||
float x, float y,
|
||||
float w, float h,
|
||||
float r);
|
||||
|
||||
void lv_vg_lite_path_append_circle(lv_vg_lite_path_t * path,
|
||||
float cx, float cy,
|
||||
float rx, float ry);
|
||||
|
||||
void lv_vg_lite_path_append_arc_right_angle(lv_vg_lite_path_t * path,
|
||||
float start_x, float start_y,
|
||||
float center_x, float center_y,
|
||||
float end_x, float end_y);
|
||||
|
||||
void lv_vg_lite_path_append_arc(lv_vg_lite_path_t * path,
|
||||
float cx, float cy,
|
||||
float radius,
|
||||
float start_angle,
|
||||
float sweep,
|
||||
bool pie);
|
||||
|
||||
void lv_vg_lite_path_append_path(lv_vg_lite_path_t * dest, const lv_vg_lite_path_t * src);
|
||||
|
||||
uint8_t lv_vg_lite_vlc_op_arg_len(uint8_t vlc_op);
|
||||
|
||||
uint8_t lv_vg_lite_path_format_len(vg_lite_format_t format);
|
||||
|
||||
void lv_vg_lite_path_for_each_data(const vg_lite_path_t * path, lv_vg_lite_path_iter_cb_t cb, void * user_data);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VG_LITE_PATH_H*/
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @file lv_vg_lite_pending.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_PENDING_H
|
||||
#define LV_VG_LITE_PENDING_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lvgl.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct _lv_vg_lite_pending_t lv_vg_lite_pending_t;
|
||||
|
||||
typedef void (*lv_vg_lite_pending_free_cb_t)(void * obj, void * user_data);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a pending list
|
||||
* @param obj_size the size of the objects in the list
|
||||
* @param capacity_default the default capacity of the list
|
||||
* @return a pointer to the pending list
|
||||
*/
|
||||
lv_vg_lite_pending_t * lv_vg_lite_pending_create(size_t obj_size, uint32_t capacity_default);
|
||||
|
||||
/**
|
||||
* Destroy a pending list
|
||||
* @param pending pointer to the pending list
|
||||
*/
|
||||
void lv_vg_lite_pending_destroy(lv_vg_lite_pending_t * pending);
|
||||
|
||||
/**
|
||||
* Set a free callback for the pending list
|
||||
* @param pending pointer to the pending list
|
||||
* @param free_cb the free callback
|
||||
* @param user_data user data to pass to the free callback
|
||||
*/
|
||||
void lv_vg_lite_pending_set_free_cb(lv_vg_lite_pending_t * pending, lv_vg_lite_pending_free_cb_t free_cb,
|
||||
void * user_data);
|
||||
|
||||
/**
|
||||
* Add an object to the pending list
|
||||
* @param pending pointer to the pending list
|
||||
* @param obj pointer to the object to add
|
||||
*/
|
||||
void lv_vg_lite_pending_add(lv_vg_lite_pending_t * pending, void * obj);
|
||||
|
||||
/**
|
||||
* Remove all objects from the pending list
|
||||
* @param pending pointer to the pending list
|
||||
*/
|
||||
void lv_vg_lite_pending_remove_all(lv_vg_lite_pending_t * pending);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VG_LITE_PENDING_H*/
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @file lv_vg_lite_stroke.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_STROKE_H
|
||||
#define LV_VG_LITE_STROKE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_vg_lite_utils.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_vg_lite_path_t;
|
||||
|
||||
struct _lv_draw_vg_lite_unit_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the stroke module
|
||||
* @param unit pointer to the unit
|
||||
*/
|
||||
void lv_vg_lite_stroke_init(struct _lv_draw_vg_lite_unit_t * unit, uint32_t cache_cnt);
|
||||
|
||||
/**
|
||||
* Deinitialize the stroke module
|
||||
* @param unit pointer to the unit
|
||||
*/
|
||||
void lv_vg_lite_stroke_deinit(struct _lv_draw_vg_lite_unit_t * unit);
|
||||
|
||||
/**
|
||||
* Get the stroke cache entry
|
||||
* @param unit pointer to the unit
|
||||
* @param path pointer to the path
|
||||
* @param dsc pointer to the stroke descriptor
|
||||
* @return pointer to the stroke cache entry
|
||||
*/
|
||||
lv_cache_entry_t * lv_vg_lite_stroke_get(struct _lv_draw_vg_lite_unit_t * unit,
|
||||
struct _lv_vg_lite_path_t * path,
|
||||
const lv_vector_stroke_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Get the path of a stroke
|
||||
* @param cache_entry pointer to the stroke cache entry
|
||||
* @return pointer to the path
|
||||
*/
|
||||
struct _lv_vg_lite_path_t * lv_vg_lite_stroke_get_path(lv_cache_entry_t * cache_entry);
|
||||
|
||||
/**
|
||||
* Drop the stroke cache entry
|
||||
* @param unit pointer to the unit
|
||||
* @param stroke pointer to the stroke
|
||||
*/
|
||||
void lv_vg_lite_stroke_drop(struct _lv_draw_vg_lite_unit_t * unit, lv_cache_entry_t * cache_entry);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VG_LITE_STROKE_H*/
|
||||
@@ -0,0 +1,188 @@
|
||||
/**
|
||||
* @file lv_vg_lite_utils.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_VG_LITE_UTILS_H
|
||||
#define LV_VG_LITE_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../lvgl.h"
|
||||
|
||||
#if LV_USE_DRAW_VG_LITE
|
||||
|
||||
#include "../../misc/lv_profiler.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#if LV_USE_VG_LITE_THORVG
|
||||
#include "../../others/vg_lite_tvg/vg_lite.h"
|
||||
#else
|
||||
#include <vg_lite.h>
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_VG_LITE_IS_ERROR(err) (err > 0)
|
||||
|
||||
#define VLC_GET_OP_CODE(ptr) (*((uint8_t*)ptr))
|
||||
|
||||
#if LV_VG_LITE_USE_ASSERT
|
||||
#define LV_VG_LITE_ASSERT(expr) LV_ASSERT(expr)
|
||||
#else
|
||||
#define LV_VG_LITE_ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#define LV_VG_LITE_CHECK_ERROR(expr) \
|
||||
do { \
|
||||
vg_lite_error_t error = expr; \
|
||||
if (LV_VG_LITE_IS_ERROR(error)) { \
|
||||
LV_LOG_ERROR("Execute '" #expr "' error(%d): %s", \
|
||||
(int)error, lv_vg_lite_error_string(error)); \
|
||||
LV_VG_LITE_ASSERT(false); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LV_VG_LITE_ASSERT_PATH(path) LV_VG_LITE_ASSERT(lv_vg_lite_path_check(path))
|
||||
#define LV_VG_LITE_ASSERT_SRC_BUFFER(buffer) LV_VG_LITE_ASSERT(lv_vg_lite_buffer_check(buffer, true))
|
||||
#define LV_VG_LITE_ASSERT_DEST_BUFFER(buffer) LV_VG_LITE_ASSERT(lv_vg_lite_buffer_check(buffer, false))
|
||||
#define LV_VG_LITE_ASSERT_MATRIX(matrix) LV_VG_LITE_ASSERT(lv_vg_lite_matrix_check(matrix))
|
||||
|
||||
#define LV_VG_LITE_ALIGN(number, align_bytes) \
|
||||
(((number) + ((align_bytes)-1)) & ~((align_bytes)-1))
|
||||
|
||||
#define LV_VG_LITE_IS_ALIGNED(num, align) (((uintptr_t)(num) & ((align)-1)) == 0)
|
||||
|
||||
#define LV_VG_LITE_IS_INDEX_FMT(fmt) \
|
||||
((fmt) == VG_LITE_INDEX_1 \
|
||||
|| (fmt) == VG_LITE_INDEX_2 \
|
||||
|| (fmt) == VG_LITE_INDEX_4 \
|
||||
|| (fmt) == VG_LITE_INDEX_8)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_draw_vg_lite_unit_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/* Print info */
|
||||
|
||||
void lv_vg_lite_dump_info(void);
|
||||
|
||||
const char * lv_vg_lite_error_string(vg_lite_error_t error);
|
||||
|
||||
const char * lv_vg_lite_feature_string(vg_lite_feature_t feature);
|
||||
|
||||
const char * lv_vg_lite_buffer_format_string(vg_lite_buffer_format_t format);
|
||||
|
||||
const char * lv_vg_lite_vlc_op_string(uint8_t vlc_op);
|
||||
|
||||
void lv_vg_lite_path_dump_info(const vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_stroke_dump_info(const vg_lite_stroke_t * stroke);
|
||||
|
||||
void lv_vg_lite_buffer_dump_info(const vg_lite_buffer_t * buffer);
|
||||
|
||||
void lv_vg_lite_matrix_dump_info(const vg_lite_matrix_t * matrix);
|
||||
|
||||
bool lv_vg_lite_is_dest_cf_supported(lv_color_format_t cf);
|
||||
|
||||
bool lv_vg_lite_is_src_cf_supported(lv_color_format_t cf);
|
||||
|
||||
/* Converter */
|
||||
|
||||
vg_lite_buffer_format_t lv_vg_lite_vg_fmt(lv_color_format_t cf);
|
||||
|
||||
void lv_vg_lite_buffer_format_bytes(
|
||||
vg_lite_buffer_format_t format,
|
||||
uint32_t * mul,
|
||||
uint32_t * div,
|
||||
uint32_t * bytes_align);
|
||||
|
||||
uint32_t lv_vg_lite_width_to_stride(uint32_t w, vg_lite_buffer_format_t color_format);
|
||||
|
||||
uint32_t lv_vg_lite_width_align(uint32_t w);
|
||||
|
||||
void lv_vg_lite_buffer_init(
|
||||
vg_lite_buffer_t * buffer,
|
||||
const void * ptr,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
uint32_t stride,
|
||||
vg_lite_buffer_format_t format,
|
||||
bool tiled);
|
||||
|
||||
void lv_vg_lite_buffer_from_draw_buf(vg_lite_buffer_t * buffer, const lv_draw_buf_t * draw_buf);
|
||||
|
||||
void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc);
|
||||
|
||||
void lv_vg_lite_image_dec_init(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc);
|
||||
|
||||
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src,
|
||||
bool no_cache, bool premultiply);
|
||||
|
||||
void lv_vg_lite_image_dsc_init(struct _lv_draw_vg_lite_unit_t * unit);
|
||||
|
||||
void lv_vg_lite_image_dsc_deinit(struct _lv_draw_vg_lite_unit_t * unit);
|
||||
|
||||
vg_lite_blend_t lv_vg_lite_blend_mode(lv_blend_mode_t blend_mode, bool has_pre_mul);
|
||||
|
||||
uint32_t lv_vg_lite_get_palette_size(vg_lite_buffer_format_t format);
|
||||
|
||||
vg_lite_color_t lv_vg_lite_color(lv_color_t color, lv_opa_t opa, bool pre_mul);
|
||||
|
||||
void lv_vg_lite_rect(vg_lite_rectangle_t * rect, const lv_area_t * area);
|
||||
|
||||
void lv_vg_lite_matrix(vg_lite_matrix_t * dest, const lv_matrix_t * src);
|
||||
|
||||
/* Param checker */
|
||||
|
||||
bool lv_vg_lite_buffer_check(const vg_lite_buffer_t * buffer, bool is_src);
|
||||
|
||||
bool lv_vg_lite_path_check(const vg_lite_path_t * path);
|
||||
|
||||
bool lv_vg_lite_matrix_check(const vg_lite_matrix_t * matrix);
|
||||
|
||||
/* Wrapper */
|
||||
|
||||
bool lv_vg_lite_support_blend_normal(void);
|
||||
|
||||
bool lv_vg_lite_16px_align(void);
|
||||
|
||||
void lv_vg_lite_matrix_multiply(vg_lite_matrix_t * matrix, const vg_lite_matrix_t * mult);
|
||||
|
||||
bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t * matrix);
|
||||
|
||||
lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * matrix, const lv_point_precise_t * point);
|
||||
|
||||
void lv_vg_lite_set_scissor_area(const lv_area_t * area);
|
||||
|
||||
void lv_vg_lite_disable_scissor(void);
|
||||
|
||||
void lv_vg_lite_flush(struct _lv_draw_vg_lite_unit_t * u);
|
||||
|
||||
void lv_vg_lite_finish(struct _lv_draw_vg_lite_unit_t * u);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*VG_LITE_UTILS_H*/
|
||||
Reference in new issue
Block a user