diff options
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_manager_text.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c index 23956df71e8..f4601fe4f48 100644 --- a/source/blender/draw/intern/draw_manager_text.c +++ b/source/blender/draw/intern/draw_manager_text.c @@ -395,16 +395,19 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region, UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col); - int i, n, numtri; + int i, n; BMFace *f = NULL; + /* Alternative to using `poly_to_tri_count(i, BM_elem_index_get(f->l_first))` + * without having to add an extra loop. */ + int looptri_index = 0; BM_ITER_MESH_INDEX (f, &iter, em->bm, BM_FACES_OF_MESH, i) { + const int f_looptri_len = f->len - 2; if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { n = 0; - numtri = f->len - 2; area = 0; zero_v3(vmid); - BMLoop *(*l)[3] = &em->looptris[poly_to_tri_count(i, BM_elem_index_get(f->l_first))]; - for (int j = 0; j < numtri; j++) { + BMLoop *(*l)[3] = &em->looptris[looptri_index]; + for (int j = 0; j < f_looptri_len; j++) { if (use_coords) { copy_v3_v3(v1, vert_coords[BM_elem_index_get(l[j][0]->v)]); @@ -449,6 +452,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region, DRW_text_cache_add(dt, vmid, numstr, numstr_len, 0, 0, txt_flag, col); } + looptri_index += f_looptri_len; } } |