Files
mcde/lib/DtSvc
lotherk 26d77c5ed3 MCDE: McdeThumb, the miniature pictures are shown from (t0161)
PNG, JPEG, GIF, BMP and XPM are read with libpng, libjpeg and C99 -- GIF's
LZW, BMP's rows and XPM's text are the module's own, so no library beyond
what Motif already brings.  A picture is scaled down with a box filter and
kept in $HOME/.dt/thumbs/<64|128|256>/<sha1 of real path, mtime and
size>.ppm; a cache over 50 MB is pruned by age when it is written to.  A
picture larger than 8192 x 8192 or 64 MB is refused from its header before
a byte of pixel data is read, and a JPEG is decoded at 1/2, 1/4 or 1/8 when
that still has the size the caller asks for.  McdeThumbRequest reads one
picture per Xt work proc, so a folder of photographs does not stop the
window, and McdeThumbRead/Scale is the part without X (a test needs no
display).

Measured on the build host, "make mcde-linux MCDE_DIRS='check lib/DtSvc'":
test_thumb PASS -- every format read back to its own pixels, the box
filter's means and aspect, the 8192/64 MB limits, a damaged file, and the
cache proved by its key (the source overwritten with rubbish of the same
size and mtime, the picture still returned from the PPM).  100 800 x 600
JPEGs at 64 px: 1.2 ms per decode, 100 cache files, 0.0 ms per picture
from the cache; an 11 MB 5000 x 3200 JPEG: 110 ms at 64 px.
2026-11-13 23:59:07 +00:00
..