summary refs log tree commit diff
path: root/src/dbus
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-06-08 00:32:02 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-06-08 22:32:14 +0200
commitf145c2a41a312d51b995393f404d7100b4437c97 (patch)
tree3cad24dc34a6a4e557bb3191b7a49062c3bf8fa9 /src/dbus
parentReplace some binding loops with others (diff)
downloadnheko-f145c2a41a312d51b995393f404d7100b4437c97.tar.xz
Fix notification images
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/NhekoDBusApi.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/dbus/NhekoDBusApi.cpp b/src/dbus/NhekoDBusApi.cpp

index a613b610..6b481941 100644 --- a/src/dbus/NhekoDBusApi.cpp +++ b/src/dbus/NhekoDBusApi.cpp
@@ -190,20 +190,17 @@ operator<<(QDBusArgument &arg, const QImage &image) return arg; } - QImage i = image.height() > 100 || image.width() > 100 - ? image.scaledToHeight(100, Qt::SmoothTransformation) - : image; - i = std::move(i).convertToFormat(QImage::Format_RGBA8888); + QImage i = image.height() > 100 || image.width() > 100 + ? image.scaledToHeight(100, Qt::SmoothTransformation) + : image; + bool hasAlpha = i.hasAlphaChannel(); + i = std::move(i).convertToFormat(hasAlpha ? QImage::Format_RGBA8888 : QImage::Format_RGB888); + int channels = hasAlpha ? 4 : 3; + QByteArray arr(reinterpret_cast<const char *>(i.bits()), static_cast<int>(i.sizeInBytes())); arg.beginStructure(); - arg << i.width(); - arg << i.height(); - arg << i.bytesPerLine(); - arg << i.hasAlphaChannel(); - int channels = i.hasAlphaChannel() ? 4 : 3; - arg << i.depth() / channels; - arg << channels; - arg << QByteArray(reinterpret_cast<const char *>(i.bits()), static_cast<int>(i.sizeInBytes())); + arg << i.width() << i.height() << (int)i.bytesPerLine() << i.hasAlphaChannel() + << i.depth() / channels << channels << arr; arg.endStructure(); return arg;