From 929db33828fa86927da2996fa606ecfe522dd677 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Sep 2015 01:52:27 +1000 Subject: [PATCH] Write thumbnail directly BlendThumbnail matches the on-disk format, so just write directly. --- source/blender/blenloader/intern/writefile.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 94f3237d919..6f7157e1a56 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3691,14 +3691,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) static void write_thumb(WriteData *wd, const BlendThumbnail *thumb) { if (thumb) { - size_t sz = BLEN_THUMB_MEMSIZE_FILE(thumb->width, thumb->height); - int *img = alloca(sz); - - BLI_assert((sz - (sizeof(*img) * 2)) == (BLEN_THUMB_MEMSIZE(thumb->width, thumb->height) - sizeof(thumb))); - img[0] = thumb->width; - img[1] = thumb->height; - memcpy(&img[2], thumb->rect, sz - (sizeof(*img) * 2)); - writedata(wd, TEST, sz, img); + writedata(wd, TEST, BLEN_THUMB_MEMSIZE_FILE(thumb->width, thumb->height), thumb); } }