[Bf-blender-cvs] [bf0ac711fde] master: UI: Increase Size of Blend File Thumbnails

Harley Acheson noreply at git.blender.org
Mon Sep 6 04:56:53 CEST 2021


Commit: bf0ac711fde2e0439af117f73ab1b3a758969348
Author: Harley Acheson
Date:   Sun Sep 5 19:55:50 2021 -0700
Branches: master
https://developer.blender.org/rBbf0ac711fde2e0439af117f73ab1b3a758969348

UI: Increase Size of Blend File Thumbnails

Increase effective resolution of blend preview images from 128x128 to
256x256 for versions saved in the file system thumbnail cache.

See D10491 for details and examples.

Differential Revision: https://developer.blender.org/D10491

Reviewed by Campbell Barton

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

M	source/blender/imbuf/IMB_thumbs.h
M	source/blender/imbuf/intern/thumbs.c
M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h
index 9dd0cbe895f..e1a315a0bd2 100644
--- a/source/blender/imbuf/IMB_thumbs.h
+++ b/source/blender/imbuf/IMB_thumbs.h
@@ -52,6 +52,7 @@ typedef enum ThumbSource {
 #define THUMB_SIZE_MAX (100 * 1024 * 1024)
 
 #define PREVIEW_RENDER_DEFAULT_HEIGHT 128
+#define PREVIEW_RENDER_LARGE_HEIGHT 256
 
 /* Note this can also be used as versioning system,
  * to force refreshing all thumbnails if e.g. we change some thumb generating code or so.
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index a09f06726a6..aa1da65253d 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -347,7 +347,7 @@ static ImBuf *thumb_create_ex(const char *file_path,
       tsize = PREVIEW_RENDER_DEFAULT_HEIGHT;
       break;
     case THB_LARGE:
-      tsize = PREVIEW_RENDER_DEFAULT_HEIGHT * 2;
+      tsize = PREVIEW_RENDER_LARGE_HEIGHT;
       break;
     case THB_FAIL:
       tsize = 1;
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index f83511e76f0..8eaac47471a 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1573,8 +1573,8 @@ static ImBuf *blend_file_thumb(const bContext *C,
                                                  NULL,
                                                  OB_SOLID,
                                                  scene->camera,
-                                                 BLEN_THUMB_SIZE * 2,
-                                                 BLEN_THUMB_SIZE * 2,
+                                                 PREVIEW_RENDER_LARGE_HEIGHT * 2,
+                                                 PREVIEW_RENDER_LARGE_HEIGHT * 2,
                                                  IB_rect,
                                                  V3D_OFSDRAW_NONE,
                                                  R_ALPHAPREMUL,
@@ -1588,8 +1588,8 @@ static ImBuf *blend_file_thumb(const bContext *C,
                                           OB_SOLID,
                                           v3d,
                                           region,
-                                          BLEN_THUMB_SIZE * 2,
-                                          BLEN_THUMB_SIZE * 2,
+                                          PREVIEW_RENDER_LARGE_HEIGHT * 2,
+                                          PREVIEW_RENDER_LARGE_HEIGHT * 2,
                                           IB_rect,
                                           R_ALPHAPREMUL,
                                           NULL,
@@ -1610,8 +1610,14 @@ static ImBuf *blend_file_thumb(const bContext *C,
 
   if (ibuf) {
     /* dirty oversampling */
-    IMB_scaleImBuf(ibuf, BLEN_THUMB_SIZE, BLEN_THUMB_SIZE);
-    thumb = BKE_main_thumbnail_from_imbuf(NULL, ibuf);
+    ImBuf *thumb_ibuf;
+    thumb_ibuf = IMB_dupImBuf(ibuf);
+    /* BLEN_THUMB_SIZE is size of thumbnail inside blend file: 128x128. */
+    IMB_scaleImBuf(thumb_ibuf, BLEN_THUMB_SIZE, BLEN_THUMB_SIZE);
+    thumb = BKE_main_thumbnail_from_imbuf(NULL, thumb_ibuf);
+    IMB_freeImBuf(thumb_ibuf);
+    /* Thumbnail saved to filesystem should be 256x256. */
+    IMB_scaleImBuf(ibuf, PREVIEW_RENDER_LARGE_HEIGHT, PREVIEW_RENDER_LARGE_HEIGHT);
   }
   else {
     /* '*thumb_pt' needs to stay NULL to prevent a bad thumbnail from being handled */



More information about the Bf-blender-cvs mailing list