diff --git a/3rd/nanovg/base/nanovg.c b/3rd/nanovg/base/nanovg.c index 5068661af..f1bf36891 100644 --- a/3rd/nanovg/base/nanovg.c +++ b/3rd/nanovg/base/nanovg.c @@ -2032,7 +2032,6 @@ static int nvg__expandStroke(NVGcontext* ctx, float w, float fringe, int lineCap NVGpoint* p0; NVGpoint* p1; int s, e, loop; - float dx, dy; path->fill = 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++) { NVGpath* path = &cache->paths[i]; NVGpoint* pts = &cache->points[path->first]; - NVGpoint* p0; NVGpoint* p1; float rw, lw, woff; float ru, lu; @@ -2122,11 +2120,9 @@ static int nvg__expandFill(NVGcontext* ctx, float w, int lineJoin, float miterLi if (fringe) { // Looping - p0 = &pts[path->count-1]; p1 = &pts[0]; for (j = 0; j < path->count; ++j) { nvg__vset(dst, p1->x + (p1->dmx * woff), p1->y + (p1->dmy * woff), 0.5f,1); dst++; - p0 = p1++; } } else { for (j = 0; j < path->count; ++j) { @@ -2155,13 +2151,11 @@ static int nvg__expandFill(NVGcontext* ctx, float w, int lineJoin, float miterLi } // Looping - p0 = &pts[path->count-1]; p1 = &pts[0]; 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 * rw), p1->y - (p1->dmy * rw), ru,1); dst++; - p0 = p1++; } // Loop it diff --git a/src/base/canvas.c b/src/base/canvas.c index 688b4c895..b36b471d9 100644 --- a/src/base/canvas.c +++ b/src/base/canvas.c @@ -1428,4 +1428,5 @@ ret_t canvas_reset(canvas_t* c) { memset(c, 0x00, sizeof(canvas_t)); return RET_OK; -} \ No newline at end of file +} + diff --git a/src/base/vgcanvas.c b/src/base/vgcanvas.c index 85ccc06b7..21d28545f 100644 --- a/src/base/vgcanvas.c +++ b/src/base/vgcanvas.c @@ -107,6 +107,7 @@ ret_t vgcanvas_paint(vgcanvas_t* vg, bool_t stroke, bitmap_t* img) { ret_t vgcanvas_destroy(vgcanvas_t* vg) { 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_align); diff --git a/src/vgcanvas/vgcanvas_nanovg.inc b/src/vgcanvas/vgcanvas_nanovg.inc index b055e302e..41eedeab1 100644 --- a/src/vgcanvas/vgcanvas_nanovg.inc +++ b/src/vgcanvas/vgcanvas_nanovg.inc @@ -231,8 +231,8 @@ static ret_t vgcanvas_nanovg_set_font(vgcanvas_t* vgcanvas, const char* name) { int font_id = 0; NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; 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); if (font_id < 0) { 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); - vgcanvas->font = name; canvas->font_id = font_id; nvgFontFaceId(vg, font_id);