diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-11 18:15:52 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-11 18:15:52 +0400 |
commit | 07580e71a6153641f8ecd25fbd1dd35fa23421b3 (patch) | |
tree | 81a1ae77ecbd905fc33f0268c62930a43c2ef5a3 /source | |
parent | 5c4a080021ef565611f52ea5ebc37e30224b3b3f (diff) |
Fix issue with bright frames appearing in clip editor when compositor is open.
Allocate float buffer outside of image buffer,
so work-in-progress color space conversion doesn't
interfere with other parts of blender.
Covers most of cases -- since image buffer wouldn't
have partially-update float buffer all the rest
areas would be happy.
However, if there're places which updates float
buffer from byte buffer, it's still possible
some WIP color space conversion is displayed on
the screen.
But what a heck someone will do such a crappy
conversion anyway!
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index e69460de040..76a5e98da7e 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -627,36 +627,47 @@ void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w void IMB_float_from_rect(ImBuf *ibuf) { + float *rect_float; + /* verify if we byte and float buffers */ if (ibuf->rect == NULL) return; - /* lock the color management thread - * need this because allocated but not filled float buffer will confuse - * display transform which lead to black areas across the frame + /* allocate float buffer outside of image buffer, + * so work-in-progress color space conversion doesn't + * interfere with other parts of blender */ - BLI_lock_thread(LOCK_COLORMANAGE); + rect_float = ibuf->rect_float; + if (rect_float == NULL) { + int size; - if (ibuf->rect_float == NULL) { - if (imb_addrectfloatImBuf(ibuf) == 0) { - BLI_unlock_thread(LOCK_COLORMANAGE); + size = ibuf->x * ibuf->y; + size = size * 4 * sizeof(float); + ibuf->channels = 4; + + rect_float = MEM_mapallocN(size, "IMB_float_from_rect"); + if (rect_float == NULL) return; - } } /* first, create float buffer in non-linear space */ - IMB_buffer_float_from_byte(ibuf->rect_float, (unsigned char *) ibuf->rect, IB_PROFILE_SRGB, IB_PROFILE_SRGB, + IMB_buffer_float_from_byte(rect_float, (unsigned char *) ibuf->rect, IB_PROFILE_SRGB, IB_PROFILE_SRGB, FALSE, ibuf->x, ibuf->y, ibuf->x, ibuf->x); /* then make float be in linear space */ - IMB_colormanagement_colorspace_to_scene_linear(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels, + IMB_colormanagement_colorspace_to_scene_linear(rect_float, ibuf->x, ibuf->y, ibuf->channels, ibuf->rect_colorspace, FALSE); /* byte buffer is straight alpha, float should always be premul */ - IMB_premultiply_rect_float(ibuf->rect_float, ibuf->planes, ibuf->x, ibuf->y); + IMB_premultiply_rect_float(rect_float, ibuf->channels, ibuf->x, ibuf->y); + - BLI_unlock_thread(LOCK_COLORMANAGE); + if (ibuf->rect_float == NULL) { + ibuf->rect_float = rect_float; + ibuf->mall |= IB_rectfloat; + ibuf->flags |= IB_rectfloat; + } } /**************************** Color to Grayscale *****************************/ |