Repository navigation
v0.6.1
This release makes lottie draw a frame much faster.
go get github.com/xo/okage@v0.6.1Speed
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:
- A layer keeps the rectangle that its draws touch, and
PopLayercomposites 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. - The normal mode and the Porter-Duff modes composite with a direct loop on premultiplied 8-bit pixels. It gives the same result as
DrawPixmapof tiny-skia within 2 in each channel. The other blend modes still useDrawPixmap. - A clip that is a rectangle on the pixel grid needs no mask.
- 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).