From 2fdca5bd1981cddad16715598b4892a2c6099e2f Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 22 Jun 2020 21:44:18 +0200 Subject: Refactoring: View2DScrollers memory allocation View2DScrollers used the memory manager to allocate memory. This isn't a problem but in a upcoming change the scrollers will be drawn more often than it used to (See {D8066}). To limit the number of allocations and frees this patch will use the stack for allocation. Reviewed By: Campbell Barton Differential Revision: https://developer.blender.org/D8076 --- release/datafiles/locale | 2 +- release/scripts/addons | 2 +- release/scripts/addons_contrib | 2 +- source/blender/editors/include/UI_view2d.h | 7 +- source/blender/editors/interface/view2d.c | 76 ++++++++++------------ source/blender/editors/interface/view2d_ops.c | 17 +++-- source/blender/editors/screen/area.c | 4 +- source/blender/editors/space_action/space_action.c | 5 +- source/blender/editors/space_clip/space_clip.c | 10 +-- .../blender/editors/space_console/space_console.c | 5 +- source/blender/editors/space_file/space_file.c | 5 +- source/blender/editors/space_graph/space_graph.c | 10 +-- source/blender/editors/space_info/space_info.c | 5 +- source/blender/editors/space_nla/space_nla.c | 10 +-- source/blender/editors/space_node/node_draw.c | 5 +- .../editors/space_outliner/space_outliner.c | 5 +- .../editors/space_sequencer/sequencer_draw.c | 5 +- 17 files changed, 63 insertions(+), 112 deletions(-) diff --git a/release/datafiles/locale b/release/datafiles/locale index 72e5040232a..caf68fed42f 160000 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 72e5040232a544b293dca05dac5707bd4e4bffaf +Subproject commit caf68fed42f55e606b14c7105f5df694957ce036 diff --git a/release/scripts/addons b/release/scripts/addons index 8397b98b8cb..bc1262f4d61 160000 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 8397b98b8cb6510869d28a84592b8d7213c3b6c2 +Subproject commit bc1262f4d61feeba235bb75046e65e0e8411241f diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index 7c36b48507f..45aa940dabd 160000 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit 7c36b48507f79ca62f8c038bad0fb3468c4f48e2 +Subproject commit 45aa940dabda64f7877c6d5dd843998a86f0a836 diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index ffc06e94a90..0ddc45f4878 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -180,9 +180,10 @@ void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region, int colorid); /* scrollbar drawing */ -View2DScrollers *UI_view2d_scrollers_calc(struct View2D *v2d, const struct rcti *mask_custom); -void UI_view2d_scrollers_draw(struct View2D *v2d, View2DScrollers *scrollers); -void UI_view2d_scrollers_free(View2DScrollers *scrollers); +void UI_view2d_scrollers_calc(struct View2D *v2d, + const struct rcti *mask_custom, + struct View2DScrollers *r_scrollers); +void UI_view2d_scrollers_draw(struct View2D *v2d, const struct rcti *mask_custom); /* list view tools */ void UI_view2d_listview_view_to_cell(float columnwidth, diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 8fee9df8706..1e1f4e1a55b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1413,17 +1413,15 @@ struct View2DScrollers { }; /* Calculate relevant scroller properties */ -View2DScrollers *UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom) +void UI_view2d_scrollers_calc(View2D *v2d, + const rcti *mask_custom, + struct View2DScrollers *r_scrollers) { - View2DScrollers *scrollers; rcti vert, hor; float fac1, fac2, totsize, scrollsize; int scroll = view2d_scroll_mapped(v2d->scroll); int smaller; - /* scrollers is allocated here... */ - scrollers = MEM_callocN(sizeof(View2DScrollers), "View2DScrollers"); - /* Always update before drawing (for dynamically sized scrollers). */ view2d_masks(v2d, mask_custom); @@ -1456,8 +1454,8 @@ View2DScrollers *UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom) CLAMP(hor.xmin, hor.xmin, hor.xmax - V2D_SCROLL_HANDLE_SIZE_HOTSPOT); /* store in scrollers, used for drawing */ - scrollers->vert = vert; - scrollers->hor = hor; + r_scrollers->vert = vert; + r_scrollers->hor = hor; /* scroller 'buttons': * - These should always remain within the visible region of the scrollbar @@ -1475,30 +1473,30 @@ View2DScrollers *UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom) fac1 = (v2d->cur.xmin - v2d->tot.xmin) / totsize; if (fac1 <= 0.0f) { - scrollers->hor_min = hor.xmin; + r_scrollers->hor_min = hor.xmin; } else { - scrollers->hor_min = (int)(hor.xmin + (fac1 * scrollsize)); + r_scrollers->hor_min = (int)(hor.xmin + (fac1 * scrollsize)); } fac2 = (v2d->cur.xmax - v2d->tot.xmin) / totsize; if (fac2 >= 1.0f) { - scrollers->hor_max = hor.xmax; + r_scrollers->hor_max = hor.xmax; } else { - scrollers->hor_max = (int)(hor.xmin + (fac2 * scrollsize)); + r_scrollers->hor_max = (int)(hor.xmin + (fac2 * scrollsize)); } /* prevent inverted sliders */ - if (scrollers->hor_min > scrollers->hor_max) { - scrollers->hor_min = scrollers->hor_max; + if (r_scrollers->hor_min > r_scrollers->hor_max) { + r_scrollers->hor_min = r_scrollers->hor_max; } /* prevent sliders from being too small to grab */ - if ((scrollers->hor_max - scrollers->hor_min) < V2D_SCROLL_THUMB_SIZE_MIN) { - scrollers->hor_max = scrollers->hor_min + V2D_SCROLL_THUMB_SIZE_MIN; + if ((r_scrollers->hor_max - r_scrollers->hor_min) < V2D_SCROLL_THUMB_SIZE_MIN) { + r_scrollers->hor_max = r_scrollers->hor_min + V2D_SCROLL_THUMB_SIZE_MIN; - CLAMP(scrollers->hor_max, hor.xmin + V2D_SCROLL_THUMB_SIZE_MIN, hor.xmax); - CLAMP(scrollers->hor_min, hor.xmin, hor.xmax - V2D_SCROLL_THUMB_SIZE_MIN); + CLAMP(r_scrollers->hor_max, hor.xmin + V2D_SCROLL_THUMB_SIZE_MIN, hor.xmax); + CLAMP(r_scrollers->hor_min, hor.xmin, hor.xmax - V2D_SCROLL_THUMB_SIZE_MIN); } } @@ -1513,39 +1511,39 @@ View2DScrollers *UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom) fac1 = (v2d->cur.ymin - v2d->tot.ymin) / totsize; if (fac1 <= 0.0f) { - scrollers->vert_min = vert.ymin; + r_scrollers->vert_min = vert.ymin; } else { - scrollers->vert_min = (int)(vert.ymin + (fac1 * scrollsize)); + r_scrollers->vert_min = (int)(vert.ymin + (fac1 * scrollsize)); } fac2 = (v2d->cur.ymax - v2d->tot.ymin) / totsize; if (fac2 >= 1.0f) { - scrollers->vert_max = vert.ymax; + r_scrollers->vert_max = vert.ymax; } else { - scrollers->vert_max = (int)(vert.ymin + (fac2 * scrollsize)); + r_scrollers->vert_max = (int)(vert.ymin + (fac2 * scrollsize)); } /* prevent inverted sliders */ - if (scrollers->vert_min > scrollers->vert_max) { - scrollers->vert_min = scrollers->vert_max; + if (r_scrollers->vert_min > r_scrollers->vert_max) { + r_scrollers->vert_min = r_scrollers->vert_max; } /* prevent sliders from being too small to grab */ - if ((scrollers->vert_max - scrollers->vert_min) < V2D_SCROLL_THUMB_SIZE_MIN) { - scrollers->vert_max = scrollers->vert_min + V2D_SCROLL_THUMB_SIZE_MIN; + if ((r_scrollers->vert_max - r_scrollers->vert_min) < V2D_SCROLL_THUMB_SIZE_MIN) { + r_scrollers->vert_max = r_scrollers->vert_min + V2D_SCROLL_THUMB_SIZE_MIN; - CLAMP(scrollers->vert_max, vert.ymin + V2D_SCROLL_THUMB_SIZE_MIN, vert.ymax); - CLAMP(scrollers->vert_min, vert.ymin, vert.ymax - V2D_SCROLL_THUMB_SIZE_MIN); + CLAMP(r_scrollers->vert_max, vert.ymin + V2D_SCROLL_THUMB_SIZE_MIN, vert.ymax); + CLAMP(r_scrollers->vert_min, vert.ymin, vert.ymax - V2D_SCROLL_THUMB_SIZE_MIN); } } - - return scrollers; } /* Draw scrollbars in the given 2d-region */ -void UI_view2d_scrollers_draw(View2D *v2d, View2DScrollers *vs) +void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) { + View2DScrollers scrollers; + UI_view2d_scrollers_calc(v2d, mask_custom, &scrollers); bTheme *btheme = UI_GetTheme(); rcti vert, hor; const int scroll = view2d_scroll_mapped(v2d->scroll); @@ -1556,8 +1554,8 @@ void UI_view2d_scrollers_draw(View2D *v2d, View2DScrollers *vs) UI_GetThemeColor4ubv(TH_BACK, scrollers_back_color); /* make copies of rects for less typing */ - vert = vs->vert; - hor = vs->hor; + vert = scrollers.vert; + hor = scrollers.hor; /* horizontal scrollbar */ if (scroll & V2D_SCROLL_HORIZONTAL) { @@ -1566,8 +1564,8 @@ void UI_view2d_scrollers_draw(View2D *v2d, View2DScrollers *vs) rcti slider; int state; - slider.xmin = vs->hor_min; - slider.xmax = vs->hor_max; + slider.xmin = scrollers.hor_min; + slider.xmax = scrollers.hor_max; slider.ymin = hor.ymin; slider.ymax = hor.ymax; @@ -1602,8 +1600,8 @@ void UI_view2d_scrollers_draw(View2D *v2d, View2DScrollers *vs) slider.xmin = vert.xmin; slider.xmax = vert.xmax; - slider.ymin = vs->vert_min; - slider.ymax = vs->vert_max; + slider.ymin = scrollers.vert_min; + slider.ymax = scrollers.vert_max; state = (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE) ? UI_SCROLL_PRESSED : 0; @@ -1631,12 +1629,6 @@ void UI_view2d_scrollers_draw(View2D *v2d, View2DScrollers *vs) btheme->tui.widget_emboss[3] = emboss_alpha; } -/* free temporary memory used for drawing scrollers */ -void UI_view2d_scrollers_free(View2DScrollers *scrollers) -{ - MEM_freeN(scrollers); -} - /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 34108853c61..0585f7cf7cd 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -2011,7 +2011,7 @@ static void scroller_activate_init(bContext *C, const char in_scroller) { v2dScrollerMove *vsm; - View2DScrollers *scrollers; + View2DScrollers scrollers; ARegion *region = CTX_wm_region(C); View2D *v2d = ®ion->v2d; rctf tot_cur_union; @@ -2032,7 +2032,7 @@ static void scroller_activate_init(bContext *C, /* 'zone' depends on where mouse is relative to bubble * - zooming must be allowed on this axis, otherwise, default to pan */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); + UI_view2d_scrollers_calc(v2d, NULL, &scrollers); /* Use a union of 'cur' & 'tot' in case the current view is far outside 'tot'. In this cases * moving the scroll bars has far too little effect and the view can get stuck T31476. */ @@ -2049,15 +2049,15 @@ static void scroller_activate_init(bContext *C, /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( - event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max); + event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers.hor_min, scrollers.hor_max); if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ vsm->zone = SCROLLHANDLE_BAR; } - vsm->scrollbarwidth = scrollers->hor_max - scrollers->hor_min; - vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + region->winrct.xmin; + vsm->scrollbarwidth = scrollers.hor_max - scrollers.hor_min; + vsm->scrollbar_orig = ((scrollers.hor_max + scrollers.hor_min) / 2) + region->winrct.xmin; } else { /* vertical scroller - calculate adjustment factor first */ @@ -2069,18 +2069,17 @@ static void scroller_activate_init(bContext *C, /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( - event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max); + event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers.vert_min, scrollers.vert_max); if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ vsm->zone = SCROLLHANDLE_BAR; } - vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min; - vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + region->winrct.ymin; + vsm->scrollbarwidth = scrollers.vert_max - scrollers.vert_min; + vsm->scrollbar_orig = ((scrollers.vert_max + scrollers.vert_min) / 2) + region->winrct.ymin; } - UI_view2d_scrollers_free(scrollers); ED_region_tag_redraw_no_rebuild(region); } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1adf7f84bbf..63366044f88 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2795,9 +2795,7 @@ void ED_region_panels_draw(const bContext *C, ARegion *region) mask_buf.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH; mask = &mask_buf; } - View2DScrollers *scrollers = UI_view2d_scrollers_calc(v2d, mask); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, mask); } void ED_region_panels_ex( diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 1e4919761a1..a8b3ec9cdf6 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -181,7 +181,6 @@ static void action_main_region_draw(const bContext *C, ARegion *region) Object *obact = CTX_data_active_object(C); bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; short marker_flag = 0; short cfra_flag = 0; @@ -240,9 +239,7 @@ static void action_main_region_draw(const bContext *C, ARegion *region) ED_time_scrub_draw(region, scene, saction->flag & SACTION_DRAWTIME, true); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 6ec99730e09..54da00a132d 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1045,7 +1045,6 @@ static void clip_preview_region_init(wmWindowManager *wm, ARegion *region) static void graph_region_draw(const bContext *C, ARegion *region) { View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; SpaceClip *sc = CTX_wm_space_clip(C); Scene *scene = CTX_data_scene(C); short cfra_flag = 0; @@ -1076,9 +1075,7 @@ static void graph_region_draw(const bContext *C, ARegion *region) ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); /* scale indicators */ { @@ -1095,7 +1092,6 @@ static void dopesheet_region_draw(const bContext *C, ARegion *region) SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; short cfra_flag = 0; if (clip) { @@ -1127,9 +1123,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *region) ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } static void clip_preview_region_draw(const bContext *C, ARegion *region) diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 775159fbd79..3c62aeb1759 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -208,7 +208,6 @@ static void console_main_region_draw(const bContext *C, ARegion *region) /* draw entirely, view changes should be handled here */ SpaceConsole *sc = CTX_wm_space_console(C); View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; if (BLI_listbase_is_empty(&sc->scrollback)) { WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL); @@ -230,9 +229,7 @@ static void console_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } static void console_operatortypes(void) diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 21b705cbb44..56f3fd08bae 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -449,7 +449,6 @@ static void file_main_region_draw(const bContext *C, ARegion *region) FileSelectParams *params = ED_fileselect_get_params(sfile); View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; float col[3]; /* Needed, because filelist is not initialized on loading */ @@ -509,9 +508,7 @@ static void file_main_region_draw(const bContext *C, ARegion *region) /* scrollers */ rcti view_rect; ED_fileselect_layout_maskrect(sfile->layout, v2d, &view_rect); - scrollers = UI_view2d_scrollers_calc(v2d, &view_rect); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, &view_rect); } static void file_operatortypes(void) diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index b9c7c529620..30c7e5288d6 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -200,7 +200,6 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) Scene *scene = CTX_data_scene(C); bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; float col[3]; short cfra_flag = 0; @@ -319,9 +318,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) /* scrollers */ // FIXME: args for scrollers depend on the type of data being shown... - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); /* scale numbers */ { @@ -358,7 +355,6 @@ static void graph_channel_region_draw(const bContext *C, ARegion *region) { bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; float col[3]; /* clear and setup matrix */ @@ -380,9 +376,7 @@ static void graph_channel_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index ddf45eb4dce..836830916ed 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -139,7 +139,6 @@ static void info_main_region_draw(const bContext *C, ARegion *region) /* draw entirely, view changes should be handled here */ SpaceInfo *sinfo = CTX_wm_space_info(C); View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); @@ -161,9 +160,7 @@ static void info_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } static void info_operatortypes(void) diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 9ec38a2e9eb..aeb5c30c809 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -191,7 +191,6 @@ static void nla_channel_region_draw(const bContext *C, ARegion *region) { bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); @@ -211,9 +210,7 @@ static void nla_channel_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ @@ -237,7 +234,6 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) Scene *scene = CTX_data_scene(C); bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; short cfra_flag = 0; /* clear and setup matrix */ @@ -292,9 +288,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) ED_time_scrub_draw(region, scene, snla->flag & SNLA_DRAWTIME, true); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 43d844df900..c3823d8eb27 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1772,7 +1772,6 @@ static void draw_group_overlay(const bContext *C, ARegion *region) void drawnodespace(const bContext *C, ARegion *region) { wmWindow *win = CTX_wm_window(C); - View2DScrollers *scrollers; SpaceNode *snode = CTX_wm_space_node(C); View2D *v2d = ®ion->v2d; @@ -1921,7 +1920,5 @@ void drawnodespace(const bContext *C, ARegion *region) draw_tree_path(snode); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 540e2405758..aa1663dff01 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -84,7 +84,6 @@ static void outliner_main_region_init(wmWindowManager *wm, ARegion *region) static void outliner_main_region_draw(const bContext *C, ARegion *region) { View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; /* clear */ UI_ThemeClearColor(TH_BACK); @@ -96,9 +95,7 @@ static void outliner_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } static void outliner_main_region_free(ARegion *UNUSED(region)) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 1f06ab68516..433abe1ade7 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2257,7 +2257,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region) Editing *ed = BKE_sequencer_editing_get(scene, false); SpaceSeq *sseq = CTX_wm_space_seq(C); View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; short cfra_flag = 0; float col[3]; @@ -2345,9 +2344,7 @@ void draw_timeline_seq(const bContext *C, ARegion *region) ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); UI_view2d_view_restore(C); ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true); - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); /* Draw channel numbers. */ { -- cgit v1.2.3