Fix allocated array size for MeshExtract_EdgeFac_Data

The array size is actually 1/4 of the currently allocated size.

Also, cleanup, use `uint8_t` instead of `uchar`.

No functional changes.
This commit is contained in:
Germano Cavalcante 2022-11-16 10:52:47 -03:00
parent 59641042a7
commit 1a4a96a9d1
1 changed files with 3 additions and 4 deletions

View File

@ -20,10 +20,10 @@ namespace blender::draw {
* \{ */
struct MeshExtract_EdgeFac_Data {
uchar *vbo_data;
uint8_t *vbo_data;
bool use_edge_render;
/* Number of loop per edge. */
uchar *edge_loop_count;
uint8_t *edge_loop_count;
};
static float loop_edge_factor_get(const float f_no[3],
@ -59,8 +59,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
MeshExtract_EdgeFac_Data *data = static_cast<MeshExtract_EdgeFac_Data *>(tls_data);
if (mr->extract_type == MR_EXTRACT_MESH) {
data->edge_loop_count = static_cast<uchar *>(
MEM_callocN(sizeof(uint32_t) * mr->edge_len, __func__));
data->edge_loop_count = MEM_cnew_array<uint8_t>(mr->edge_len, __func__);
/* HACK(@fclem): Detecting the need for edge render.
* We could have a flag in the mesh instead or check the modifier stack. */