diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-08 13:10:29 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-08 13:11:05 +0300 |
commit | 3926ec6aa1bc6981fc7e2e07a94b1d92d8518111 (patch) | |
tree | ab5f4e675d2987f59ee22540a698c96bb083b701 /source/blender/blenkernel/intern/studiolight.c | |
parent | 1f1e26f1ab8bc2032e65b966c0d08fc56a048c2d (diff) |
Studiolight: Segment when using float based matcaps
Diffstat (limited to 'source/blender/blenkernel/intern/studiolight.c')
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index da3cc97c43f..e4b49656907 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -584,15 +584,19 @@ static uint *studiolight_matcap_preview(StudioLight *sl, int icon_size) BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED); uint *rect = MEM_mallocN(icon_size * icon_size * sizeof(uint), __func__); + const uint alphamask = 0xff000000; + float color[4]; + float fx, fy; int offset = 0; ImBuf *ibuf = sl->equirectangular_radiance_buffer; for (int y = 0; y < icon_size; y++) { for (int x = 0; x < icon_size; x++) { - uint pixelresult = 0x0; - float fx = x * ibuf->x / icon_size; - float fy = y * ibuf->y / icon_size; - nearest_interpolation_color(ibuf, (uchar *)&pixelresult, NULL, fx, fy); - rect[offset++] = pixelresult; + fx = x * ibuf->x / icon_size; + fy = y * ibuf->y / icon_size; + nearest_interpolation_color(ibuf, NULL, color, fx, fy); + rect[offset++] = rgb_to_cpack(linearrgb_to_srgb(color[0]), + linearrgb_to_srgb(color[1]), + linearrgb_to_srgb(color[2])) | alphamask; } } return rect; @@ -834,4 +838,4 @@ void BKE_studiolight_refresh(void) { BKE_studiolight_free(); BKE_studiolight_init(); -}
\ No newline at end of file +} |