Stabilize full-screen rotation in the renderer #5372
Labels
a:renderer-software
Software Renderer (mO,bF)
api
Changes or additions to APIs
rfc
Request for comments: proposals for changes
We've had an implementation of full screen rotation in the software renderer since Slint 1.3 (IIRC) but it remained experimental.
It's time to stabilize it.
Use cases
Current API
slint/internal/core/software_renderer.rs
Lines 70 to 85 in 318c80b
SoftwareRenderer
slint/api/cpp/include/slint-platform.h
Lines 724 to 741 in 318c80b
slint/internal/renderers/femtovg/lib.rs
Lines 567 to 574 in 318c80b
Options
We could stabilize the API as is. But the questions are:
Should the rotation be a property of the Window instead of the Renderer?
It would make sense to have that a property of the Window. In that case, the physical size might be the transposed of the logical size. But this also make the conversion of a physical point to logical point more difficult for the event handler and such as they need to know not only the scale factor, but the rotation and size of the window.
Right now with the current experimental API, it's impossible to implement rotation in the winit back-end for example, because the physical size of the window has to match what's reported to the window manager. and therefore that's the size of the buffer. But the Slint's width and height are linked to the window's logical size and must be transposed.
A proposed API would be:
Then the renderer would use the window rotation when rendering.
This is a bit more complicated than the current implementation (bugger API surface change).
The question is whether this is something we want to support (rotation on backend that have a window manager and need to also rotate between physical and logical window coordinate). Every use is limited for backend with full screen rotation where the window don't really play a role.
Should the rotation be an option given in an overload to the
render
function instead of as a state in the renderer?Since we need to give the right kind of buffer to the render function (height×width instead of width×height), it is really a property of the render function rather than a state in the renderer. itself. We could have an overload with a RenderOptions struct (but not sure what else would go in there. buffer age? extra dirty region? extra clip?). Or a
render_with_rotation
The statefull API means we need to use interior mutability and that the user must ensure that the right state when doing rotation. But it is otherwise easy to use.
Does that mean we'll also do the same for femtovg and skia if we stabilize that?
The text was updated successfully, but these errors were encountered: