mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Check whether notification image has alpha channel
This commit is contained in:
parent
43adbb1cb1
commit
cee593c423
1 changed files with 8 additions and 4 deletions
|
@ -679,8 +679,12 @@ void NotificationData::setImage(const QString &imagePath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto image = QImage(imagePath)
|
const auto image = [&] {
|
||||||
.convertToFormat(QImage::Format_RGBA8888);
|
const auto original = QImage(imagePath);
|
||||||
|
return original.hasAlphaChannel()
|
||||||
|
? original.convertToFormat(QImage::Format_RGBA8888)
|
||||||
|
: original.convertToFormat(QImage::Format_RGB888);
|
||||||
|
}();
|
||||||
|
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
return;
|
return;
|
||||||
|
@ -690,9 +694,9 @@ void NotificationData::setImage(const QString &imagePath) {
|
||||||
image.width(),
|
image.width(),
|
||||||
image.height(),
|
image.height(),
|
||||||
int(image.bytesPerLine()),
|
int(image.bytesPerLine()),
|
||||||
true,
|
image.hasAlphaChannel(),
|
||||||
8,
|
8,
|
||||||
4,
|
image.hasAlphaChannel() ? 4 : 3,
|
||||||
std::vector<uchar>(
|
std::vector<uchar>(
|
||||||
image.constBits(),
|
image.constBits(),
|
||||||
image.constBits() + image.sizeInBytes()),
|
image.constBits() + image.sizeInBytes()),
|
||||||
|
|
Loading…
Add table
Reference in a new issue