diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:10:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:10:19 +0300 |
commit | 06a1a66a9b6f120867d3bbebe3928744ec8e3495 (patch) | |
tree | 42e827a3cf58eb76474e479206b02a8d97dd3bf7 /source/blender/imbuf/intern/imageprocess.c | |
parent | 61d27db35967710421ab92748e09624db068258d (diff) | |
parent | a24b4e6090057479796e914bc603119b12f6ca06 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/imbuf/intern/imageprocess.c')
-rw-r--r-- | source/blender/imbuf/intern/imageprocess.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 0f5fd6518fb..2eec5da7bc4 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -87,10 +87,10 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float ** { size_t offset = ((size_t)ibuf->x) * y * 4 + 4 * x; - + if (ibuf->rect) *outI = (unsigned char *)ibuf->rect + offset; - + if (ibuf->rect_float) *outF = ibuf->rect_float + offset; } @@ -112,13 +112,13 @@ void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, in { unsigned char *outI = NULL; float *outF = NULL; - + if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) { return; } - + pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */ - + bicubic_interpolation_color(in, outI, outF, u, v); } @@ -145,8 +145,8 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], unsigned char *row1I, *row2I, *row3I, *row4I; float a_b, ma_b, a_mb, ma_mb; int y1, y2, x1, x2; - - + + /* ImBuf in must have a valid rect or rect_float, assume this is already checked */ x1 = (int)floor(u); @@ -194,7 +194,7 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], row2I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1; row3I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2; row4I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2; - + /* need to add 0.5 to avoid rounding down (causes darken with the smear brush) * tested with white images and this should not wrap back to zero */ outI[0] = (ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]) + 0.5f; @@ -208,13 +208,13 @@ void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, i { unsigned char *outI = NULL; float *outF = NULL; - + if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) { return; } - + pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */ - + bilinear_interpolation_color(in, outI, outF, u, v); } @@ -227,7 +227,7 @@ void nearest_interpolation_color(struct ImBuf *in, unsigned char outI[4], float int y1, x1; /* ImBuf in must have a valid rect or rect_float, assume this is already checked */ - + x1 = (int)(u); y1 = (int)(v); @@ -316,9 +316,9 @@ void nearest_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, in if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) { return; } - + pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */ - + nearest_interpolation_color(in, outI, outF, x, y); } |