diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-06 13:04:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-06 13:05:58 +0300 |
commit | 687f70ceca88324fb8f376e086a55b341dd34e6f (patch) | |
tree | 1d9b467aecc63dbb78c77d67d046e3a86527cef1 /source/blender/windowmanager | |
parent | a0912ff5663b950222ef00485a3853bfb6001db4 (diff) |
ImBuf: add IMB_allocFromBufferOwn that takes ownership of the buffer
Avoids duplicating the image buffer when saving thumbnails.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 30b76fd110b..2b796e60cdc 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1539,7 +1539,7 @@ static ImBuf *blend_file_thumb_from_screenshot(bContext *C, BlendThumbnail **thu int win_size[2]; uint *buffer = WM_window_pixels_read(CTX_wm_manager(C), win, win_size); - ImBuf *ibuf = IMB_allocFromBuffer(buffer, NULL, win_size[0], win_size[1], 24); + ImBuf *ibuf = IMB_allocFromBufferOwn(buffer, NULL, win_size[0], win_size[1], 24); if (ibuf) { int ex, ey; @@ -1561,7 +1561,6 @@ static ImBuf *blend_file_thumb_from_screenshot(bContext *C, BlendThumbnail **thu BlendThumbnail *thumb = BKE_main_thumbnail_from_imbuf(NULL, thumb_ibuf); IMB_freeImBuf(thumb_ibuf); - MEM_freeN(buffer); *thumb_pt = thumb; } WM_cursor_wait(false); |