From d11f3267cd9370d793264f5eba6eacefd4da2f56 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Sun, 8 Jan 2023 13:57:09 -0800 Subject: [PATCH] Fix T103210: Don't Always Clear Glyphs With Zoom Do not clear all the font's glyph caches with single-step zoom operators if the area does not change font size when doing so. See D16785 for more details. Differential Revision: https://developer.blender.org/D16785 Reviewed by Campbell Barton --- source/blender/editors/interface/view2d_ops.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/view2d_ops.cc b/source/blender/editors/interface/view2d_ops.cc index 30c5e79a794..b76f5f1e49f 100644 --- a/source/blender/editors/interface/view2d_ops.cc +++ b/source/blender/editors/interface/view2d_ops.cc @@ -791,9 +791,14 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) * \{ */ /* Cleanup temp custom-data. */ -static void view_zoomstep_exit(wmOperator *op) +static void view_zoomstep_exit(bContext *C, wmOperator *op) { - UI_view2d_zoom_cache_reset(); + ScrArea *area = CTX_wm_area(C); + /* Some areas change font sizes when zooming, so clear glyph cache. */ + if (area && !ELEM(area->spacetype, SPACE_GRAPH, SPACE_ACTION)) { + UI_view2d_zoom_cache_reset(); + } + v2dViewZoomData *vzd = static_cast(op->customdata); vzd->v2d->flag &= ~V2D_IS_NAVIGATING; MEM_SAFE_FREE(op->customdata); @@ -816,7 +821,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(op); + view_zoomstep_exit(C, op); return OPERATOR_FINISHED; } @@ -880,7 +885,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(op); + view_zoomstep_exit(C, op); return OPERATOR_FINISHED; } @@ -1477,7 +1482,7 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event) view_zoomstep_apply_ex( C, vzd, do_zoom_xy[0] ? zoom_factor : 0.0f, do_zoom_xy[1] ? zoom_factor : 0.0f); - view_zoomstep_exit(op); + view_zoomstep_exit(C, op); } return OPERATOR_FINISHED;