linebender / linebender/vello

sparse_strips: render to a `Pixmap` with borrowed data

Open
#1,367 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.3k
Forks
300
Avg merge
2d 13h
Merged PRs (30d)
61

Description

From what I could gather, currently, `vello-cpu`'s `Pixmap`s always own their data. In contrast, [`tiny-skia`'s PixmapMut](https://docs.rs/tiny-skia/latest/tiny_skia/struct.PixmapMut.html) allows us to draw directly on borrowed data.

My use-case is that I am using `tiny-skia` to draw my process tree in the background, like so:

Image

The image is redrawn every second, when I go through the `/proc` filesystem to rebuild the tree, and increase the angle by a small amount so that it slowly rotates.

This means I am using `tiny-skia` as essentially a real-time renderer. It always draws to the same (borrowed) underlying buffer, since it can't own the background's byte data.

I would like to use `vello-cpu` instead, since it seems to be more performant than `tiny-skia`. However, as it currently stands, I would have to keep two copies of the whole draw space, and `memcpy` the whole data back and forth. Since I have a 3440x1440 monitor, that would be a total of around 18 MB, which is more than 4x the memory the entire rest of the program is currently using (the background pixels are `mmaped` from a shared memory file only when we need to draw)!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining how vello-cpu's Pixmap currently owns its pixel data, then compare the borrowed-buffer model of tiny-skia's PixmapMut. Done means vello-cpu can render directly into caller-provided pixel storage without requiring a second full draw-space copy.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.