Repository navigation
This release adds per-window selection of nearest-neighbor or bilinear filtering at run time, and makes CPU scaling faster.
Heads up. Two build defaults change:
- 64-bit x86: builds now target x86-64-v2. On older processors,
mfb_open_exfails. SetMINIFB_USE_X86_64_V2=OFFto support them. - Web: Emscripten builds now enable WebAssembly SIMD. Set
MINIFB_USE_WASM_SIMD=OFFto support browsers without it.
New
mfb_set_stretch_mode(window, mode)selectsMFB_STRETCH_NEARESTorMFB_STRETCH_BILINEARindependently for each window. Both filters are always available, and new windows use nearest.MINIFB_USE_X86_64_V2andMINIFB_USE_X86_64_V3select the CPU level for the whole library. The v3 option is off by default.MINIFB_USE_WASM_SIMDlets the compiler vectorize buffer operations in Emscripten builds.- Tests for both scaling filters, cache reuse, independent window settings and Web canvas reopening.
docs/scaling_algorithms.mdexplains how the CPU scaler works and how much faster it is.
Changes
- The CPU scaler, used by X11 without OpenGL, Wayland, Android, DOS, and GDI and Cocoa in bilinear mode, caches its column tables and reuses rows. It uses SSE2 and AVX2 on x86, and NEON on ARM, where available. In the documented benchmarks, nearest-neighbor scaling is up to 7.7 times faster than before.
- CPU nearest-neighbor scaling now samples at pixel centers, so some scaled images change slightly.
- In
input_events, B selects bilinear and N selects nearest. - The Android examples have separate application ids, so both can be installed on the same device.
Fixes
- Windows with GDI: a window smaller than its buffer could show wrong colors.
- macOS without Metal: nearest-neighbor scaling could smooth the image.
- Scaling: images with a dimension of 65,536 pixels or more could be drawn incorrectly.
- Web: optimized examples and tests could abort at startup.
- Android:
native2026could crash at startup on API 28 and 29. - X11/OpenGL: the OpenGL context is now released before it is destroyed and before the X display is closed.
- Examples: improved allocation failure handling and corrected viewport and input coordinate calculations.
Thanks to @fruediger for the clang-cl warning fixes in #147.
See the CHANGELOG for the details.