diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_brush.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 116 |
2 files changed, 0 insertions, 122 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 60c50b989fb..9990aeda92b 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -81,12 +81,6 @@ float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float float BKE_brush_sample_masktex(const Scene *scene, struct Brush *br, const float point[3], const int thread, struct ImagePool *pool); -enum BrushImBufFill { BRUSH_IMBUF_MASK, BRUSH_IMBUF_TEX, BRUSH_IMBUF_TEX_MASK }; -void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, bool use_float, - enum BrushImBufFill fill, int size, struct ImBuf **imbuf, - bool use_color_correction, bool use_brush_alpha, - struct ImagePool *pool, struct rctf *mapping); - /* texture */ unsigned int *BKE_brush_gen_texture_cache(struct Brush *br, int half_side); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 621c41c3df7..a8c78b430be 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -758,122 +758,6 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br, return intensity; } -static void brush_imbuf_tex_co(rctf *mapping, int x, int y, float texco[3]) -{ - texco[0] = mapping->xmin + x * mapping->xmax; - texco[1] = mapping->ymin + y * mapping->ymax; - texco[2] = 0.0f; -} - -/* NOTE: only used for 2d brushes currently! and needs to stay in sync - * with brush_painter_2d_do_partial */ -void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, bool use_float, - enum BrushImBufFill fill, int bufsize, - ImBuf **outbuf, bool use_color_correction, bool use_brush_alpha, - struct ImagePool *pool, rctf *mapping) -{ - ImBuf *ibuf; - float xy[2], texco[3], rgba[4], *dstf; - int x, y, rowbytes, xoff, yoff, imbflag; - const int radius = BKE_brush_size_get(scene, brush); - unsigned char *dst, crgb[3]; - const float alpha = (use_brush_alpha)? BKE_brush_alpha_get(scene, brush): 1.0f; - float brush_rgb[3] = {1.0f, 1.0f, 1.0f}; - int thread = 0; - - imbflag = (use_float) ? IB_rectfloat : IB_rect; - xoff = -bufsize / 2.0f + 0.5f; - yoff = -bufsize / 2.0f + 0.5f; - rowbytes = bufsize * 4; - - if (*outbuf) - ibuf = *outbuf; - else - ibuf = IMB_allocImBuf(bufsize, bufsize, 32, imbflag); - - if (use_float) { - if (brush->imagepaint_tool == PAINT_TOOL_DRAW) { - copy_v3_v3(brush_rgb, brush->rgb); - if (use_color_correction) { - srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb); - } - } - - for (y = 0; y < ibuf->y; y++) { - dstf = ibuf->rect_float + y * rowbytes; - - for (x = 0; x < ibuf->x; x++, dstf += 4) { - xy[0] = x + xoff; - xy[1] = y + yoff; - - if (fill == BRUSH_IMBUF_MASK) { - copy_v3_v3(dstf, brush_rgb); - dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); - } - else if (fill == BRUSH_IMBUF_TEX) { - brush_imbuf_tex_co(mapping, x, y, texco); - BKE_brush_sample_tex_3D(scene, brush, texco, dstf, thread, pool); - } - else { /* if (fill == BRUSH_IMBUF_TEX_MASK) */ - brush_imbuf_tex_co(mapping, x, y, texco); - BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool); - - mul_v3_v3v3(dstf, rgba, brush_rgb); - dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); - } - - /* output premultiplied alpha image */ - dstf[0] *= dstf[3]; - dstf[1] *= dstf[3]; - dstf[2] *= dstf[3]; - } - } - } - else { - float alpha_f; /* final float alpha to convert to char */ - - if (brush->imagepaint_tool == PAINT_TOOL_DRAW) - copy_v3_v3(brush_rgb, brush->rgb); - - rgb_float_to_uchar(crgb, brush->rgb); - - for (y = 0; y < ibuf->y; y++) { - dst = (unsigned char *)ibuf->rect + y * rowbytes; - - for (x = 0; x < ibuf->x; x++, dst += 4) { - xy[0] = x + xoff; - xy[1] = y + yoff; - - if (fill == BRUSH_IMBUF_MASK) { - alpha_f = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); - - dst[0] = crgb[0]; - dst[1] = crgb[1]; - dst[2] = crgb[2]; - dst[3] = FTOCHAR(alpha_f); - } - else if (fill == BRUSH_IMBUF_TEX) { - brush_imbuf_tex_co(mapping, x, y, texco); - BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool); - rgba_float_to_uchar(dst, rgba); - } - else { /* if (fill == BRUSH_IMBUF_TEX_MASK) */ - brush_imbuf_tex_co(mapping, x, y, texco); - BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool); - - mul_v3_v3(rgba, brush_rgb); - alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); - - rgb_float_to_uchar(dst, rgba); - dst[3] = FTOCHAR(alpha_f); - } - } - } - } - - *outbuf = ibuf; -} - /* Unified Size and Strength */ /* XXX: be careful about setting size and unprojected radius |