[Bf-blender-cvs] [d11f3267cd9] master: Fix T103210: Don't Always Clear Glyphs With Zoom

Harley Acheson noreply at git.blender.org
Sun Jan 8 22:58:42 CET 2023


Commit: d11f3267cd9370d793264f5eba6eacefd4da2f56
Author: Harley Acheson
Date:   Sun Jan 8 13:57:09 2023 -0800
Branches: master
https://developer.blender.org/rBd11f3267cd9370d793264f5eba6eacefd4da2f56

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

===================================================================

M	source/blender/editors/interface/view2d_ops.cc

===================================================================

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<v2dViewZoomData *>(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;



More information about the Bf-blender-cvs mailing list