Commit 0f1afdbd authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

scene: Pass dirty region to SceneOpenGLTexture::updateTexture

parent 369b768f
......@@ -435,7 +435,7 @@ bool AbstractEglTexture::loadTexture(WindowPixmap *pixmap)
return loadEglTexture(buffer);
}
void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
void AbstractEglTexture::updateTexture(WindowPixmap *pixmap, const QRegion &region)
{
// FIXME: Refactor this method.
......@@ -444,7 +444,7 @@ void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
if (updateFromFBO(pixmap->fbo())) {
return;
}
if (updateFromInternalImageObject(pixmap)) {
if (updateFromInternalImageObject(pixmap, region)) {
return;
}
return;
......@@ -681,7 +681,7 @@ static QRegion scale(const QRegion &region, qreal scaleFactor)
return scaled;
}
bool AbstractEglTexture::updateFromInternalImageObject(WindowPixmap *pixmap)
bool AbstractEglTexture::updateFromInternalImageObject(WindowPixmap *pixmap, const QRegion &region)
{
const QImage image = pixmap->internalImage();
if (image.isNull()) {
......@@ -693,7 +693,7 @@ bool AbstractEglTexture::updateFromInternalImageObject(WindowPixmap *pixmap)
return loadInternalImageObject(pixmap);
}
createTextureSubImage(image, scale(pixmap->toplevel()->damage(), image.devicePixelRatio()));
createTextureSubImage(image, scale(region, image.devicePixelRatio()));
return true;
}
......
......@@ -96,7 +96,7 @@ class KWIN_EXPORT AbstractEglTexture : public SceneOpenGLTexturePrivate
public:
~AbstractEglTexture() override;
bool loadTexture(WindowPixmap *pixmap) override;
void updateTexture(WindowPixmap *pixmap) override;
void updateTexture(WindowPixmap *pixmap, const QRegion &region) override;
OpenGLBackend *backend() override;
protected:
......@@ -120,7 +120,7 @@ private:
bool loadInternalImageObject(WindowPixmap *pixmap);
EGLImageKHR attach(const QPointer<KWaylandServer::BufferInterface> &buffer);
bool updateFromFBO(const QSharedPointer<QOpenGLFramebufferObject> &fbo);
bool updateFromInternalImageObject(WindowPixmap *pixmap);
bool updateFromInternalImageObject(WindowPixmap *pixmap, const QRegion &region);
SceneOpenGLTexture *q;
AbstractEglBackend *m_backend;
EGLImageKHR m_image;
......
......@@ -47,10 +47,10 @@ bool SceneOpenGLTexture::load(WindowPixmap *pixmap)
return d->loadTexture(pixmap);
}
void SceneOpenGLTexture::updateFromPixmap(WindowPixmap *pixmap)
void SceneOpenGLTexture::updateFromPixmap(WindowPixmap *pixmap, const QRegion &region)
{
Q_D(SceneOpenGLTexture);
d->updateTexture(pixmap);
d->updateTexture(pixmap, region);
}
SceneOpenGLTexturePrivate::SceneOpenGLTexturePrivate()
......@@ -61,9 +61,10 @@ SceneOpenGLTexturePrivate::~SceneOpenGLTexturePrivate()
{
}
void SceneOpenGLTexturePrivate::updateTexture(WindowPixmap *pixmap)
void SceneOpenGLTexturePrivate::updateTexture(WindowPixmap *pixmap, const QRegion &region)
{
Q_UNUSED(pixmap)
Q_UNUSED(region)
}
}
......@@ -33,7 +33,7 @@ private:
SceneOpenGLTexture(SceneOpenGLTexturePrivate& dd);
bool load(WindowPixmap *pixmap);
void updateFromPixmap(WindowPixmap *pixmap);
void updateFromPixmap(WindowPixmap *pixmap, const QRegion &region);
Q_DECLARE_PRIVATE(SceneOpenGLTexture)
......@@ -46,7 +46,7 @@ public:
~SceneOpenGLTexturePrivate() override;
virtual bool loadTexture(WindowPixmap *pixmap) = 0;
virtual void updateTexture(WindowPixmap *pixmap);
virtual void updateTexture(WindowPixmap *pixmap, const QRegion &region);
virtual OpenGLBackend *backend() = 0;
protected:
......
......@@ -614,7 +614,7 @@ bool EglStreamTexture::loadTexture(WindowPixmap *pixmap)
}
}
void EglStreamTexture::updateTexture(WindowPixmap *pixmap)
void EglStreamTexture::updateTexture(WindowPixmap *pixmap, const QRegion &region)
{
using namespace KWaylandServer;
SurfaceInterface *surface = pixmap->surface();
......@@ -634,7 +634,7 @@ void EglStreamTexture::updateTexture(WindowPixmap *pixmap)
}
} else {
// Not an EGLStream surface
AbstractEglTexture::updateTexture(pixmap);
AbstractEglTexture::updateTexture(pixmap, region);
}
}
......
......@@ -82,7 +82,7 @@ class EglStreamTexture : public AbstractEglTexture
public:
~EglStreamTexture() override;
bool loadTexture(WindowPixmap *pixmap) override;
void updateTexture(WindowPixmap *pixmap) override;
void updateTexture(WindowPixmap *pixmap, const QRegion &region) override;
private:
EglStreamTexture(SceneOpenGLTexture *texture, EglStreamBackend *backend);
......
......@@ -1629,7 +1629,7 @@ bool OpenGLWindowPixmap::bind()
{
if (!m_texture->isNull()) {
if (needsPixmapUpdate(this)) {
m_texture->updateFromPixmap(this);
m_texture->updateFromPixmap(this, toplevel->damage());
// mipmaps need to be updated
m_texture->setDirty();
}
......
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