diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-07 19:02:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-07 19:02:48 +0300 |
commit | b49184b608df297195c5f0e81da4d8d9ddfb9213 (patch) | |
tree | c2624887be563319a7138516d2fcc6100acdb2c6 /source/blender/imbuf/intern | |
parent | f62b826533422e5de3b08601e5511c233deda529 (diff) | |
parent | f74d85ffc8232a859b1419f5dc25b244ae04375f (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement_inline.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 18 | ||||
-rw-r--r-- | source/blender/imbuf/intern/filter.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/png.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/scaling.c | 16 | ||||
-rw-r--r-- | source/blender/imbuf/intern/tiff.c | 2 |
8 files changed, 28 insertions, 28 deletions
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index b2197ecb3b5..7c7c3a7ba45 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2870,7 +2870,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, display_buffer[display_index] = display_buffer[display_index + 1] = display_buffer[display_index + 2] = - display_buffer[display_index + 3] = FTOCHAR(pixel[0]); + display_buffer[display_index + 3] = unit_float_to_uchar_clamp(pixel[0]); } } } diff --git a/source/blender/imbuf/intern/colormanagement_inline.c b/source/blender/imbuf/intern/colormanagement_inline.c index 8382e2a9bfa..4a55f8f86ae 100644 --- a/source/blender/imbuf/intern/colormanagement_inline.c +++ b/source/blender/imbuf/intern/colormanagement_inline.c @@ -59,7 +59,7 @@ unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char rgb[3]) rgb_uchar_to_float(rgbf, rgb); val = dot_v3v3(imbuf_luma_coefficients, rgbf); - return FTOCHAR(val); + return unit_float_to_uchar_clamp(val); } #endif /* __IMB_COLORMANAGEMENT_INLINE_H__ */ diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 62fd623ecfa..769d53a44ef 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -127,15 +127,15 @@ static void clear_dither_context(DitherContext *di) MINLINE void ushort_to_byte_v4(uchar b[4], const unsigned short us[4]) { - b[0] = USHORTTOUCHAR(us[0]); - b[1] = USHORTTOUCHAR(us[1]); - b[2] = USHORTTOUCHAR(us[2]); - b[3] = USHORTTOUCHAR(us[3]); + b[0] = unit_ushort_to_uchar(us[0]); + b[1] = unit_ushort_to_uchar(us[1]); + b[2] = unit_ushort_to_uchar(us[2]); + b[3] = unit_ushort_to_uchar(us[3]); } MINLINE unsigned char ftochar(float value) { - return FTOCHAR(value); + return unit_float_to_uchar_clamp(value); } MINLINE void ushort_to_byte_dither_v4(uchar b[4], const unsigned short us[4], DitherContext *di, float s, float t) @@ -146,7 +146,7 @@ MINLINE void ushort_to_byte_dither_v4(uchar b[4], const unsigned short us[4], Di b[0] = ftochar(dither_value + USHORTTOFLOAT(us[0])); b[1] = ftochar(dither_value + USHORTTOFLOAT(us[1])); b[2] = ftochar(dither_value + USHORTTOFLOAT(us[2])); - b[3] = USHORTTOUCHAR(us[3]); + b[3] = unit_ushort_to_uchar(us[3]); #undef USHORTTOFLOAT } @@ -158,7 +158,7 @@ MINLINE void float_to_byte_dither_v4(uchar b[4], const float f[4], DitherContext b[0] = ftochar(dither_value + f[0]); b[1] = ftochar(dither_value + f[1]); b[2] = ftochar(dither_value + f[2]); - b[3] = FTOCHAR(f[3]); + b[3] = unit_float_to_uchar_clamp(f[3]); } /* float to byte pixels, output 4-channel RGBA */ @@ -188,7 +188,7 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from, uchar *to = rect_to + ((size_t)stride_to) * y * 4; for (x = 0; x < width; x++, from++, to += 4) - to[0] = to[1] = to[2] = to[3] = FTOCHAR(from[0]); + to[0] = to[1] = to[2] = to[3] = unit_float_to_uchar_clamp(from[0]); } else if (channels_from == 3) { /* RGB input */ @@ -339,7 +339,7 @@ void IMB_buffer_byte_from_float_mask(uchar *rect_to, const float *rect_from, for (x = 0; x < width; x++, from++, to += 4) if (*mask++ == FILTER_MASK_USED) - to[0] = to[1] = to[2] = to[3] = FTOCHAR(from[0]); + to[0] = to[1] = to[2] = to[3] = unit_float_to_uchar_clamp(from[0]); } else if (channels_from == 3) { /* RGB input */ diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 27711618cee..93b605b74f6 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -661,9 +661,9 @@ void IMB_unpremultiply_rect(unsigned int *rect, char planes, int w, int h) for (y = 0; y < h; y++) { for (x = 0; x < w; x++, cp += 4) { val = cp[3] != 0 ? 1.0f / (float)cp[3] : 1.0f; - cp[0] = FTOCHAR(cp[0] * val); - cp[1] = FTOCHAR(cp[1] * val); - cp[2] = FTOCHAR(cp[2] * val); + cp[0] = unit_float_to_uchar_clamp(cp[0] * val); + cp[1] = unit_float_to_uchar_clamp(cp[1] * val); + cp[2] = unit_float_to_uchar_clamp(cp[2] * val); } } } diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 29fbe79d8db..8ac206a97ea 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -124,7 +124,7 @@ static float channel_colormanage_noop(float value) /* wrap to avoid macro calling functions multiple times */ BLI_INLINE unsigned short ftoshort(float val) { - return FTOUSHORT(val); + return unit_float_to_ushort_clamp(val); } int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index c4325caac91..2fe17ee56c6 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -841,12 +841,12 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, unsigned char chr = 0, chg = 0, chb = 0; float fr = 0, fg = 0, fb = 0; - const int alphaint = FTOCHAR(a); + const int alphaint = unit_float_to_uchar_clamp(a); if (a == 1.0f) { - chr = FTOCHAR(col[0]); - chg = FTOCHAR(col[1]); - chb = FTOCHAR(col[2]); + chr = unit_float_to_uchar_clamp(col[0]); + chg = unit_float_to_uchar_clamp(col[1]); + chb = unit_float_to_uchar_clamp(col[2]); } else { fr = col[0] * a; diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 1c0b47f7942..4b528160fb7 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -324,18 +324,18 @@ MINLINE void straight_uchar_to_premul_ushort(unsigned short result[4], const uns MINLINE void premul_ushort_to_straight_uchar(unsigned char *result, const unsigned short color[4]) { if (color[3] <= 255) { - result[0] = USHORTTOUCHAR(color[0]); - result[1] = USHORTTOUCHAR(color[1]); - result[2] = USHORTTOUCHAR(color[2]); - result[3] = USHORTTOUCHAR(color[3]); + result[0] = unit_ushort_to_uchar(color[0]); + result[1] = unit_ushort_to_uchar(color[1]); + result[2] = unit_ushort_to_uchar(color[2]); + result[3] = unit_ushort_to_uchar(color[3]); } else { unsigned short alpha = color[3] / 256; - result[0] = USHORTTOUCHAR((ushort)(color[0] / alpha * 256)); - result[1] = USHORTTOUCHAR((ushort)(color[1] / alpha * 256)); - result[2] = USHORTTOUCHAR((ushort)(color[2] / alpha * 256)); - result[3] = USHORTTOUCHAR(color[3]); + result[0] = unit_ushort_to_uchar((ushort)(color[0] / alpha * 256)); + result[1] = unit_ushort_to_uchar((ushort)(color[1] / alpha * 256)); + result[2] = unit_ushort_to_uchar((ushort)(color[2] / alpha * 256)); + result[3] = unit_ushort_to_uchar(color[3]); } } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index afd28bb570b..a68b2aa966b 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -869,7 +869,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags) } for (i = 0; i < samplesperpixel; i++, to_i++) - to16[to_i] = FTOUSHORT(rgb[i]); + to16[to_i] = unit_float_to_ushort_clamp(rgb[i]); } else { for (i = 0; i < samplesperpixel; i++, to_i++, from_i++) |