diff --git a/src/qt/qt_hardwarerenderer.cpp b/src/qt/qt_hardwarerenderer.cpp index d1bd781ae..30d4a42a8 100644 --- a/src/qt/qt_hardwarerenderer.cpp +++ b/src/qt/qt_hardwarerenderer.cpp @@ -24,11 +24,9 @@ void HardwareRenderer::setRenderType(RenderType type) { QSurfaceFormat format; switch (type) { case RenderType::OpenGL: - setTextureFormat(GL_RGB); format.setRenderableType(QSurfaceFormat::OpenGL); break; case RenderType::OpenGLES: - setTextureFormat((QApplication::platformName().contains("wayland") || QApplication::platformName() == "cocoa") ? GL_RGB : GL_RGBA); format.setRenderableType(QSurfaceFormat::OpenGLES); break; } @@ -45,5 +43,5 @@ void HardwareRenderer::onBlit(const QImage& img, int x, int y, int w, int h, std void HardwareRenderer::resizeEvent(QResizeEvent *event) { onResize(width(), height()); - QOpenGLWidget::resizeEvent(event); + QOpenGLWindow::resizeEvent(event); } diff --git a/src/qt/qt_hardwarerenderer.hpp b/src/qt/qt_hardwarerenderer.hpp index fa9e7ec31..8b75d19b8 100644 --- a/src/qt/qt_hardwarerenderer.hpp +++ b/src/qt/qt_hardwarerenderer.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -16,7 +17,7 @@ #include "wl_mouse.hpp" #endif -class HardwareRenderer : public QOpenGLWidget, protected QOpenGLFunctions, public RendererCommon +class HardwareRenderer : public QOpenGLWindow, protected QOpenGLFunctions, public RendererCommon { Q_OBJECT @@ -26,10 +27,11 @@ public: void resizeGL(int w, int h) override; void initializeGL() override; void paintGL() override; - HardwareRenderer(QWidget* parent = nullptr) - : QOpenGLWidget(parent), QOpenGLFunctions() + HardwareRenderer(QWindow* parent = nullptr) + : QOpenGLWindow(QOpenGLWindow::NoPartialUpdate, parent), QOpenGLFunctions() { - setMinimumSize(16, 16); + setMinimumSize(QSize(16, 16)); + setFlags(Qt::FramelessWindowHint); } ~HardwareRenderer() { diff --git a/src/qt/qt_renderercomon.cpp b/src/qt/qt_renderercomon.cpp index 173ae1abe..8c1b89aeb 100644 --- a/src/qt/qt_renderercomon.cpp +++ b/src/qt/qt_renderercomon.cpp @@ -15,6 +15,8 @@ RendererCommon::RendererCommon() = default; void RendererCommon::onPaint(QPaintDevice* device) { QPainter painter(device); painter.setRenderHint(QPainter::SmoothPixmapTransform, video_filter_method > 0 ? true : false); + painter.fillRect(0, 0, device->width(), device->height(), QColorConstants::Black); + painter.setCompositionMode(QPainter::CompositionMode_Plus); painter.drawImage(destination, image, source); // "release" image, reducing it's refcount, so renderstack::blit() // won't have to reallocate diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index e8a281c21..e3ab5fc8e 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -183,18 +183,20 @@ void RendererStack::switchRenderer(Renderer renderer) { break; case Renderer::OpenGL: { - auto hw = new HardwareRenderer(this); + this->createWinId(); + auto hw = new HardwareRenderer(this->windowHandle()); connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection); hw->setRenderType(HardwareRenderer::RenderType::OpenGL); - current.reset(hw); + current.reset(this->createWindowContainer(hw, this)); break; } case Renderer::OpenGLES: { - auto hw = new HardwareRenderer(this); + this->createWinId(); + auto hw = new HardwareRenderer(this->windowHandle()); connect(this, &RendererStack::blitToRenderer, hw, &HardwareRenderer::onBlit, Qt::QueuedConnection); hw->setRenderType(HardwareRenderer::RenderType::OpenGLES); - current.reset(hw); + current.reset(this->createWindowContainer(hw, this)); break; } }