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?
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
kCGImageAlphaNoneSkipLastrather thankCGImageAlphaLast(which has to convert to premultiplied alpha). In Qt, we could useFormat_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?