From f74d85ffc8232a859b1419f5dc25b244ae04375f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 7 May 2018 17:31:28 +0200 Subject: Cleanup: rename char/float conversion functions - FTOCHAR -> unit_float_to_uchar_clamp - F3TOCHAR3 -> unit_float_to_uchar_clamp_v3 (swap args) - F4TOCHAR4 -> unit_float_to_uchar_clamp_v4 (swap args) - FTOUSHORT -> unit_float_to_ushort_clamp - USHORTTOUCHAR -> unit_ushort_to_uchar --- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_ID.c | 2 +- source/blender/makesrna/intern/rna_image.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index e1d4e8fb8ad..dcaaec707e2 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -970,7 +970,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, ";\n"); } else if (rna_color_quantize(prop, dp)) { - fprintf(f, " data->%s[i] = FTOCHAR(values[i]);\n", dp->dnaname); + fprintf(f, " data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->dnaname); } else { if (dp->dnatype) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 7357712aaef..cdea0502d12 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -636,7 +636,7 @@ static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, const float *valu } for (i = 0; i < len; i++) { - data[i] = FTOCHAR(values[i]); + data[i] = unit_float_to_uchar_clamp(values[i]); } prv_img->flag[size] |= PRV_USER_EDITED; } diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 5bb38f29309..eeb6160cc57 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -408,7 +408,7 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) } else { for (i = 0; i < size; i++) - ((unsigned char *)ibuf->rect)[i] = FTOCHAR(values[i]); + ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); } ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID; -- cgit v1.2.3