Commit b57a525e authored by David Edmundson's avatar David Edmundson

ARGB buffers are premultiplied

D7460 in kwayland assumes all WL_SHM_FORMAT_ARGB8888 buffers have
opacity premultipied RGB values.

Kwin tests need updating to do the same.
Rendering code did not need changing.

Test Plan: Tests now pass

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7607
parent afc80b58
......@@ -129,7 +129,7 @@ KWayland::Client::XdgShellSurface *createXdgShellV5Surface(KWayland::Client::Sur
* Creates a shared memory buffer of @p size in @p color and attaches it to the @p surface.
* The @p surface gets damaged and committed, thus it's rendered.
**/
void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format = QImage::Format_ARGB32);
void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format = QImage::Format_ARGB32_Premultiplied);
/**
* Creates a shared memory buffer using the supplied image @p img and attaches it to the @p surface
......
......@@ -848,7 +848,7 @@ void PointerInputTest::testCursorImage()
QVERIFY(cursorSurface);
QSignalSpy cursorRenderedSpy(cursorSurface, &Surface::frameRendered);
QVERIFY(cursorRenderedSpy.isValid());
QImage red = QImage(QSize(10, 10), QImage::Format_ARGB32);
QImage red = QImage(QSize(10, 10), QImage::Format_ARGB32_Premultiplied);
red.fill(Qt::red);
cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(red));
cursorSurface->damage(QRect(0, 0, 10, 10));
......@@ -864,7 +864,7 @@ void PointerInputTest::testCursorImage()
QCOMPARE(p->cursorImage(), red);
// change the buffer
QImage blue = QImage(QSize(10, 10), QImage::Format_ARGB32);
QImage blue = QImage(QSize(10, 10), QImage::Format_ARGB32_Premultiplied);
blue.fill(Qt::blue);
auto b = Test::waylandShmPool()->createBuffer(blue);
cursorSurface->attachBuffer(b);
......
......@@ -226,7 +226,7 @@ void SceneQPainterTest::testWindowScaled()
//draw a blue square@400x600 with red rectangle@200x200 in the middle
const QSize size(400,600);
QImage img(size, QImage::Format_ARGB32);
QImage img(size, QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::blue);
QPainter surfacePainter(&img);
surfacePainter.fillRect(200,300,200,200, Qt::red);
......
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