From e3bf6f08e391213e8b3c49dab923a25f77983063 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 3 Apr 2022 23:01:03 +0200 Subject: PictureFlow: Delay LCD Update until center slide is loaded Eliminates flashing of slide right after launch or when changing sorting on the M3K using the volume buttons Change-Id: Icd317e0b0d5b939269dc8dafd30d0c0f9daa5fd9 --- apps/plugins/pictureflow/pictureflow.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'apps/plugins/pictureflow') diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index ae1ec2b224..97b71ee9d0 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -531,6 +531,7 @@ static int itilt; static PFreal offsetX; static PFreal offsetY; static int number_of_slides; +static bool is_initial_slide = true; static struct pf_slide_cache pf_sldcache; @@ -2903,13 +2904,19 @@ static inline struct dim *surface(const int slide_index) { int j = 0; do { - if (pf_sldcache.cache[i].index == slide_index) + if (pf_sldcache.cache[i].index == slide_index) { + if (is_initial_slide && slide_index == center_index) + is_initial_slide = false; return get_slide(pf_sldcache.cache[i].hid); + } i = pf_sldcache.cache[i].next; j++; } while (i != pf_sldcache.used && j < SLIDE_CACHE_SIZE); } - return get_slide(empty_slide_hid); + if (is_initial_slide && slide_index == center_index) + return NULL; + else + return get_slide(empty_slide_hid); } /** @@ -3245,6 +3252,7 @@ static bool sort_albums(int new_sorting, bool from_settings) rb->buflib_init(&buf_ctx, (void *)pf_idx.buf, pf_idx.buf_sz); empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0); initialize_slide_cache(); + is_initial_slide = true; create_pf_thread(); /* Go to previously selected slide */ @@ -4455,7 +4463,8 @@ static int pictureflow_main(const char* selected_file) /* Copy offscreen buffer to LCD and give time to other threads */ - mylcd_update(); + if (is_initial_slide == false) + mylcd_update(); rb->yield(); /*/ Handle buttons */ -- cgit v1.2.3