From 1b974563b17b3a1ee02d81df952a66ecf66919c4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 1 Nov 2018 12:06:04 +0100 Subject: Fix T57529: 2D image paint fill tool not taking into account alpha. --- source/blender/editors/sculpt_paint/paint_image_2d.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/sculpt_paint/paint_image_2d.c') diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index ddfee5de4d7..d89d4f72d3d 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1419,8 +1419,9 @@ static void paint_2d_fill_add_pixel_byte( float color_f[4]; unsigned char *color_b = (unsigned char *)(ibuf->rect + coordinate); rgba_uchar_to_float(color_f, color_b); + straight_to_premul_v4(color_f); - if (compare_len_squared_v3v3(color_f, color, threshold_sq)) { + if (compare_len_squared_v4v4(color_f, color, threshold_sq)) { BLI_stack_push(stack, &coordinate); } BLI_BITMAP_SET(touched, coordinate, true); @@ -1439,7 +1440,7 @@ static void paint_2d_fill_add_pixel_float( coordinate = ((size_t)y_px) * ibuf->x + x_px; if (!BLI_BITMAP_TEST(touched, coordinate)) { - if (compare_len_squared_v3v3(ibuf->rect_float + 4 * coordinate, color, threshold_sq)) { + if (compare_len_squared_v4v4(ibuf->rect_float + 4 * coordinate, color, threshold_sq)) { BLI_stack_push(stack, &coordinate); } BLI_BITMAP_SET(touched, coordinate, true); @@ -1546,6 +1547,7 @@ void paint_2d_bucket_fill( else { int pixel_color_b = *(ibuf->rect + coordinate); rgba_uchar_to_float(pixel_color, (unsigned char *)&pixel_color_b); + straight_to_premul_v4(pixel_color); } BLI_stack_push(stack, &coordinate); -- cgit v1.2.3