diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-06-04 21:47:39 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-06 17:26:50 +0200 |
commit | fd303ee9c1c969c4a50c6fcf0397973ea6f37dc7 (patch) | |
tree | 5c0050be7bee8ef178f680adfb07c3cc8575a248 /arg.h | |
parent | 44a50ad94828d6375ebba9560109d06e9a163e5d (diff) |
load slide image on-demand
On Sat, Jun 04, 2016 at 05:28:31PM +0200, Markus Teich wrote:
> Hiltjo Posthuma wrote:
> > previously an image file would be opened but only ffread when advancing to
> > the slide, but when the slide was not used it gave an error:
> >
> > /usr/local/bin/2ff: failed to convert image/png
>
> Heyho Hiltjo,
>
> thanks for the patch. Unfortunately it does not work if the first slide contains
> an image (ffopen is only called in advance). I think it would be good to merge
> ffopen and ffread instead into a single function ffload. This makes the `LOADED`
> state clearer and also enforces that the fd is closed in the same function where
> it is opened. This ffload function should then be called in advance() replacing
> the ffread() calls if the image is not loaded yet and once in load() for the
> first slide if it is an image.
>
Ah yes, sorry for the oversight.
> If you want to take this new approach, go for it, otherwise I'll look into it
> myself.
>
I have attached a patch that does this, I hope you'll like it.
Also I'm not sure if we need the below code in advance(), I have removed it in
the patch:
if (slidecount > idx + 1 && slides[idx + 1].img)
ffread(slides[idx + 1].img);
if (0 < idx && slides[idx - 1].img)
ffread(slides[idx - 1].img);
That seems to preload the next and previous slide image right? A minor issue I
notice also is that images seem to flicker, it uses XPutImage directly to
xw.win. Maybe it can be replaced with a backbuffer then XCopyArea? What do you
think?
In advance() it should also not always be needed to rescale the image.
--
Kind regards,
Hiltjo
From 97bebdcab4003f9acdfdd4bdf424449299ffd61d Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 4 Jun 2016 21:34:25 +0200
Subject: [PATCH] merge ffread and ffopen into one function
Diffstat (limited to 'arg.h')
0 files changed, 0 insertions, 0 deletions