mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 04:36:24 +01:00
defer loading of the font after display size change to avoid useless
reloading - hack, but needed because for most of the vo's the panscan information and screen size are updated asynchronously git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15086 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
3627f7451a
commit
22c533e6ed
30
libvo/sub.c
30
libvo/sub.c
@ -758,18 +758,40 @@ void free_osd_list(){
|
|||||||
vo_osd_list=NULL;
|
vo_osd_list=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FONT_LOAD_DEFER 6
|
||||||
|
|
||||||
int vo_update_osd(int dxs,int dys){
|
int vo_update_osd(int dxs,int dys){
|
||||||
mp_osd_obj_t* obj=vo_osd_list;
|
mp_osd_obj_t* obj=vo_osd_list;
|
||||||
int chg=0;
|
int chg=0;
|
||||||
|
#ifdef HAVE_FREETYPE
|
||||||
|
static int defer_counter = 0, prev_dxs = 0, prev_dys = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FREETYPE
|
#ifdef HAVE_FREETYPE
|
||||||
// here is the right place to get screen dimensions
|
// here is the right place to get screen dimensions
|
||||||
if (!vo_font
|
if (((dxs != vo_image_width)
|
||||||
|| force_load_font
|
&& (subtitle_autoscale == 2 || subtitle_autoscale == 3))
|
||||||
|| ((dxs != vo_image_width || dys != vo_image_height)
|
|| ((dys != vo_image_height)
|
||||||
&& (subtitle_autoscale == 2 || subtitle_autoscale == 3))) {
|
&& (subtitle_autoscale == 1 || subtitle_autoscale == 3)))
|
||||||
|
{
|
||||||
|
// screen dimensions changed
|
||||||
|
// wait a while to avoid useless reloading of the font
|
||||||
|
if (dxs == prev_dxs || dys == prev_dys) {
|
||||||
|
defer_counter++;
|
||||||
|
} else {
|
||||||
|
prev_dxs = dxs;
|
||||||
|
prev_dys = dys;
|
||||||
|
defer_counter = 0;
|
||||||
|
}
|
||||||
|
if (defer_counter >= FONT_LOAD_DEFER) force_load_font = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vo_font || force_load_font) {
|
||||||
force_load_font = 0;
|
force_load_font = 0;
|
||||||
load_font_ft(dxs, dys);
|
load_font_ft(dxs, dys);
|
||||||
|
prev_dxs = dxs;
|
||||||
|
prev_dys = dys;
|
||||||
|
defer_counter = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user