Commit 1ff623e9 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

renderbackends: make SurfaceTexture creation methods use std::unique_ptr

parent 696abac4
......@@ -194,14 +194,14 @@ bool EglGbmBackend::initBufferConfigs()
return false;
}
SurfaceTexture *EglGbmBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new BasicEGLSurfaceTextureInternal(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureInternal>(this, pixmap);
}
SurfaceTexture *EglGbmBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return new BasicEGLSurfaceTextureWayland(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureWayland>(this, pixmap);
}
void EglGbmBackend::present(Output *output)
......
......@@ -61,8 +61,8 @@ public:
EglGbmBackend(DrmBackend *drmBackend);
~EglGbmBackend() override;
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
void present(Output *output) override;
OutputLayer *primaryLayer(Output *output) override;
......
......@@ -166,14 +166,14 @@ bool EglGbmBackend::initBufferConfigs()
return true;
}
SurfaceTexture *EglGbmBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new BasicEGLSurfaceTextureInternal(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureInternal>(this, pixmap);
}
SurfaceTexture *EglGbmBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return new BasicEGLSurfaceTextureWayland(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureWayland>(this, pixmap);
}
OutputLayerBeginFrameInfo EglGbmBackend::beginFrame()
......
......@@ -40,8 +40,8 @@ class EglGbmBackend : public AbstractEglBackend
public:
EglGbmBackend(VirtualBackend *b);
~EglGbmBackend() override;
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
OutputLayer *primaryLayer(Output *output) override;
void present(Output *output) override;
void init() override;
......
......@@ -376,14 +376,14 @@ std::shared_ptr<KWin::GLTexture> EglWaylandBackend::textureForOutput(KWin::Outpu
return texture;
}
SurfaceTexture *EglWaylandBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> EglWaylandBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new BasicEGLSurfaceTextureInternal(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureInternal>(this, pixmap);
}
SurfaceTexture *EglWaylandBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> EglWaylandBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return new BasicEGLSurfaceTextureWayland(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureWayland>(this, pixmap);
}
void EglWaylandBackend::present(Output *output)
......
......@@ -84,8 +84,8 @@ public:
EglWaylandBackend(WaylandBackend *b);
~EglWaylandBackend() override;
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
void init() override;
void present(Output *output) override;
......
......@@ -68,9 +68,9 @@ EglBackend::~EglBackend()
RenderLoopPrivate::get(m_backend->renderLoop())->invalidate();
}
SurfaceTexture *EglBackend::createSurfaceTextureX11(SurfacePixmapX11 *texture)
std::unique_ptr<SurfaceTexture> EglBackend::createSurfaceTextureX11(SurfacePixmapX11 *texture)
{
return new EglSurfaceTextureX11(this, texture);
return std::make_unique<EglSurfaceTextureX11>(this, texture);
}
void EglBackend::init()
......
......@@ -44,7 +44,7 @@ public:
void init() override;
SurfaceTexture *createSurfaceTextureX11(SurfacePixmapX11 *texture) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *texture) override;
OutputLayerBeginFrameInfo beginFrame();
void endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion);
void present(Output *output) override;
......
......@@ -772,9 +772,9 @@ void GlxBackend::screenGeometryChanged()
m_fbo = std::make_unique<GLFramebuffer>(0, size);
}
SurfaceTexture *GlxBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
std::unique_ptr<SurfaceTexture> GlxBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
{
return new GlxSurfaceTextureX11(this, pixmap);
return std::make_unique<GlxSurfaceTextureX11>(this, pixmap);
}
OutputLayerBeginFrameInfo GlxBackend::beginFrame()
......
......@@ -81,7 +81,7 @@ class GlxBackend : public OpenGLBackend
public:
GlxBackend(Display *display, X11StandalonePlatform *backend);
~GlxBackend() override;
SurfaceTexture *createSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
OutputLayerBeginFrameInfo beginFrame();
void endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion);
void present(Output *output) override;
......
......@@ -139,14 +139,14 @@ OutputLayer *EglX11Backend::primaryLayer(Output *output)
return m_outputs[output].get();
}
SurfaceTexture *EglX11Backend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> EglX11Backend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return new BasicEGLSurfaceTextureWayland(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureWayland>(this, pixmap);
}
SurfaceTexture *EglX11Backend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> EglX11Backend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new BasicEGLSurfaceTextureInternal(this, pixmap);
return std::make_unique<BasicEGLSurfaceTextureInternal>(this, pixmap);
}
} // namespace
......@@ -53,8 +53,8 @@ public:
explicit EglX11Backend(X11WindowedBackend *backend);
~EglX11Backend() override;
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
void init() override;
void endFrame(Output *output, const QRegion &renderedRegion, const QRegion &damagedRegion);
void present(Output *output) override;
......
......@@ -12,6 +12,7 @@
#include <kwinglutils_funcs.h>
#include "screens.h"
#include "surfaceitem.h"
#include "utils/common.h"
#include <QElapsedTimer>
......@@ -62,19 +63,19 @@ std::shared_ptr<KWin::GLTexture> OpenGLBackend::textureForOutput(Output *output)
return {};
}
SurfaceTexture *OpenGLBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> OpenGLBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
Q_UNUSED(pixmap)
return nullptr;
}
SurfaceTexture *OpenGLBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
std::unique_ptr<SurfaceTexture> OpenGLBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
{
Q_UNUSED(pixmap)
return nullptr;
}
SurfaceTexture *OpenGLBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> OpenGLBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
Q_UNUSED(pixmap)
return nullptr;
......
......@@ -52,9 +52,9 @@ public:
CompositingType compositingType() const override final;
bool checkGraphicsReset() override final;
virtual SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
virtual SurfaceTexture *createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
virtual SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
virtual bool makeCurrent() = 0;
virtual void doneCurrent() = 0;
......
......@@ -30,14 +30,14 @@ CompositingType QPainterBackend::compositingType() const
return QPainterCompositing;
}
SurfaceTexture *QPainterBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> QPainterBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new QPainterSurfaceTextureInternal(this, pixmap);
return std::make_unique<QPainterSurfaceTextureInternal>(this, pixmap);
}
SurfaceTexture *QPainterBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> QPainterBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return new QPainterSurfaceTextureWayland(this, pixmap);
return std::make_unique<QPainterSurfaceTextureWayland>(this, pixmap);
}
void QPainterBackend::setFailed(const QString &reason)
......
......@@ -11,6 +11,8 @@
#include "renderbackend.h"
#include <memory>
class QImage;
class QRegion;
class QSize;
......@@ -33,8 +35,8 @@ public:
CompositingType compositingType() const override final;
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
/**
* @brief Whether the creation of the Backend failed.
......
......@@ -625,19 +625,19 @@ QVector<QByteArray> Scene::openGLPlatformInterfaceExtensions() const
return QVector<QByteArray>{};
}
SurfaceTexture *Scene::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> Scene::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
Q_UNUSED(pixmap)
return nullptr;
}
SurfaceTexture *Scene::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
std::unique_ptr<SurfaceTexture> Scene::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
{
Q_UNUSED(pixmap)
return nullptr;
}
SurfaceTexture *Scene::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> Scene::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
Q_UNUSED(pixmap)
return nullptr;
......
......@@ -165,9 +165,9 @@ public:
return {};
}
virtual SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
virtual SurfaceTexture *createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
virtual SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
QMatrix4x4 renderTargetProjectionMatrix() const;
QRect renderTargetRect() const;
......
......@@ -220,17 +220,17 @@ std::shared_ptr<GLTexture> SceneOpenGL::textureForOutput(Output *output) const
return m_backend->textureForOutput(output);
}
SurfaceTexture *SceneOpenGL::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> SceneOpenGL::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return m_backend->createSurfaceTextureInternal(pixmap);
}
SurfaceTexture *SceneOpenGL::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> SceneOpenGL::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return m_backend->createSurfaceTextureWayland(pixmap);
}
SurfaceTexture *SceneOpenGL::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
std::unique_ptr<SurfaceTexture> SceneOpenGL::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
{
return m_backend->createSurfaceTextureX11(pixmap);
}
......
......@@ -59,9 +59,9 @@ public:
bool supportsNativeFence() const override;
DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override;
bool animationsSupported() const override;
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
SurfaceTexture *createSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
void render(Item *item, int mask, const QRegion &region, const WindowPaintData &data) override;
OpenGLBackend *backend() const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment