-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using external buffer possible? #222
Comments
Could your program be refactored to write into the At least on some backends, that should perform better than any possible implementation that presents from just a |
Yes BitBlt is fast. |
Many drawing interfaces have a way to render to a mutable byte slice. For instance in my own code I use |
I would be in favor of such an addition, but I don't know the limitations of other backends. For Web at least, it should be perfectly possible after we implement the pixel format API. However it is not possible with the atomics target feature, where its not possible at all to draw from Wasm memory to begin with. |
Yes I think for certain backends it will not be possible or handy. No clue about other systems. |
Maybe some platform-specific extensions would be more appropriate then. |
If you want to write something specifically for Windows and have some very specific requirements, you can also always just do that directly with windows-rs instead of using Softbuffer. I guess it's an open design question in softbuffer to decide when to offer platform extensions vs suggest using platform APIs directly. |
I would say this is definitely a case where platform extensions should not be used. The changes required for some platforms to use direct buffers would effectively require re-architecting the entire crate. |
A little update on this: I managed to refactor my drawing. Enabling a 'borrowed bitmap', borrowing the softbuffer pixels. |
Currently I am copying my own rgba into the buffer of the softbuffer-surface.
I was wondering if that could be faster. And if it would be possible that the softbuffer uses this external buffer as source.
I saw that in Windows the drawing is done with BitBlt (which I believe is hardware-accelerated) and also was wondering if StretchDIBits would be an option. The last one does not need a source-handle, but don't know if StretchDIBits is as optimized.
The text was updated successfully, but these errors were encountered: