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