diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-15 03:47:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-15 04:24:26 +0300 |
commit | a9fbd05e7d40eb19d9ef8939dd6341386767cd44 (patch) | |
tree | 78e44009cd9165c0bab72a890e0f2afba3251306 /source/blender/imbuf | |
parent | 100af18955b86faa473318c806b6b5ce029f471e (diff) |
Fix image undo restoring float/byte tiles into the wrong buffer type
This also resolves the (unlikely) issue of undo having uninitialized
zbuf data, now it's cleared instead.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/IMB_imbuf.h | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 9e9c47194e1..173c8135f96 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -700,6 +700,8 @@ void imb_freemipmapImBuf(struct ImBuf *ibuf); bool imb_addtilesImBuf(struct ImBuf *ibuf); void imb_freetilesImBuf(struct ImBuf *ibuf); +void imb_freerectImbuf_all(struct ImBuf *ibuf); + /* threaded processors */ void IMB_processor_apply_threaded( int buffer_lines, diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 75db3fd3c73..381de9de610 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -197,6 +197,17 @@ void IMB_freezbuffloatImBuf(ImBuf *ibuf) ibuf->mall &= ~IB_zbuffloat; } +/** Free all pixel data (assosiated with image size). */ +void imb_freerectImbuf_all(ImBuf *ibuf) +{ + imb_freerectImBuf(ibuf); + imb_freerectfloatImBuf(ibuf); + imb_freetilesImBuf(ibuf); + IMB_freezbufImBuf(ibuf); + IMB_freezbuffloatImBuf(ibuf); + freeencodedbufferImBuf(ibuf); +} + void IMB_freeImBuf(ImBuf *ibuf) { if (ibuf) { @@ -212,12 +223,7 @@ void IMB_freeImBuf(ImBuf *ibuf) BLI_spin_unlock(&refcounter_spin); if (needs_free) { - imb_freerectImBuf(ibuf); - imb_freerectfloatImBuf(ibuf); - imb_freetilesImBuf(ibuf); - IMB_freezbufImBuf(ibuf); - IMB_freezbuffloatImBuf(ibuf); - freeencodedbufferImBuf(ibuf); + imb_freerectImbuf_all(ibuf); IMB_metadata_free(ibuf->metadata); colormanage_cache_free(ibuf); |