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