diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-30 07:16:14 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-30 07:51:49 +0300 |
commit | 8bdd4b468554446cb1351785f0db751e2f84341f (patch) | |
tree | d81bda8a17f036de212b2982d7b13093f5b35a9e /source/blender/draw | |
parent | 1c1dc5f8440d918aca480904c53e31a528aef42f (diff) |
Cleanup: use function style casts for C++
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_manager_text.cc | 8 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_pbvh.cc | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/draw/intern/draw_manager_text.cc b/source/blender/draw/intern/draw_manager_text.cc index e09050877c9..d41127c3641 100644 --- a/source/blender/draw/intern/draw_manager_text.cc +++ b/source/blender/draw/intern/draw_manager_text.cc @@ -137,7 +137,7 @@ static void drw_text_cache_draw_ex(DRWTextStore *dt, ARegion *region) } BLF_position( - font_id, (float)(vos->sco[0] + vos->xoffs), (float)(vos->sco[1] + vos->yoffs), 2.0f); + font_id, float(vos->sco[0] + vos->xoffs), float(vos->sco[1] + vos->yoffs), 2.0f); BLF_draw(font_id, (vos->flag & DRW_TEXT_CACHE_STRING_PTR) ? *((const char **)vos->str) : vos->str, vos->str_len); @@ -248,7 +248,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region, if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_INDICES) && (em->selectmode & SCE_SELECT_EDGE)) { edge_tex_count += 1; } - const short edge_tex_sep = (short)((edge_tex_count - 1) * 5.0f * U.dpi_fac); + const short edge_tex_sep = short((edge_tex_count - 1) * 5.0f * U.dpi_fac); /* Make the precision of the display value proportionate to the grid-size. */ @@ -450,14 +450,14 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region, area += area_tri_v3(v1, v2, v3); } - mul_v3_fl(vmid, 1.0f / (float)n); + mul_v3_fl(vmid, 1.0f / float(n)); mul_m4_v3(ob->obmat, vmid); if (unit->system) { numstr_len = BKE_unit_value_as_string( numstr, sizeof(numstr), - (double)(area * unit->scale_length * unit->scale_length), + double(area * unit->scale_length * unit->scale_length), 3, B_UNIT_AREA, unit, diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc index 895abdfc2ac..b5ad47b09ef 100644 --- a/source/blender/draw/intern/draw_pbvh.cc +++ b/source/blender/draw/intern/draw_pbvh.cc @@ -89,7 +89,7 @@ struct PBVHVbo { { char buf[512]; - sprintf(buf, "%d:%d:%s", (int)type, (int)domain, name.c_str()); + sprintf(buf, "%d:%d:%s", int(type), int(domain), name.c_str()); key = string(buf); return key; @@ -382,7 +382,7 @@ struct PBVHBatches { foreach_grids([&](int /*x*/, int /*y*/, int /*grid_index*/, CCGElem *elems[4], int i) { float *mask = CCG_elem_mask(&args->ccg_key, elems[i]); - *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? (uchar)(*mask * 255.0f) : + *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? uchar(*mask * 255.0f) : 255; }); break; @@ -536,8 +536,8 @@ struct PBVHBatches { if (mask) { foreach_faces( [&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri * /*tri*/) { - *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = (uchar)(mask[vertex_i] * - 255.0f); + *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = uchar(mask[vertex_i] * + 255.0f); }); } else { @@ -757,7 +757,7 @@ struct PBVHBatches { foreach_bmesh([&](BMLoop *l) { float mask = BM_ELEM_CD_GET_FLOAT(l->v, cd_mask); - *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = (uchar)(mask * 255.0f); + *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = uchar(mask * 255.0f); }); } break; @@ -1154,11 +1154,11 @@ struct PBVHBatches { for (int i : IndexRange(attrs_num)) { PBVHAttrReq *attr = attrs + i; - if (!has_vbo(attr->domain, (int)attr->type, attr->name)) { - create_vbo(attr->domain, (uint32_t)attr->type, attr->name, args); + if (!has_vbo(attr->domain, int(attr->type), attr->name)) { + create_vbo(attr->domain, uint32_t(attr->type), attr->name, args); } - PBVHVbo *vbo = get_vbo(attr->domain, (uint32_t)attr->type, attr->name); + PBVHVbo *vbo = get_vbo(attr->domain, uint32_t(attr->type), attr->name); int vbo_i = get_vbo_index(vbo); batch.vbos.append(vbo_i); |