linebender/druid

Decouple piet and druid-shell

Open

#1.924 geöffnet am 16. Aug. 2021

Auf GitHub ansehen
 (8 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Rust (567 Forks)batch import
architecturehelp wanted

Repository-Metriken

Stars
 (9.091 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

It is not currently possible to use druid-shell without using piet, and I think this is an unnecessary coupling, and it makes druid-shell strictly less useful.

I would like to move all of the piet-specific code from druid-shell into druid. In practice this means:

  • Any shared PietText objects should live somewhere in druid (unclear where, exactly, druid doesn't really have an application-global object? maybe the AppHandler?)
  • instead of passing a RenderContext to the paint method, druid-shell should pass a window handle
  • druid should construct the RenderContext itself, from the window handle

This does violate the principal that platform-specific code should generally be in druid-shell instead of druid. Is there a viable alternative? I'm not sure if there's a good one, although we could perhaps have a from_raw_handle(handle: &RawWindowHandle) -> RenderContext method in piet-common? I'm not sure if this really makes a ton of sense, but it's an option?

If someone is interested in taking this on, I am happy to answer questions.

Contributor Guide