diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-06 13:04:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-06 13:04:25 +0300 |
commit | a0912ff5663b950222ef00485a3853bfb6001db4 (patch) | |
tree | 86d109d8543ae752e802af6d7f4998d3be218741 /source/blender/blenkernel/intern/main.c | |
parent | 49f1695ed06792ea1f4d1a43d30170c407f227f8 (diff) |
Cleanup: support passing in arbitrary buffers to IMB_allocFromBuffer
Also remove IB_metadata flag from the resulting imbuf as this image
has no meta-data.
Diffstat (limited to 'source/blender/blenkernel/intern/main.c')
-rw-r--r-- | source/blender/blenkernel/intern/main.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c index bb33f5f9f87..981f1d4a623 100644 --- a/source/blender/blenkernel/intern/main.c +++ b/source/blender/blenkernel/intern/main.c @@ -405,11 +405,8 @@ ImBuf *BKE_main_thumbnail_to_imbuf(Main *bmain, BlendThumbnail *data) } if (data) { - /* NOTE: we cannot use IMB_allocFromBuffer(), since it tries to dupalloc passed buffer, - * which will fail here (we do not want to pass the first two ints!). */ - img = IMB_allocImBuf( - (unsigned int)data->width, (unsigned int)data->height, 32, IB_rect | IB_metadata); - memcpy(img->rect, data->rect, BLEN_THUMB_MEMSIZE(data->width, data->height) - sizeof(*data)); + img = IMB_allocFromBuffer( + (const uint *)data->rect, NULL, (uint)data->width, (uint)data->height, 4); } return img; |