Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-01-02 17:29:01 +0300
committerJulian Eisel <julian@blender.org>2021-01-02 17:36:51 +0300
commit0330b0552b90e647df3ea1f2094f4517df26250d (patch)
tree5c21e8fc0a66510510fdc740d265cf4f07f4f1c8 /source/blender/editors/interface
parent057a8afb879c58fa40b10a2ab55debded82d19bb (diff)
Cleanup: Explicitly pass icon size to generation function, not just bool
* This way you don't have to look up the function declaration to know what the boolean value means. * You can call the function in a loop over the available sizes and pass the index as size. * Makes it easier to add a new size in future if needed.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_icons.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 1a214d6a899..4e1088edb82 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1955,7 +1955,8 @@ static void ui_id_preview_image_render_size(
/**
* Note that if an ID doesn't support jobs for preview creation, \a use_job will be ignored.
*/
-void UI_icon_render_id(const bContext *C, Scene *scene, ID *id, const bool big, const bool use_job)
+void UI_icon_render_id(
+ const bContext *C, Scene *scene, ID *id, const enum eIconSizes size, const bool use_job)
{
PreviewImage *pi = BKE_previewimg_id_ensure(id);
@@ -1963,14 +1964,7 @@ void UI_icon_render_id(const bContext *C, Scene *scene, ID *id, const bool big,
return;
}
- if (big) {
- /* bigger preview size */
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job);
- }
- else {
- /* icon size */
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job);
- }
+ ui_id_preview_image_render_size(C, scene, id, pi, size, use_job);
}
static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
@@ -2170,7 +2164,7 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool big)
case ID_LA: /* fall through */
iconid = BKE_icon_id_ensure(id);
/* checks if not exists, or changed */
- UI_icon_render_id(C, NULL, id, big, true);
+ UI_icon_render_id(C, NULL, id, big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON, true);
break;
case ID_SCR:
iconid = ui_id_screen_get_icon(C, id);