From ffee1e01fbe196e9d14457714fb68f30c5ac4d93 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 5 Dec 2025 22:27:54 +0100 Subject: [PATCH] C++: Enable support for the Slint software renderer by default (#10217) This is in line with Rust. --- api/cpp/CMakeLists.txt | 2 +- api/cpp/include/slint-platform.h | 4 +++- api/cpp/tests/platform_eventloop.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/cpp/CMakeLists.txt b/api/cpp/CMakeLists.txt index a6f4930edc..3b52970a1c 100644 --- a/api/cpp/CMakeLists.txt +++ b/api/cpp/CMakeLists.txt @@ -103,7 +103,7 @@ define_cargo_dependent_feature(renderer-femtovg-wgpu "Enable support for the WGP define_cargo_dependent_feature(renderer-skia "Enable support for the Skia based rendering engine." OFF "NOT SLINT_FEATURE_FREESTANDING") define_cargo_dependent_feature(renderer-skia-opengl "Enable support for the Skia based rendering engine with its OpenGL backend." OFF "NOT SLINT_FEATURE_FREESTANDING") define_cargo_dependent_feature(renderer-skia-vulkan "Enable support for the Skia based rendering engine with its Vulkan backend." OFF "NOT SLINT_FEATURE_FREESTANDING") -define_cargo_feature(renderer-software "Enable support for the software renderer" OFF) +define_cargo_feature(renderer-software "Enable support for the software renderer" ON) set(SLINT_BACKEND_QT_DEFAULT OFF) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") diff --git a/api/cpp/include/slint-platform.h b/api/cpp/include/slint-platform.h index d30d7cd9c1..8f1f0e015c 100644 --- a/api/cpp/include/slint-platform.h +++ b/api/cpp/include/slint-platform.h @@ -793,9 +793,11 @@ public: /// The first template parameter (PixelType) must be specified and can be either Rgb565Pixel or /// Rgb8Pixel. template +# if !defined(__clang__) || __clang_major__ >= 17 requires requires(Callback callback) { - callback(size_t(0), size_t(0), size_t(0), [&callback](std::span) { }); + callback(size_t(0), size_t(0), size_t(0), [&callback](std::span) {}); } +# endif PhysicalRegion render_by_line(Callback process_line_callback) const { auto process_line_fn = [](void *process_line_callback_ptr, uintptr_t line, diff --git a/api/cpp/tests/platform_eventloop.cpp b/api/cpp/tests/platform_eventloop.cpp index 8f5401510c..b8947ce7ce 100644 --- a/api/cpp/tests/platform_eventloop.cpp +++ b/api/cpp/tests/platform_eventloop.cpp @@ -29,7 +29,7 @@ struct TestPlatform : slint::platform::Platform struct TestWindowAdapter : slint::platform::WindowAdapter { slint::platform::SoftwareRenderer r { { } }; - slint::PhysicalSize size() override { return slint::PhysicalSize({}); } + slint::PhysicalSize size() override { return slint::PhysicalSize({ 0, 0 }); } slint::platform::AbstractRenderer &renderer() override { return r; } }; return std::make_unique();