Rename WindowRotation to RenderingRotation in the software renderer (#4181)

Same term as we're going to use in the linuxkms backend.
This commit is contained in:
Simon Hausmann 2023-12-19 08:47:55 +01:00 committed by GitHub
parent 3b51c8e30a
commit 95044c3a09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 56 deletions

View file

@ -27,6 +27,6 @@ void slint_esp_init(slint::PhysicalSize size, esp_lcd_panel_handle_t panel,
std::optional<std::span<slint::platform::Rgb565Pixel>> buffer2 = {}
#ifdef SLINT_FEATURE_EXPERIMENTAL
,
slint::platform::SoftwareRenderer::WindowRotation rotation = {}
slint::platform::SoftwareRenderer::RenderingRotation rotation = {}
#endif
);

View file

@ -21,7 +21,7 @@ struct EspPlatform : public slint::platform::Platform
std::optional<std::span<slint::platform::Rgb565Pixel>> buffer2 = {}
#ifdef SLINT_FEATURE_EXPERIMENTAL
,
slint::platform::SoftwareRenderer::WindowRotation rotation = {}
slint::platform::SoftwareRenderer::RenderingRotation rotation = {}
#endif
)
: size(size),
@ -50,7 +50,7 @@ private:
std::span<slint::platform::Rgb565Pixel> buffer1;
std::optional<std::span<slint::platform::Rgb565Pixel>> buffer2;
#ifdef SLINT_FEATURE_EXPERIMENTAL
slint::platform::SoftwareRenderer::WindowRotation rotation;
slint::platform::SoftwareRenderer::RenderingRotation rotation;
#endif
class EspWindowAdapter *m_window = nullptr;
@ -92,7 +92,7 @@ std::unique_ptr<slint::platform::WindowAdapter> EspPlatform::create_window_adapt
auto window = std::make_unique<EspWindowAdapter>(buffer_type, size);
m_window = window.get();
#ifdef SLINT_FEATURE_EXPERIMENTAL
m_window->m_renderer.set_window_rotation(rotation);
m_window->m_renderer.set_rendering_rotation(rotation);
#endif
return window;
}
@ -203,8 +203,10 @@ void EspPlatform::run_event_loop()
if (std::exchange(m_window->needs_redraw, false)) {
auto rotated = false
#ifdef SLINT_FEATURE_EXPERIMENTAL
|| rotation == slint::platform::SoftwareRenderer::WindowRotation::Rotate90
|| rotation == slint::platform::SoftwareRenderer::WindowRotation::Rotate270
|| rotation
== slint::platform::SoftwareRenderer::RenderingRotation::Rotate90
|| rotation
== slint::platform::SoftwareRenderer::RenderingRotation::Rotate270
#endif
;
auto region =
@ -283,7 +285,7 @@ void slint_esp_init(slint::PhysicalSize size, esp_lcd_panel_handle_t panel,
std::optional<std::span<slint::platform::Rgb565Pixel>> buffer2
#ifdef SLINT_FEATURE_EXPERIMENTAL
,
slint::platform::SoftwareRenderer::WindowRotation rotation
slint::platform::SoftwareRenderer::RenderingRotation rotation
#endif
)
{

View file

@ -608,8 +608,8 @@ public:
# ifdef SLINT_FEATURE_EXPERIMENTAL
/// This enum describes the rotation that is applied to the buffer when rendering.
/// To be used in set_window_rotation()
enum class WindowRotation {
/// To be used in set_rendering_rotation()
enum class RenderingRotation {
/// No rotation
NoRotation = 0,
/// Rotate 90° to the left
@ -623,10 +623,10 @@ public:
/// Set how the window need to be rotated in the buffer.
///
/// This is typically used to implement screen rotation in software
void set_window_rotation(WindowRotation rotation)
void set_rendering_rotation(RenderingRotation rotation)
{
cbindgen_private::slint_software_renderer_set_window_rotation(inner,
static_cast<int>(rotation));
cbindgen_private::slint_software_renderer_set_rendering_rotation(
inner, static_cast<int>(rotation));
}
# endif
};

View file

@ -387,17 +387,17 @@ mod software_renderer {
#[cfg(feature = "experimental")]
#[no_mangle]
pub unsafe extern "C" fn slint_software_renderer_set_window_rotation(
pub unsafe extern "C" fn slint_software_renderer_set_rendering_rotation(
r: SoftwareRendererOpaque,
rotation: i32,
) {
use i_slint_core::software_renderer::WindowRotation;
use i_slint_core::software_renderer::RenderingRotation;
let renderer = &*(r as *const SoftwareRenderer);
renderer.set_window_rotation(match rotation {
90 => WindowRotation::Rotate90,
180 => WindowRotation::Rotate180,
270 => WindowRotation::Rotate270,
_ => WindowRotation::NoRotation,
renderer.set_rendering_rotation(match rotation {
90 => RenderingRotation::Rotate90,
180 => RenderingRotation::Rotate180,
270 => RenderingRotation::Rotate270,
_ => RenderingRotation::NoRotation,
});
}