diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 16:39:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 16:39:10 +0300 |
commit | a8e8e08bc678f1f14409248abd4f2e962708727e (patch) | |
tree | 81b5981478350b28c49f12d390c7de5ca0a42907 /source/blender/blenkernel/intern/icons_rasterize.c | |
parent | 9606d28d40809c58cfee7f817fd2c582da5030bd (diff) |
Revert "UI: geometry-icon alpha blend over existing colors"
This reverts commit 9606d28d40809c58cfee7f817fd2c582da5030bd.
Caused issue w/ overlapping triangles,
since this isn't overly important reverting.
Diffstat (limited to 'source/blender/blenkernel/intern/icons_rasterize.c')
-rw-r--r-- | source/blender/blenkernel/intern/icons_rasterize.c | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/source/blender/blenkernel/intern/icons_rasterize.c b/source/blender/blenkernel/intern/icons_rasterize.c index 21d6337439b..24576c24953 100644 --- a/source/blender/blenkernel/intern/icons_rasterize.c +++ b/source/blender/blenkernel/intern/icons_rasterize.c @@ -27,7 +27,6 @@ #include "BLI_utildefines.h" #include "BLI_bitmap_draw_2d.h" #include "BLI_math_geom.h" -#include "BLI_math_color_blend.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -58,17 +57,6 @@ static void tri_fill_flat(int x, int x_end, int y, void *user_data) } } -static void tri_fill_flat_blend(int x, int x_end, int y, void *user_data) -{ - struct UserRasterInfo *data = user_data; - uint *p = &data->rect[(y * data->rect_size[1]) + x]; - uint col = data->color[0]; - while (x++ != x_end) { - blend_color_mix_byte((uchar *)p, (const uchar *)p, (const uchar *)&col); - p++; - } -} - static void tri_fill_smooth(int x, int x_end, int y, void *user_data) { struct UserRasterInfo *data = user_data; @@ -98,36 +86,6 @@ static void tri_fill_smooth(int x, int x_end, int y, void *user_data) } } -static void tri_fill_smooth_blend(int x, int x_end, int y, void *user_data) -{ - struct UserRasterInfo *data = user_data; - uint *p = &data->rect[(y * data->rect_size[1]) + x]; - float pt_step_fl[2] = {(float)x, (float)y}; - while (x++ != x_end) { - float w[3]; - barycentric_weights_v2_clamped(UNPACK3(data->smooth.pt_fl), pt_step_fl, w); - - uint col_u[4] = {0, 0, 0, 0}; - for (uint corner = 0; corner < 3; corner++) { - for (uint chan = 0; chan < 4; chan++) { - col_u[chan] += data->smooth.color_u[corner][chan] * (uint)(w[corner] * 255.0f); - } - } - union { - uint as_u32; - uchar as_bytes[4]; - } col; - col.as_bytes[0] = (uchar)(col_u[0] / 255); - col.as_bytes[1] = (uchar)(col_u[1] / 255); - col.as_bytes[2] = (uchar)(col_u[2] / 255); - col.as_bytes[3] = (uchar)(col_u[3] / 255); - blend_color_mix_byte((uchar *)p, (const uchar *)p, col.as_bytes); - p++; - - pt_step_fl[0] += 1.0f; - } -} - ImBuf *BKE_icon_geom_rasterize( const struct Icon_Geom *geom, const unsigned int size_x, const unsigned int size_y) @@ -171,8 +129,7 @@ ImBuf *BKE_icon_geom_rasterize( } data.color = col; if ((col[0] == col[1]) && (col[0] == col[2])) { - bool no_alpha = ((uchar *)col)[3] == 0xff; - BLI_bitmap_draw_2d_tri_v2i(UNPACK3(data.pt), no_alpha ? tri_fill_flat : tri_fill_flat_blend, &data); + BLI_bitmap_draw_2d_tri_v2i(UNPACK3(data.pt), tri_fill_flat, &data); } else { ARRAY_SET_ITEMS(data.smooth.pt_fl[0], UNPACK2_EX((float), data.pt[0], )); @@ -181,11 +138,7 @@ ImBuf *BKE_icon_geom_rasterize( ARRAY_SET_ITEMS(data.smooth.color_u[0], UNPACK4_EX((uint), ((uchar *)(col + 0)), )); ARRAY_SET_ITEMS(data.smooth.color_u[1], UNPACK4_EX((uint), ((uchar *)(col + 1)), )); ARRAY_SET_ITEMS(data.smooth.color_u[2], UNPACK4_EX((uint), ((uchar *)(col + 2)), )); - bool no_alpha = ( - (((uchar *)(col + 0))[3] == 0xff) && - (((uchar *)(col + 1))[3] == 0xff) && - (((uchar *)(col + 2))[3] == 0xff)); - BLI_bitmap_draw_2d_tri_v2i(UNPACK3(data.pt), no_alpha ? tri_fill_smooth : tri_fill_smooth_blend, &data); + BLI_bitmap_draw_2d_tri_v2i(UNPACK3(data.pt), tri_fill_smooth, &data); } } IMB_scaleImBuf(ibuf, size_x, size_y); |