[Bf-blender-cvs] [929db33] master: Write thumbnail directly

Campbell Barton noreply at git.blender.org
Mon Aug 31 18:01:38 CEST 2015


Commit: 929db33828fa86927da2996fa606ecfe522dd677
Author: Campbell Barton
Date:   Tue Sep 1 01:52:27 2015 +1000
Branches: master
https://developer.blender.org/rB929db33828fa86927da2996fa606ecfe522dd677

Write thumbnail directly

BlendThumbnail matches the on-disk format, so just write directly.

===================================================================

M	source/blender/blenloader/intern/writefile.c

===================================================================

diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 94f3237..6f7157e 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);
 	}
 }




More information about the Bf-blender-cvs mailing list