summaryrefslogtreecommitdiff
path: root/src/loader/loader.h
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-14 08:49:12 +0300
committerPaul Buetow <paul@buetow.org>2026-07-14 08:49:12 +0300
commit12be1b9ae52829292d13cc2fcc6ff7571d050d62 (patch)
tree674aafaeb3485bb38dd1e2ecc3d62f77e3584366 /src/loader/loader.h
parent484fbca06312dbe0f381109763f701671f22e602 (diff)
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.
Diffstat (limited to 'src/loader/loader.h')
-rw-r--r--src/loader/loader.h9
1 files changed, 9 insertions, 0 deletions
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. */