fix for stm32

This commit is contained in:
lixianjing 2019-06-24 11:43:28 +08:00
parent d9268c3e73
commit fffb07fde9
4 changed files with 4 additions and 9 deletions

View File

@ -2032,7 +2032,6 @@ static int nvg__expandStroke(NVGcontext* ctx, float w, float fringe, int lineCap
NVGpoint* p0; NVGpoint* p0;
NVGpoint* p1; NVGpoint* p1;
int s, e, loop; int s, e, loop;
float dx, dy;
path->fill = 0; path->fill = 0;
path->nfill = 0; path->nfill = 0;
@ -2110,7 +2109,6 @@ static int nvg__expandFill(NVGcontext* ctx, float w, int lineJoin, float miterLi
for (i = 0; i < cache->npaths; i++) { for (i = 0; i < cache->npaths; i++) {
NVGpath* path = &cache->paths[i]; NVGpath* path = &cache->paths[i];
NVGpoint* pts = &cache->points[path->first]; NVGpoint* pts = &cache->points[path->first];
NVGpoint* p0;
NVGpoint* p1; NVGpoint* p1;
float rw, lw, woff; float rw, lw, woff;
float ru, lu; float ru, lu;
@ -2122,11 +2120,9 @@ static int nvg__expandFill(NVGcontext* ctx, float w, int lineJoin, float miterLi
if (fringe) { if (fringe) {
// Looping // Looping
p0 = &pts[path->count-1];
p1 = &pts[0]; p1 = &pts[0];
for (j = 0; j < path->count; ++j) { for (j = 0; j < path->count; ++j) {
nvg__vset(dst, p1->x + (p1->dmx * woff), p1->y + (p1->dmy * woff), 0.5f,1); dst++; nvg__vset(dst, p1->x + (p1->dmx * woff), p1->y + (p1->dmy * woff), 0.5f,1); dst++;
p0 = p1++;
} }
} else { } else {
for (j = 0; j < path->count; ++j) { for (j = 0; j < path->count; ++j) {
@ -2155,13 +2151,11 @@ static int nvg__expandFill(NVGcontext* ctx, float w, int lineJoin, float miterLi
} }
// Looping // Looping
p0 = &pts[path->count-1];
p1 = &pts[0]; p1 = &pts[0];
for (j = 0; j < path->count; ++j) { for (j = 0; j < path->count; ++j) {
nvg__vset(dst, p1->x + (p1->dmx * lw), p1->y + (p1->dmy * lw), lu,1); dst++; nvg__vset(dst, p1->x + (p1->dmx * lw), p1->y + (p1->dmy * lw), lu,1); dst++;
nvg__vset(dst, p1->x - (p1->dmx * rw), p1->y - (p1->dmy * rw), ru,1); dst++; nvg__vset(dst, p1->x - (p1->dmx * rw), p1->y - (p1->dmy * rw), ru,1); dst++;
p0 = p1++;
} }
// Loop it // Loop it

View File

@ -1428,4 +1428,5 @@ ret_t canvas_reset(canvas_t* c) {
memset(c, 0x00, sizeof(canvas_t)); memset(c, 0x00, sizeof(canvas_t));
return RET_OK; return RET_OK;
} }

View File

@ -107,6 +107,7 @@ ret_t vgcanvas_paint(vgcanvas_t* vg, bool_t stroke, bitmap_t* img) {
ret_t vgcanvas_destroy(vgcanvas_t* vg) { ret_t vgcanvas_destroy(vgcanvas_t* vg) {
return_value_if_fail(vg != NULL && vg->vt->destroy != NULL, RET_BAD_PARAMS); return_value_if_fail(vg != NULL && vg->vt->destroy != NULL, RET_BAD_PARAMS);
TKMEM_FREE(vg->font);
TKMEM_FREE(vg->text_baseline); TKMEM_FREE(vg->text_baseline);
TKMEM_FREE(vg->text_align); TKMEM_FREE(vg->text_align);

View File

@ -231,8 +231,8 @@ static ret_t vgcanvas_nanovg_set_font(vgcanvas_t* vgcanvas, const char* name) {
int font_id = 0; int font_id = 0;
NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg;
vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas;
return_value_if_fail(name && *name, RET_BAD_PARAMS);
name = system_info_fix_font_name(name);
font_id = nvgFindFont(vg, name); font_id = nvgFindFont(vg, name);
if (font_id < 0) { if (font_id < 0) {
const asset_info_t* r = assets_manager_ref(assets_manager(), ASSET_TYPE_FONT, name); const asset_info_t* r = assets_manager_ref(assets_manager(), ASSET_TYPE_FONT, name);
@ -253,7 +253,6 @@ static ret_t vgcanvas_nanovg_set_font(vgcanvas_t* vgcanvas, const char* name) {
return_value_if_fail(font_id >= 0, RET_FAIL); return_value_if_fail(font_id >= 0, RET_FAIL);
vgcanvas->font = name;
canvas->font_id = font_id; canvas->font_id = font_id;
nvgFontFaceId(vg, font_id); nvgFontFaceId(vg, font_id);