diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-18 00:36:02 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-18 00:36:02 +0300 |
commit | f425f40c4e17e889c720647b26c07ae3f6d3ba64 (patch) | |
tree | b8b42d0862def239c0a05d2b3cae452aba68464d /source/blender/windowmanager/intern/wm_splash_screen.c | |
parent | 85e78fa17cd54676b5aa9a15a0b885b4a7187086 (diff) |
Cleanup: More miscellaneous code quality changes in wm directory
- Declare variables where initialized.
- Use LISTBASE_FOREACH macro.
- Reduce variable scope.
- Return early or reduce indentation in some cases.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_splash_screen.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_splash_screen.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index e9be0c33735..eda94f16b25 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -156,8 +156,6 @@ static ImBuf *wm_block_splash_image(int width, int *r_height) extern int datatoc_splash_png_size; ImBuf *ibuf = NULL; - int height = 0; - if (U.app_template[0] != '\0') { char splash_filepath[FILE_MAX]; char template_directory[FILE_MAX]; @@ -174,6 +172,7 @@ static ImBuf *wm_block_splash_image(int width, int *r_height) ibuf = IMB_ibImageFromMemory(splash_data, splash_data_size, IB_rect, NULL, "<splash screen>"); } + int height = 0; if (ibuf) { height = (width * ibuf->y) / ibuf->x; if (width != ibuf->x || height != ibuf->y) { @@ -195,11 +194,9 @@ static ImBuf *wm_block_splash_image(int width, int *r_height) static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSED(arg)) { - uiBlock *block; - uiBut *but; const uiStyle *style = UI_style_get_dpi(); - block = UI_block_begin(C, region, "splash", UI_EMBOSS); + uiBlock *block = UI_block_begin(C, region, "splash", UI_EMBOSS); /* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized * with the OS when the splash shows, window clipping in this case gives @@ -214,7 +211,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE * first draw or if the image changed. */ ImBuf *ibuf = wm_block_splash_image(splash_width, &splash_height); - but = uiDefButImage(block, ibuf, 0, 0.5f * U.widget_unit, splash_width, splash_height, NULL); + uiBut *but = uiDefButImage( + block, ibuf, 0, 0.5f * U.widget_unit, splash_width, splash_height, NULL); UI_but_func_set(but, wm_block_close, block, NULL); UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL); @@ -262,7 +260,6 @@ void WM_OT_splash(wmOperatorType *ot) static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED(arg)) { - uiBlock *block; const uiStyle *style = UI_style_get_dpi(); const int dialog_width = U.widget_unit * 24; const short logo_size = 128 * U.dpi_fac; @@ -270,7 +267,7 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED /* Calculate icon column factor. */ const float split_factor = (float)logo_size / (float)(dialog_width - style->columnspace); - block = UI_block_begin(C, region, "about", UI_EMBOSS); + uiBlock *block = UI_block_begin(C, region, "about", UI_EMBOSS); UI_block_flag_enable( block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT); |