scene: Pass dirty region to SceneOpenGLTexture::updateTexture
This commit is contained in:
parent
369b768f36
commit
0f1afdbdc0
7 changed files with 16 additions and 15 deletions
|
@ -435,7 +435,7 @@ bool AbstractEglTexture::loadTexture(WindowPixmap *pixmap)
|
|||
return loadEglTexture(buffer);
|
||||
}
|
||||
|
||||
void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
|
||||
void AbstractEglTexture::updateTexture(WindowPixmap *pixmap, const QRegion ®ion)
|
||||
{
|
||||
// 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 ®ion, qreal scaleFactor)
|
|||
return scaled;
|
||||
}
|
||||
|
||||
bool AbstractEglTexture::updateFromInternalImageObject(WindowPixmap *pixmap)
|
||||
bool AbstractEglTexture::updateFromInternalImageObject(WindowPixmap *pixmap, const QRegion ®ion)
|
||||
{
|
||||
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 ®ion) 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 ®ion);
|
||||
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 ®ion)
|
||||
{
|
||||
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 ®ion)
|
||||
{
|
||||
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 ®ion);
|
||||
|
||||
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 ®ion);
|
||||
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 ®ion)
|
||||
{
|
||||
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 ®ion) 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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue