Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provide a few helper functions for handling the alpha channel when the pixel format of the buffer is
PixelFormat::Bgra8orPixelFormat::Rgba8.I'm a bit unsure whether it makes sense to provide these? Their current implementations are quite simple, and if we can provide
AlphaMode::Premultipliedeverywhere, the [un-]premultiplication functions probably aren't really necessary. And perhaps the use-case of actually needingAlphaMode::Ignoredis kinda niche, which makesmake_pixels_opaqueunnecessary too?I think the biggest problem with providing these is that it kinda signals that they're fast implementations, which... They aren't really, they could be made much more performant using SIMD and/or
rayon.I know that I don't want Softbuffer to be in the business of providing drawing primitives like
tiny-skiaorvello_cpudoes, and I guess you could argue that this is kinda in that category, at least in the sense that it's a very different set of things you need to worry about (CPU speed vs. abstracting platform details and managing buffers).