Remove Platform::repaint()

It doesn't belong in Platform.
master
Vlad Zahorodnii 2 years ago
parent 7951940761
commit fa5be54a6d

@ -572,7 +572,11 @@ void X11WindowedBackend::handleButtonPress(xcb_button_press_event_t *event)
void X11WindowedBackend::handleExpose(xcb_expose_event_t *event)
{
repaint(QRect(event->x, event->y, event->width, event->height));
X11WindowedOutput *output = findOutput(event->window);
if (output) {
output->addExposedArea(QRect(event->x, event->y, event->width, event->height));
output->renderLoop()->scheduleRepaint();
}
}
void X11WindowedBackend::updateSize(xcb_configure_notify_event_t *event)

@ -19,7 +19,7 @@
namespace KWin
{
X11WindowedEglOutput::X11WindowedEglOutput(X11WindowedEglBackend *backend, Output *output, EGLSurface surface)
X11WindowedEglOutput::X11WindowedEglOutput(X11WindowedEglBackend *backend, X11WindowedOutput *output, EGLSurface surface)
: m_eglSurface(surface)
, m_output(output)
, m_backend(backend)
@ -43,9 +43,13 @@ std::optional<OutputLayerBeginFrameInfo> X11WindowedEglOutput::beginFrame()
eglMakeCurrent(m_backend->eglDisplay(), m_eglSurface, m_eglSurface, m_backend->context());
ensureFbo();
GLFramebuffer::pushFramebuffer(m_fbo.get());
QRegion repaint = m_output->exposedArea() + m_output->rect();
m_output->clearExposedArea();
return OutputLayerBeginFrameInfo{
.renderTarget = RenderTarget(m_fbo.get()),
.repaint = m_output->rect(),
.repaint = repaint,
};
}
@ -97,7 +101,7 @@ bool X11WindowedEglBackend::createSurfaces()
if (s == EGL_NO_SURFACE) {
return false;
}
m_outputs[output] = std::make_shared<X11WindowedEglOutput>(this, output, s);
m_outputs[output] = std::make_shared<X11WindowedEglOutput>(this, static_cast<X11WindowedOutput *>(output), s);
}
if (m_outputs.isEmpty()) {
return false;

@ -18,12 +18,13 @@ namespace KWin
{
class X11WindowedBackend;
class X11WindowedOutput;
class X11WindowedEglBackend;
class X11WindowedEglOutput : public OutputLayer
{
public:
X11WindowedEglOutput(X11WindowedEglBackend *backend, Output *output, EGLSurface surface);
X11WindowedEglOutput(X11WindowedEglBackend *backend, X11WindowedOutput *output, EGLSurface surface);
~X11WindowedEglOutput();
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
@ -38,7 +39,7 @@ private:
std::unique_ptr<GLFramebuffer> m_fbo;
QRegion m_lastDamage;
Output *const m_output;
X11WindowedOutput *const m_output;
X11WindowedEglBackend *const m_backend;
};

@ -49,6 +49,21 @@ X11WindowedOutput::~X11WindowedOutput()
xcb_flush(m_backend->connection());
}
QRegion X11WindowedOutput::exposedArea() const
{
return m_exposedArea;
}
void X11WindowedOutput::addExposedArea(const QRect &rect)
{
m_exposedArea += rect;
}
void X11WindowedOutput::clearExposedArea()
{
m_exposedArea = QRegion();
}
RenderLoop *X11WindowedOutput::renderLoop() const
{
return m_renderLoop.get();

@ -69,6 +69,10 @@ public:
bool usesSoftwareCursor() const override;
void updateEnablement(bool enabled) override;
QRegion exposedArea() const;
void addExposedArea(const QRect &rect);
void clearExposedArea();
private:
void initXInputForWindow();
void vblank(std::chrono::nanoseconds timestamp);
@ -78,6 +82,7 @@ private:
std::unique_ptr<RenderLoop> m_renderLoop;
std::unique_ptr<SoftwareVsyncMonitor> m_vsyncMonitor;
QPoint m_hostPosition;
QRegion m_exposedArea;
X11WindowedBackend *m_backend;
};

@ -14,7 +14,7 @@
namespace KWin
{
X11WindowedQPainterOutput::X11WindowedQPainterOutput(Output *output, xcb_window_t window)
X11WindowedQPainterOutput::X11WindowedQPainterOutput(X11WindowedOutput *output, xcb_window_t window)
: window(window)
, m_output(output)
{
@ -33,9 +33,13 @@ void X11WindowedQPainterOutput::ensureBuffer()
std::optional<OutputLayerBeginFrameInfo> X11WindowedQPainterOutput::beginFrame()
{
ensureBuffer();
QRegion repaint = m_output->exposedArea() + m_output->rect();
m_output->clearExposedArea();
return OutputLayerBeginFrameInfo{
.renderTarget = RenderTarget(&buffer),
.repaint = m_output->rect(),
.repaint = repaint,
};
}
@ -69,7 +73,8 @@ X11WindowedQPainterBackend::~X11WindowedQPainterBackend()
void X11WindowedQPainterBackend::addOutput(Output *output)
{
m_outputs[output] = std::make_unique<X11WindowedQPainterOutput>(output, m_backend->windowForScreen(output));
X11WindowedOutput *x11Output = static_cast<X11WindowedOutput *>(output);
m_outputs[output] = std::make_unique<X11WindowedQPainterOutput>(x11Output, m_backend->windowForScreen(x11Output));
}
void X11WindowedQPainterBackend::removeOutput(Output *output)

@ -23,11 +23,12 @@ namespace KWin
{
class X11WindowedBackend;
class X11WindowedOutput;
class X11WindowedQPainterOutput : public OutputLayer
{
public:
X11WindowedQPainterOutput(Output *output, xcb_window_t window);
X11WindowedQPainterOutput(X11WindowedOutput *output, xcb_window_t window);
void ensureBuffer();
@ -36,7 +37,7 @@ public:
xcb_window_t window;
QImage buffer;
Output *const m_output;
X11WindowedOutput *const m_output;
};
class X11WindowedQPainterBackend : public QPainterBackend

@ -164,13 +164,6 @@ Output *Platform::findOutput(const QString &name) const
return nullptr;
}
void Platform::repaint(const QRect &rect)
{
if (Compositor::compositing()) {
Compositor::self()->scene()->addRepaint(rect);
}
}
void Platform::setReady(bool ready)
{
if (m_ready == ready) {

@ -372,7 +372,6 @@ Q_SIGNALS:
protected:
explicit Platform(QObject *parent = nullptr);
void repaint(const QRect &rect);
void setReady(bool ready);
QSize initialWindowSize() const
{

Loading…
Cancel
Save