fix custom offline macro name

This commit is contained in:
lixianjing 2023-04-18 17:19:16 +08:00
parent 8f6767cdff
commit 48dab8a03d
6 changed files with 29 additions and 17 deletions

View File

@ -1,4 +1,8 @@
# 最新动态
2023/04/18
* 修改离线画布用户自定义函数的宏名字(感谢智明提供补丁)
2023/04/15
* 增加cmd_args用于解析命令行参数。

View File

@ -135,7 +135,7 @@ ret_t canvas_offline_destroy(canvas_t* canvas);
由于有一些特别平台不能直接使用 awtk 提供的离线 canvas只能通过平台的一些特殊的接口来实现离线画布 canvas所以 awtk 的离线 canvas 提供了一个给外部重载离线 canvas 的函数的方法。
通过定义 WITH_CANVAS_OFFLINE_CUSTION 宏,并且用户自行重写下面的函数,并且返回值必须是 RET_OK 或者非 NULL
通过定义 WITH_CANVAS_OFFLINE_CUSTOM 宏,并且用户自行重写下面的函数,并且返回值必须是 RET_OK 或者非 NULL
| 函数名字 | 作用 |
| ----------------------------------------------- | ---------------------------------------------------------- |

View File

@ -202,7 +202,7 @@
/**
* 开启自定义的离线 canvas如果板子使用特殊的画布的话需要定义该宏来定义特殊离线 canvas 函数
*
* #define WITH_CANVAS_OFFLINE_CUSTION 1
* #define WITH_CANVAS_OFFLINE_CUSTOM 1
*/
/**

View File

@ -220,7 +220,7 @@
/**
* 线 canvas使线 canvas
*
* #define WITH_CANVAS_OFFLINE_CUSTION 1
* #define WITH_CANVAS_OFFLINE_CUSTOM 1
*/
/**

View File

@ -143,12 +143,16 @@ ret_t canvas_offline_flush_bitmap(canvas_t* canvas);
*/
ret_t canvas_offline_destroy(canvas_t* canvas);
/*
* WITH_CANVAS_OFFLINE_CUSTION 线 canvas
* 线 canvas 使线 canvas
* WITH_CANVAS_OFFLINE_CUSTION 线 canvas
*/
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#error Do not define WITH_CANVAS_OFFLINE_CUSTION, please define WITH_CANVAS_OFFLINE_CUSTOM !
#endif
/*
* WITH_CANVAS_OFFLINE_CUSTOM 线 canvas
* 线 canvas 使线 canvas
* WITH_CANVAS_OFFLINE_CUSTOM 线 canvas
*/
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
/**
* @method canvas_offline_custom_create
* @export none

View File

@ -34,6 +34,10 @@
#include "canvas_offline.h"
#include "base/vgcanvas_asset_manager.h"
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#error Do not define WITH_CANVAS_OFFLINE_CUSTION, please define WITH_CANVAS_OFFLINE_CUSTOM !
#endif
#ifdef WITH_GPU
#ifdef WITHOUT_GLAD
@ -101,7 +105,7 @@ canvas_t* canvas_offline_create(uint32_t w, uint32_t h, bitmap_format_t format)
system_info_t* info = system_info();
#endif
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
canvas_t* custom_canvas = canvas_offline_custom_create(w, h, format);
if (custom_canvas != NULL) {
return custom_canvas;
@ -236,7 +240,7 @@ canvas_t* canvas_offline_create(uint32_t w, uint32_t h, bitmap_format_t format)
#ifdef AWTK_WEB
ret_t canvas_offline_clear_canvas(canvas_t* canvas) {
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
if (canvas_offline_custom_clear_canvas(canvas) == RET_OK) {
return RET_OK;
}
@ -252,7 +256,7 @@ ret_t canvas_offline_clear_canvas(canvas_t* canvas) {
#endif
return_value_if_fail(canvas != NULL, RET_BAD_PARAMS);
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
if (canvas_offline_custom_clear_canvas(canvas) == RET_OK) {
return RET_OK;
}
@ -279,7 +283,7 @@ ret_t canvas_offline_begin_draw(canvas_t* canvas) {
canvas_offline_gpu_t* c = NULL;
#endif
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
ret_t ret = canvas_offline_custom_begin_draw(canvas);
if (ret == RET_OK) {
return ret;
@ -326,7 +330,7 @@ ret_t canvas_offline_end_draw(canvas_t* canvas) {
canvas_offline_gpu_t* c = NULL;
#endif
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
ret_t ret = canvas_offline_custom_end_draw(canvas);
if (ret == RET_OK) {
return ret;
@ -363,7 +367,7 @@ ret_t canvas_offline_end_draw(canvas_t* canvas) {
bitmap_t* canvas_offline_get_bitmap(canvas_t* canvas) {
canvas_offline_t* c = (canvas_offline_t*)canvas;
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
bitmap_t* bitmap = canvas_offline_custom_get_bitmap(canvas);
if (bitmap != NULL) {
return bitmap;
@ -399,7 +403,7 @@ ret_t canvas_offline_bitmap_move_to_new_bitmap(canvas_t* canvas, bitmap_t* bitma
return_value_if_fail(canvas != NULL && bitmap != NULL, RET_BAD_PARAMS);
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
if (canvas_offline_custom_bitmap_move_to_new_bitmap(canvas, bitmap) == RET_OK) {
return RET_OK;
}
@ -441,7 +445,7 @@ ret_t canvas_offline_flush_bitmap(canvas_t* canvas) {
#endif
return_value_if_fail(canvas != NULL, RET_BAD_PARAMS);
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
if (canvas_offline_custom_flush_bitmap(canvas) == RET_OK) {
return RET_OK;
}
@ -480,7 +484,7 @@ ret_t canvas_offline_destroy(canvas_t* canvas) {
return_value_if_fail(canvas != NULL, RET_BAD_PARAMS);
#ifdef WITH_CANVAS_OFFLINE_CUSTION
#ifdef WITH_CANVAS_OFFLINE_CUSTOM
if (canvas_offline_custom_destroy(canvas) == RET_OK) {
return RET_OK;
}