Correction for recent commit clearing font cache
- move cache reset into view2d and comment about the rationale for resetting cache there. - missed other places where view2d zoom level can change (smoothview, borderzoom, home and file reload) - comment about DPI wasn't correct.
This commit is contained in:
@@ -157,6 +157,8 @@ void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, int
|
||||
/* per tab offsets, returns 1 if tab changed */
|
||||
bool UI_view2d_tab_set(struct View2D *v2d, int tab);
|
||||
|
||||
void UI_view2d_zoom_cache_reset(void);
|
||||
|
||||
/* view matrix operations */
|
||||
void UI_view2d_view_ortho(struct View2D *v2d);
|
||||
void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short xaxis);
|
||||
|
||||
@@ -985,6 +985,15 @@ bool UI_view2d_tab_set(View2D *v2d, int tab)
|
||||
return changed;
|
||||
}
|
||||
|
||||
void UI_view2d_zoom_cache_reset(void)
|
||||
{
|
||||
/* While scaling we can accumulate fonts at many sizes (~20 or so).
|
||||
* Not an issue with embedded font, but can use over 500Mb with i18n ones! See [#38244]. */
|
||||
|
||||
/* note: only some views draw text, we could check for this case to avoid clearning cache */
|
||||
BLF_cache_clear();
|
||||
}
|
||||
|
||||
/* *********************************************************************** */
|
||||
/* View Matrix Setup */
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_base.h"
|
||||
|
||||
#include "BLF_api.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
@@ -664,9 +662,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
|
||||
/* cleanup temp customdata */
|
||||
static void view_zoomstep_exit(wmOperator *op)
|
||||
{
|
||||
/* Fonts are stored at each DPI level, without this we can easy load 100's of fonts.
|
||||
* Not an issue with embedded font, but can use over 500Mo with i18n ones! See T38244. */
|
||||
BLF_cache_clear();
|
||||
UI_view2d_zoom_cache_reset();
|
||||
|
||||
if (op->customdata) {
|
||||
MEM_freeN(op->customdata);
|
||||
@@ -899,9 +895,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
|
||||
/* cleanup temp customdata */
|
||||
static void view_zoomdrag_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
/* Fonts are stored at each DPI level, without this we can easy load 100's of fonts.
|
||||
* Not an issue with embedded font, but can use over 500Mo with i18n ones! See T38244. */
|
||||
BLF_cache_clear();
|
||||
UI_view2d_zoom_cache_reset();
|
||||
|
||||
if (op->customdata) {
|
||||
v2dViewZoomData *vzd = op->customdata;
|
||||
@@ -1373,6 +1367,10 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
|
||||
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
if (v2d->sms == NULL) {
|
||||
UI_view2d_zoom_cache_reset();
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -1865,9 +1863,11 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
ED_region_tag_redraw(ar);
|
||||
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
|
||||
|
||||
UI_view2d_zoom_cache_reset();
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
static void VIEW2D_OT_reset(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
#include "GHOST_Path-api.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "GPU_draw.h"
|
||||
|
||||
@@ -398,6 +399,8 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
||||
|
||||
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
|
||||
|
||||
UI_view2d_zoom_cache_reset();
|
||||
|
||||
/* first try to append data from exotic file formats... */
|
||||
/* it throws error box when file doesn't exist and returns -1 */
|
||||
/* note; it should set some error message somewhere... (ton) */
|
||||
@@ -544,6 +547,8 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
|
||||
|
||||
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
|
||||
|
||||
UI_view2d_zoom_cache_reset();
|
||||
|
||||
G.relbase_valid = 0;
|
||||
if (!from_memory) {
|
||||
const char * const cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
|
||||
|
||||
Reference in New Issue
Block a user