Always send an opaque buffer to interactive backends

Offen
#32,258 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Aktiv
Tech-Stack
macos, python

Rechercherichtung

Es werden keine Dateien oder Tests genannt. Beginne damit nachzuverfolgen, wie Agg/Cairo-Puffer an die interaktiven Backends übergeben werden, und vergleiche anschließend die im Issue beschriebenen macOS- und Qt-Pfade. Als abgeschlossen gilt die Arbeit, wenn der Puffervertrag des Backends festgelegt ist, die betroffenen Backends konsistent einen opaken Puffer erhalten und die Auswirkungen auf die Performance, soweit praktikabel, bewertet wurden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Performance status: needs comment/discussion topic: backends

Currently, we send an RGBA buffer from Agg/Cairo up to the interactive backends. This buffer may contain non-opaque pixels. Most backends then composite this buffer onto a white background (macosx currently does not, but this is fixed in the macos rework).

If we formalize this: "our interactive backends will always render onto a white background" or "our interactive backends will provide an opaque backing color to the renderer", we can instead pass up an RGBX buffer (alpha ignored, completely opaque).

Depending on the backend, this may avoid a compositing operation and/or allow a less-expensive compositing operation.

For example, on macOS, we could use kCGImageAlphaNoneSkipLast rather than kCGImageAlphaLast (which has to convert to premultiplied alpha). In Qt, we could use Format_RGBX8888.

The actual performance impact of this could be hard to measure. At least in the macOS rework: actual compositing may occur at a lower level instead of our own process.

That said, it seems non-ideal to hand a transparent buffer to a backend and say: "Now make this opaque" when we can instead do a memset(ptr, 0xff, length) at render time.

Thoughts?

Vorherrschende Sprache
Python
Sterne
23.5k
Forks
8.6k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
64

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus matplotlib/matplotlib

Alle Issues in matplotlib/matplotlib

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.