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
This commit is contained in:
David Edmundson 2017-08-30 10:01:55 +01:00
parent afc80b580a
commit b57a525ef7
3 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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);

View file

@ -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);