Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/imageprocess.c
| Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | void bilinear_interpolation_color_wrap( | ||||
| } | } | ||||
| if (outI) { | if (outI) { | ||||
| /* sample including outside of edges of image */ | /* sample including outside of edges of image */ | ||||
| row1I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1; | row1I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1; | ||||
| row2I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1; | 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; | 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; | 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. */ | ||||
| * tested with white images and this should not wrap back to zero */ | |||||
| outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]); | outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]); | ||||
| outI[1] = roundf(ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]); | outI[1] = roundf(ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]); | ||||
| outI[2] = roundf(ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]); | outI[2] = roundf(ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]); | ||||
| outI[3] = roundf(ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]); | outI[3] = roundf(ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]); | ||||
| } | } | ||||
| } | } | ||||
| void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout) | void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout) | ||||
| ▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines | |||||