Commit 7cab8cf8 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

Make Scene::qpainterRenderBuffer() take a screen id

parent 94b731c1
......@@ -105,7 +105,7 @@ void SceneQPainterTest::testStartFrame()
const QImage cursorImage = cursor->image();
QVERIFY(!cursorImage.isNull());
p.drawImage(cursor->pos() - cursor->hotspot(), cursorImage);
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer(0));
}
void SceneQPainterTest::testCursorMoving()
......@@ -136,7 +136,7 @@ void SceneQPainterTest::testCursorMoving()
const QImage cursorImage = cursor->image();
QVERIFY(!cursorImage.isNull());
p.drawImage(QPoint(45, 45) - cursor->hotspot(), cursorImage);
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer(0));
}
void SceneQPainterTest::testWindow()
......@@ -174,13 +174,13 @@ void SceneQPainterTest::testWindow()
p->setCursor(cs.data(), QPoint(5, 5));
QVERIFY(frameRenderedSpy.wait());
painter.fillRect(KWin::Cursors::self()->mouse()->pos().x() - 5, KWin::Cursors::self()->mouse()->pos().y() - 5, 10, 10, Qt::red);
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer(0));
// let's move the cursor again
KWin::Cursors::self()->mouse()->setPos(10, 10);
QVERIFY(frameRenderedSpy.wait());
painter.fillRect(0, 0, 200, 300, Qt::blue);
painter.fillRect(5, 5, 10, 10, Qt::red);
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer(0));
}
void SceneQPainterTest::testWindowScaled()
......@@ -230,7 +230,7 @@ void SceneQPainterTest::testWindowScaled()
painter.fillRect(100, 150, 100, 100, Qt::red);
painter.fillRect(5, 5, 10, 10, Qt::red); //cursor
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer(0));
}
void SceneQPainterTest::testCompositorRestart()
......@@ -274,7 +274,7 @@ void SceneQPainterTest::testCompositorRestart()
const QImage cursorImage = cursor->image();
QVERIFY(!cursorImage.isNull());
painter.drawImage(QPoint(400, 400) - cursor->hotspot(), cursorImage);
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer(0));
}
struct XcbConnectionDeleter
......@@ -348,7 +348,7 @@ void SceneQPainterTest::testX11Window()
QVERIFY(frameRenderedSpy.wait());
const QPoint startPos = client->pos() + client->clientPos();
auto image = scene->qpainterRenderBuffer();
auto image = scene->qpainterRenderBuffer(0);
QCOMPARE(image->copy(QRect(startPos, client->clientSize())), compareImage);
// and destroy the window again
......
......@@ -179,9 +179,9 @@ void SceneQPainter::screenGeometryChanged(const QSize &size)
m_backend->screenGeometryChanged(size);
}
QImage *SceneQPainter::qpainterRenderBuffer() const
QImage *SceneQPainter::qpainterRenderBuffer(int screenId) const
{
return m_backend->bufferForScreen(0);
return m_backend->bufferForScreen(screenId);
}
//****************************************
......
......@@ -39,7 +39,7 @@ public:
}
QPainter *scenePainter() const override;
QImage *qpainterRenderBuffer() const override;
QImage *qpainterRenderBuffer(int screenId) const override;
QPainterBackend *backend() const {
return m_backend.data();
......
......@@ -692,8 +692,9 @@ QPainter *Scene::scenePainter() const
return nullptr;
}
QImage *Scene::qpainterRenderBuffer() const
QImage *Scene::qpainterRenderBuffer(int screenId) const
{
Q_UNUSED(screenId)
return nullptr;
}
......
......@@ -179,7 +179,7 @@ public:
* The render buffer used by a QPainter based compositor.
* Default implementation returns @c nullptr.
*/
virtual QImage *qpainterRenderBuffer() const;
virtual QImage *qpainterRenderBuffer(int screenId) const;
/**
* The backend specific extensions (e.g. EGL/GLX extensions).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment