// This file is part of Desktop App Toolkit, // a set of libraries for developing nice desktop applications. // // For license and copyright information please follow this link: // https://github.com/desktop-app/legal/blob/master/LEGAL // #pragma once #include "ui/gl/gl_detection.h" #include class Painter; class QOpenGLWidget; namespace Ui { class RpWidgetWrap; } // namespace Ui namespace Ui::GL { enum class Backend { OpenGL, Raster, }; class Renderer { public: virtual void init( not_null widget, not_null f) { } virtual void deinit( not_null widget, not_null f) { } virtual void resize( not_null widget, not_null f, int w, int h) { } virtual void paint( not_null widget, not_null f); virtual void paintFallback( Painter &&p, const QRegion &clip, Backend backend) { } virtual ~Renderer() = default; }; struct ChosenRenderer { std::unique_ptr renderer; Backend backend = Backend::Raster; }; [[nodiscard]] std::unique_ptr CreateSurface( QWidget *parent, Fn chooseRenderer); } // namespace Ui::GL