Move internal window fbo and pixmap to InternalWindow
This commit is contained in:
parent
10b5236cfa
commit
94f0e564be
5 changed files with 29 additions and 31 deletions
|
@ -384,9 +384,19 @@ void InternalWindow::popupDone()
|
||||||
m_handle->hide();
|
m_handle->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::shared_ptr<QOpenGLFramebufferObject> &InternalWindow::fbo() const
|
||||||
|
{
|
||||||
|
return m_fbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage InternalWindow::image() const
|
||||||
|
{
|
||||||
|
return m_image;
|
||||||
|
}
|
||||||
|
|
||||||
void InternalWindow::present(const std::shared_ptr<QOpenGLFramebufferObject> fbo)
|
void InternalWindow::present(const std::shared_ptr<QOpenGLFramebufferObject> fbo)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_internalImage.isNull());
|
Q_ASSERT(m_image.isNull());
|
||||||
|
|
||||||
const QSizeF bufferSize = fbo->size() / bufferScale();
|
const QSizeF bufferSize = fbo->size() / bufferScale();
|
||||||
QRectF geometry(pos(), clientSizeToFrameSize(bufferSize));
|
QRectF geometry(pos(), clientSizeToFrameSize(bufferSize));
|
||||||
|
@ -397,7 +407,7 @@ void InternalWindow::present(const std::shared_ptr<QOpenGLFramebufferObject> fbo
|
||||||
commitGeometry(geometry);
|
commitGeometry(geometry);
|
||||||
markAsMapped();
|
markAsMapped();
|
||||||
|
|
||||||
m_internalFBO = fbo;
|
m_fbo = fbo;
|
||||||
|
|
||||||
setDepth(32);
|
setDepth(32);
|
||||||
surfaceItem()->addDamage(surfaceItem()->rect().toAlignedRect());
|
surfaceItem()->addDamage(surfaceItem()->rect().toAlignedRect());
|
||||||
|
@ -405,7 +415,7 @@ void InternalWindow::present(const std::shared_ptr<QOpenGLFramebufferObject> fbo
|
||||||
|
|
||||||
void InternalWindow::present(const QImage &image, const QRegion &damage)
|
void InternalWindow::present(const QImage &image, const QRegion &damage)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_internalFBO == nullptr);
|
Q_ASSERT(m_fbo == nullptr);
|
||||||
|
|
||||||
const QSize bufferSize = image.size() / bufferScale();
|
const QSize bufferSize = image.size() / bufferScale();
|
||||||
QRectF geometry(pos(), clientSizeToFrameSize(bufferSize));
|
QRectF geometry(pos(), clientSizeToFrameSize(bufferSize));
|
||||||
|
@ -416,7 +426,7 @@ void InternalWindow::present(const QImage &image, const QRegion &damage)
|
||||||
commitGeometry(geometry);
|
commitGeometry(geometry);
|
||||||
markAsMapped();
|
markAsMapped();
|
||||||
|
|
||||||
m_internalImage = image;
|
m_image = image;
|
||||||
|
|
||||||
setDepth(32);
|
setDepth(32);
|
||||||
surfaceItem()->addDamage(damage);
|
surfaceItem()->addDamage(damage);
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
|
class QOpenGLFramebufferObject;
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -61,6 +63,9 @@ public:
|
||||||
void pointerEnterEvent(const QPointF &globalPos) override;
|
void pointerEnterEvent(const QPointF &globalPos) override;
|
||||||
void pointerLeaveEvent() override;
|
void pointerLeaveEvent() override;
|
||||||
|
|
||||||
|
const std::shared_ptr<QOpenGLFramebufferObject> &fbo() const;
|
||||||
|
QImage image() const;
|
||||||
|
|
||||||
void present(const std::shared_ptr<QOpenGLFramebufferObject> fbo);
|
void present(const std::shared_ptr<QOpenGLFramebufferObject> fbo);
|
||||||
void present(const QImage &image, const QRegion &damage);
|
void present(const QImage &image, const QRegion &damage);
|
||||||
qreal bufferScale() const;
|
qreal bufferScale() const;
|
||||||
|
@ -91,6 +96,8 @@ private:
|
||||||
NET::WindowType m_windowType = NET::Normal;
|
NET::WindowType m_windowType = NET::Normal;
|
||||||
Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
|
Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
|
||||||
bool m_userNoBorder = false;
|
bool m_userNoBorder = false;
|
||||||
|
std::shared_ptr<QOpenGLFramebufferObject> m_fbo;
|
||||||
|
QImage m_image;
|
||||||
|
|
||||||
Q_DISABLE_COPY(InternalWindow)
|
Q_DISABLE_COPY(InternalWindow)
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@ SurfaceItemInternal::SurfaceItemInternal(InternalWindow *window, Scene *scene, I
|
||||||
setSurfaceToBufferMatrix(surfaceToBufferMatrix);
|
setSurfaceToBufferMatrix(surfaceToBufferMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
Window *SurfaceItemInternal::window() const
|
InternalWindow *SurfaceItemInternal::window() const
|
||||||
{
|
{
|
||||||
return m_window;
|
return m_window;
|
||||||
}
|
}
|
||||||
|
@ -75,14 +75,14 @@ void SurfacePixmapInternal::create()
|
||||||
|
|
||||||
void SurfacePixmapInternal::update()
|
void SurfacePixmapInternal::update()
|
||||||
{
|
{
|
||||||
const Window *window = m_item->window();
|
const InternalWindow *window = m_item->window();
|
||||||
|
|
||||||
if (window->internalFramebufferObject()) {
|
if (window->fbo()) {
|
||||||
m_fbo = window->internalFramebufferObject();
|
m_fbo = window->fbo();
|
||||||
m_size = m_fbo->size();
|
m_size = m_fbo->size();
|
||||||
m_hasAlphaChannel = true;
|
m_hasAlphaChannel = true;
|
||||||
} else if (!window->internalImageObject().isNull()) {
|
} else if (!window->image().isNull()) {
|
||||||
m_rasterBuffer = window->internalImageObject();
|
m_rasterBuffer = window->image();
|
||||||
m_size = m_rasterBuffer.size();
|
m_size = m_rasterBuffer.size();
|
||||||
m_hasAlphaChannel = m_rasterBuffer.hasAlphaChannel();
|
m_hasAlphaChannel = m_rasterBuffer.hasAlphaChannel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class KWIN_EXPORT SurfaceItemInternal : public SurfaceItem
|
||||||
public:
|
public:
|
||||||
explicit SurfaceItemInternal(InternalWindow *window, Scene *scene, Item *parent = nullptr);
|
explicit SurfaceItemInternal(InternalWindow *window, Scene *scene, Item *parent = nullptr);
|
||||||
|
|
||||||
Window *window() const;
|
InternalWindow *window() const;
|
||||||
|
|
||||||
QVector<QRectF> shape() const override;
|
QVector<QRectF> shape() const override;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ protected:
|
||||||
std::unique_ptr<SurfacePixmap> createPixmap() override;
|
std::unique_ptr<SurfacePixmap> createPixmap() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Window *m_window;
|
InternalWindow *m_window;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KWIN_EXPORT SurfacePixmapInternal final : public SurfacePixmap
|
class KWIN_EXPORT SurfacePixmapInternal final : public SurfacePixmap
|
||||||
|
|
19
src/window.h
19
src/window.h
|
@ -31,7 +31,6 @@
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QOpenGLFramebufferObject;
|
|
||||||
|
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
|
@ -741,9 +740,6 @@ public:
|
||||||
KWaylandServer::SurfaceInterface *surface() const;
|
KWaylandServer::SurfaceInterface *surface() const;
|
||||||
void setSurface(KWaylandServer::SurfaceInterface *surface);
|
void setSurface(KWaylandServer::SurfaceInterface *surface);
|
||||||
|
|
||||||
const std::shared_ptr<QOpenGLFramebufferObject> &internalFramebufferObject() const;
|
|
||||||
QImage internalImageObject() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns Transformation to map from global to window coordinates.
|
* @returns Transformation to map from global to window coordinates.
|
||||||
*
|
*
|
||||||
|
@ -1541,11 +1537,6 @@ protected:
|
||||||
int bit_depth;
|
int bit_depth;
|
||||||
NETWinInfo *info;
|
NETWinInfo *info;
|
||||||
bool ready_for_painting;
|
bool ready_for_painting;
|
||||||
/**
|
|
||||||
* An FBO object KWin internal windows might render to.
|
|
||||||
*/
|
|
||||||
std::shared_ptr<QOpenGLFramebufferObject> m_internalFBO;
|
|
||||||
QImage m_internalImage;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Window();
|
Window();
|
||||||
|
@ -2243,16 +2234,6 @@ inline quint32 Window::pendingSurfaceId() const
|
||||||
return m_pendingSurfaceId;
|
return m_pendingSurfaceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::shared_ptr<QOpenGLFramebufferObject> &Window::internalFramebufferObject() const
|
|
||||||
{
|
|
||||||
return m_internalFBO;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QImage Window::internalImageObject() const
|
|
||||||
{
|
|
||||||
return m_internalImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
inline T *Window::findInList(const QList<T *> &list, std::function<bool(const U *)> func)
|
inline T *Window::findInList(const QList<T *> &list, std::function<bool(const U *)> func)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue