Skip to content

v0.6.1

Choose a tag to compare

@kenshaw kenshaw released this 12 Nov 20:42
· 27 commits to main since this release

This release makes lottie draw a frame much faster.

go get github.com/xo/okage@v0.6.1

Speed

PixmapSink made a pixmap and a mask of the size of the target for each layer, and composited each layer through the high-precision pattern pipeline of tiny-skia. Now:

  1. A layer keeps the rectangle that its draws touch, and PopLayer composites only that rectangle. A mode that clears the target where the layer is transparent, such as source-in, clears the rest of its clip without blending.
  2. The normal mode and the Porter-Duff modes composite with a direct loop on premultiplied 8-bit pixels. It gives the same result as DrawPixmap of tiny-skia within 2 in each channel. The other blend modes still use DrawPixmap.
  3. A clip that is a rectangle on the pixel grid needs no mask.
  4. The pixmaps of the layers come from a pool, and are reused across layers and frames.

For one frame at 1024x1024:

File v0.6.0 v0.6.1
Noto rocket 195 ms, 46.6 MB 9 ms, 5.5 MB
star 26 ms 4.5 ms
Noto fire 100 ms 39 ms

The frames are the same as in v0.6.0, and the test against ThorVG still passes for each sampled frame of the 879 Noto animated emoji. A file with many gradients is still slower than ThorVG, because tiny-skia fills a gradient with more than two stops in its high-precision pipeline (D35).