diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-26 07:25:58 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-26 07:25:58 +0300 |
commit | 6d12bc9e918d47f39135750f9d99f901f88efc44 (patch) | |
tree | 752020c03cecc7a447eb9878601ee79527e957aa /source/blender/imbuf | |
parent | a9d1b3d7e3e9fa52c811d9807c8a26aa1c64b327 (diff) |
Cleanup: use boolean arguments and return values
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/scaling.c | 22 |
2 files changed, 13 insertions, 15 deletions
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index cb1c5ea2e8d..2f864534d61 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -515,7 +515,7 @@ void IMB_rectblend(ImBuf *dbuf, const unsigned short *cmaskrect = curvemask, *cmr; unsigned short *dmaskrect = dmask, *dmr; const unsigned short *texmaskrect = texmask, *tmr; - int do_float, do_char, srcskip, destskip, origskip, x; + int srcskip, destskip, origskip, x; IMB_blend_func func = NULL; IMB_blend_func_float func_float = NULL; @@ -535,8 +535,8 @@ void IMB_rectblend(ImBuf *dbuf, return; } - do_char = (sbuf && sbuf->rect && dbuf->rect && obuf->rect); - do_float = (sbuf && sbuf->rect_float && dbuf->rect_float && obuf->rect_float); + const bool do_char = (sbuf && sbuf->rect && dbuf->rect && obuf->rect); + const bool do_float = (sbuf && sbuf->rect_float && dbuf->rect_float && obuf->rect_float); if (do_char) { drect = dbuf->rect + ((size_t)desty) * dbuf->x + destx; diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index afb0845c23b..f4abc668402 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -171,14 +171,13 @@ static void imb_half_y_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1) uchar *p1, *p2, *_p1, *dest; short a, r, g, b; int x, y; - int do_rect, do_float; float af, rf, gf, bf, *p1f, *p2f, *_p1f, *destf; p1 = p2 = NULL; p1f = p2f = NULL; - do_rect = (ibuf1->rect != NULL); - do_float = (ibuf1->rect_float != NULL && ibuf2->rect_float != NULL); + const bool do_rect = (ibuf1->rect != NULL); + const bool do_float = (ibuf1->rect_float != NULL && ibuf2->rect_float != NULL); _p1 = (uchar *)ibuf1->rect; dest = (uchar *)ibuf2->rect; @@ -264,7 +263,6 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1) int *p1, *dest1, *dest2; float *p1f, *dest1f, *dest2f; int x, y; - int do_rect, do_float; if (ibuf1 == NULL) { return NULL; @@ -273,8 +271,8 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1) return NULL; } - do_rect = (ibuf1->rect != NULL); - do_float = (ibuf1->rect_float != NULL); + const bool do_rect = (ibuf1->rect != NULL); + const bool do_float = (ibuf1->rect_float != NULL); ibuf2 = IMB_allocImBuf(ibuf1->x, 2 * ibuf1->y, ibuf1->planes, ibuf1->flags); if (ibuf2 == NULL) { @@ -358,8 +356,8 @@ MINLINE void premul_ushort_to_straight_uchar(unsigned char *result, const unsign void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1) { int x, y; - const short do_rect = (ibuf1->rect != NULL); - const short do_float = (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL); + const bool do_rect = (ibuf1->rect != NULL); + const bool do_float = (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL); if (do_rect && (ibuf2->rect == NULL)) { imb_addrectImBuf(ibuf2); @@ -892,8 +890,8 @@ static bool q_scale_linear_interpolation(struct ImBuf *ibuf, int newx, int newy) static ImBuf *scaledownx(struct ImBuf *ibuf, int newx) { - const int do_rect = (ibuf->rect != NULL); - const int do_float = (ibuf->rect_float != NULL); + const bool do_rect = (ibuf->rect != NULL); + const bool do_float = (ibuf->rect_float != NULL); const size_t rect_size = IMB_get_rect_len(ibuf) * 4; uchar *rect, *_newrect, *newrect; @@ -1033,8 +1031,8 @@ static ImBuf *scaledownx(struct ImBuf *ibuf, int newx) static ImBuf *scaledowny(struct ImBuf *ibuf, int newy) { - const int do_rect = (ibuf->rect != NULL); - const int do_float = (ibuf->rect_float != NULL); + const bool do_rect = (ibuf->rect != NULL); + const bool do_float = (ibuf->rect_float != NULL); const size_t rect_size = IMB_get_rect_len(ibuf) * 4; uchar *rect, *_newrect, *newrect; |