From 12be1b9ae52829292d13cc2fcc6ff7571d050d62 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 14 Jul 2026 08:49:12 +0300 Subject: progressive: libjpeg-turbo two-phase JPEG backend (st0) M6: progressive low-res preview via libjpeg-turbo. - jpeg.c: two-phase decode (1/8 low-res via progress_cb, full via GdkPixbuf with EXIF orientation). Feature-gated. - loader.h/c: LoaderProgressCb + load_progressive on backend struct; loader_load_async accepts progress params; JPEG special-cased in task thread. - window.c: _load_progress_cb marshals partial to main thread. - tests: test_loader_jpeg (progress + dims), test_progressive_jpeg (sample). 16/16 green, ASan clean. --- src/loader/loader.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/loader/loader.h') diff --git a/src/loader/loader.h b/src/loader/loader.h index bfee29d..c2228f5 100644 --- a/src/loader/loader.h +++ b/src/loader/loader.h @@ -23,11 +23,19 @@ G_BEGIN_DECLS +/* Optional progressive-load callback (called from the worker thread with a + * low-res partial texture before the full decode completes). */ +typedef void (*LoaderProgressCb)(GdkTexture *p_partial, gpointer p_data); + /* A loader backend. Compiled in conditionally (meson feature options) and * registered with the loader at link time. */ typedef struct { gboolean (*can_load)(const guint8 *p_head, gsize u_len); GdkTexture *(*load)(GFile *p_file, GCancellable *p_cancel, GError **p_err); + /* Optional: two-phase load (low-res first via p_progress, then full). */ + GdkTexture *(*load_progressive)(GFile *p_file, GCancellable *p_cancel, + LoaderProgressCb p_progress, + gpointer p_progress_data, GError **p_err); } GgazeLoaderBackend; /* Backends register a const instance; the dispatcher (loader.c) iterates @@ -45,6 +53,7 @@ GdkTexture *loader_load(GFile *p_file, GCancellable *p_cancel, GError **p_err); * p_file, so the finish callback can check it against navigator.current * (last-write-wins). */ void loader_load_async(GFile *p_file, GCancellable *p_cancel, + LoaderProgressCb p_progress, gpointer p_progress_data, GAsyncReadyCallback p_cb, gpointer p_data); /* Finish an async load; returns the GdkTexture (transfer full) or NULL. */ -- cgit v1.2.3