From 6e0cf86e73fedebb1615dde664fbac4859a72b60 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Fri, 24 Dec 2021 22:17:49 -0500 Subject: Cleanup: use new c++ guarded allocator API API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e --- source/blender/blenkernel/intern/displist.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern/displist.cc') diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc index edf043de63f..48bf24a0825 100644 --- a/source/blender/blenkernel/intern/displist.cc +++ b/source/blender/blenkernel/intern/displist.cc @@ -316,7 +316,7 @@ static void curve_to_displist(const Curve *cu, * and resolution > 1. */ const bool use_cyclic_sample = is_cyclic && (samples_len != 2); - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); /* Add one to the length because of 'BKE_curve_forward_diff_bezier'. */ dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * (samples_len + 1), __func__); BLI_addtail(r_dispbase, dl); @@ -371,7 +371,7 @@ static void curve_to_displist(const Curve *cu, } else if (nu->type == CU_NURBS) { const int len = (resolution * SEGMENTSU(nu)); - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__); BLI_addtail(r_dispbase, dl); dl->parts = 1; @@ -384,7 +384,7 @@ static void curve_to_displist(const Curve *cu, } else if (nu->type == CU_POLY) { const int len = nu->pntsu; - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__); BLI_addtail(r_dispbase, dl); dl->parts = 1; @@ -475,7 +475,7 @@ void BKE_displist_fill(const ListBase *dispbase, const int triangles_len = BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, normal_proj); if (totvert != 0 && triangles_len != 0) { - DispList *dlnew = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dlnew = MEM_cnew(__func__); dlnew->type = DL_INDEX3; dlnew->flag = (dl_flag_accum & (DL_BACK_CURVE | DL_FRONT_CURVE)); dlnew->rt = (dl_rt_accum & CU_SMOOTH); @@ -530,7 +530,7 @@ static void bevels_to_filledpoly(const Curve *cu, ListBase *dispbase) if (dl->type == DL_SURF) { if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U) == 0) { if ((cu->flag & CU_BACK) && (dl->flag & DL_BACK_CURVE)) { - DispList *dlnew = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dlnew = MEM_cnew(__func__); BLI_addtail(&front, dlnew); dlnew->verts = (float *)MEM_mallocN(sizeof(float[3]) * dl->parts, __func__); dlnew->nr = dl->parts; @@ -549,7 +549,7 @@ static void bevels_to_filledpoly(const Curve *cu, ListBase *dispbase) } } if ((cu->flag & CU_FRONT) && (dl->flag & DL_FRONT_CURVE)) { - DispList *dlnew = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dlnew = MEM_cnew(__func__); BLI_addtail(&back, dlnew); dlnew->verts = (float *)MEM_mallocN(sizeof(float[3]) * dl->parts, __func__); dlnew->nr = dl->parts; @@ -665,7 +665,7 @@ void BKE_displist_make_mball(Depsgraph *depsgraph, Scene *scene, Object *ob) BKE_displist_free(&(ob->runtime.curve_cache->disp)); } else { - ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache), __func__); + ob->runtime.curve_cache = MEM_cnew(__func__); } BKE_mball_polygonize(depsgraph, scene, ob, &ob->runtime.curve_cache->disp); @@ -996,7 +996,7 @@ static void evaluate_surface_object(Depsgraph *depsgraph, if (nu->pntsv == 1) { const int len = SEGMENTSU(nu) * resolu; - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__); BLI_addtail(r_dispbase, dl); @@ -1019,7 +1019,7 @@ static void evaluate_surface_object(Depsgraph *depsgraph, else { const int len = (nu->pntsu * resolu) * (nu->pntsv * resolv); - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__); BLI_addtail(r_dispbase, dl); @@ -1122,7 +1122,7 @@ static void fillBevelCap(const Nurb *nu, const float *prev_fp, ListBase *dispbase) { - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * dlb->nr, __func__); memcpy(dl->verts, prev_fp, sizeof(float[3]) * dlb->nr); @@ -1321,7 +1321,7 @@ static GeometrySet evaluate_curve_type_object(Depsgraph *depsgraph, /* exception handling; curve without bevel or extrude, with width correction */ if (BLI_listbase_is_empty(&dlbev)) { - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), "makeDispListbev"); + DispList *dl = MEM_cnew("makeDispListbev"); dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * bl->nr, "dlverts"); BLI_addtail(r_dispbase, dl); @@ -1371,7 +1371,7 @@ static GeometrySet evaluate_curve_type_object(Depsgraph *depsgraph, LISTBASE_FOREACH (DispList *, dlb, &dlbev) { /* for each part of the bevel use a separate displblock */ - DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); + DispList *dl = MEM_cnew(__func__); dl->verts = data = (float *)MEM_mallocN(sizeof(float[3]) * dlb->nr * steps, __func__); BLI_addtail(r_dispbase, dl); @@ -1495,7 +1495,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph, BKE_object_free_derived_caches(ob); cow_curve.curve_eval = nullptr; - ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache), __func__); + ob->runtime.curve_cache = MEM_cnew(__func__); ListBase *dispbase = &ob->runtime.curve_cache->disp; if (ob->type == OB_SURF) { -- cgit v1.2.3