diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-09-12 20:39:24 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-09-12 21:21:13 +0300 |
commit | bc15c83afaf952f9c9651866923c4980d7934259 (patch) | |
tree | 9c25f62a18a0a9f955d96e510d4b3e7de9ba2240 /source/blender/imbuf/intern/stereoimbuf.c | |
parent | 100fe61f7c5be981193a46776cef5ba4df64eb31 (diff) |
Fix T100886: error saving side-by-side stereo EXR image of depth pass
The stereo saving code that combines two image buffers into one did not work
correctly when the number of channels is not equal to 4.
Diffstat (limited to 'source/blender/imbuf/intern/stereoimbuf.c')
-rw-r--r-- | source/blender/imbuf/intern/stereoimbuf.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/stereoimbuf.c b/source/blender/imbuf/intern/stereoimbuf.c index 2a0baaf6172..ba1840a5fcd 100644 --- a/source/blender/imbuf/intern/stereoimbuf.c +++ b/source/blender/imbuf/intern/stereoimbuf.c @@ -761,11 +761,14 @@ ImBuf *IMB_stereo3d_ImBuf(const ImageFormatData *im_format, ImBuf *ibuf_left, Im IMB_stereo3d_write_dimensions( im_format->stereo3d_format.display_mode, false, ibuf_left->x, ibuf_left->y, &width, &height); - ibuf_stereo = IMB_allocImBuf( - width, height, ibuf_left->planes, (is_float ? IB_rectfloat : IB_rect)); + ibuf_stereo = IMB_allocImBuf(width, height, ibuf_left->planes, 0); - ibuf_stereo->rect_colorspace = ibuf_left->rect_colorspace; - ibuf_stereo->float_colorspace = ibuf_left->float_colorspace; + if (is_float) { + imb_addrectfloatImBuf(ibuf_stereo, ibuf_left->channels); + } + else { + imb_addrectImBuf(ibuf_stereo); + } ibuf_stereo->flags = ibuf_left->flags; @@ -773,7 +776,7 @@ ImBuf *IMB_stereo3d_ImBuf(const ImageFormatData *im_format, ImBuf *ibuf_left, Im is_float, ibuf_left->x, ibuf_left->y, - 4, + ibuf_left->channels, (int *)ibuf_left->rect, (int *)ibuf_right->rect, (int *)ibuf_stereo->rect, @@ -1286,10 +1289,17 @@ void IMB_ImBufFromStereo3d(const Stereo3dFormat *s3d, &width, &height); - ibuf_left = IMB_allocImBuf( - width, height, ibuf_stereo3d->planes, (is_float ? IB_rectfloat : IB_rect)); - ibuf_right = IMB_allocImBuf( - width, height, ibuf_stereo3d->planes, (is_float ? IB_rectfloat : IB_rect)); + ibuf_left = IMB_allocImBuf(width, height, ibuf_stereo3d->planes, 0); + ibuf_right = IMB_allocImBuf(width, height, ibuf_stereo3d->planes, 0); + + if (is_float) { + imb_addrectfloatImBuf(ibuf_left, ibuf_stereo3d->channels); + imb_addrectfloatImBuf(ibuf_right, ibuf_stereo3d->channels); + } + else { + imb_addrectImBuf(ibuf_left); + imb_addrectImBuf(ibuf_right); + } ibuf_left->flags = ibuf_stereo3d->flags; ibuf_right->flags = ibuf_stereo3d->flags; @@ -1307,7 +1317,7 @@ void IMB_ImBufFromStereo3d(const Stereo3dFormat *s3d, is_float, ibuf_left->x, ibuf_left->y, - 4, + ibuf_left->channels, (int *)ibuf_left->rect, (int *)ibuf_right->rect, (int *)ibuf_stereo3d->rect, |