Fix T101245: Allow Thumbnails of > 256:1 Images

Ensure that thumbnails of images with aspect greater than 256:1 have
dimensions of at least one pixel.

See D16707 for more details

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

Reviewed by Brecht Van Lommel
This commit is contained in:
Harley Acheson
2022-12-06 08:14:02 -08:00
parent 995f757049
commit 87582d95df
2 changed files with 4 additions and 4 deletions

View File

@@ -2215,8 +2215,8 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath,
float scale_factor = MIN2(float(max_thumb_size) / float(source_w),
float(max_thumb_size) / float(source_h));
int dest_w = int(source_w * scale_factor);
int dest_h = int(source_h * scale_factor);
int dest_w = MAX2(int(source_w * scale_factor), 1);
int dest_h = MAX2(int(source_h * scale_factor), 1);
struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rectfloat);

View File

@@ -112,8 +112,8 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath,
*r_height = (size_t)config.input.height;
const float scale = (float)max_thumb_size / MAX2(config.input.width, config.input.height);
const int dest_w = (int)(config.input.width * scale);
const int dest_h = (int)(config.input.height * scale);
const int dest_w = MAX2((int)(config.input.width * scale), 1);
const int dest_h = MAX2((int)(config.input.height * scale), 1);
colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rect);