1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix statusnotifier icon color conversion

We were passing premultiplied ARGB data to GTK, where it expected premultiplied RGBA
This commit is contained in:
tux3 2015-02-22 00:56:20 +01:00
parent d2f10f624d
commit 55d78698c2
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -120,8 +120,8 @@ void SystemTrayIcon::setContextMenu(QMenu* menu)
delete reinterpret_cast<QImage*>(image); delete reinterpret_cast<QImage*>(image);
}; };
QImage* image = new QImage(a->icon().pixmap(64, 64).toImage()); QImage* image = new QImage(a->icon().pixmap(64, 64).toImage());
if (image->format() != QImage::Format_ARGB32_Premultiplied) if (image->format() != QImage::Format_RGBA8888_Premultiplied)
*image = image->convertToFormat(QImage::Format_ARGB32_Premultiplied); *image = image->convertToFormat(QImage::Format_RGBA8888_Premultiplied);
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image->bits(), GDK_COLORSPACE_RGB, image->hasAlphaChannel(), GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image->bits(), GDK_COLORSPACE_RGB, image->hasAlphaChannel(),
8, image->width(), image->height(), 8, image->width(), image->height(),
image->bytesPerLine(), callbackFreeImage, image); image->bytesPerLine(), callbackFreeImage, image);
@ -244,8 +244,8 @@ void SystemTrayIcon::setIcon(QIcon &&icon)
delete reinterpret_cast<QImage*>(image); delete reinterpret_cast<QImage*>(image);
}; };
QImage* image = new QImage(icon.pixmap(64, 64).toImage()); QImage* image = new QImage(icon.pixmap(64, 64).toImage());
if (image->format() != QImage::Format_ARGB32_Premultiplied) if (image->format() != QImage::Format_RGBA8888_Premultiplied)
*image = image->convertToFormat(QImage::Format_ARGB32_Premultiplied); *image = image->convertToFormat(QImage::Format_RGBA8888_Premultiplied);
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image->bits(), GDK_COLORSPACE_RGB, image->hasAlphaChannel(), GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image->bits(), GDK_COLORSPACE_RGB, image->hasAlphaChannel(),
8, image->width(), image->height(), 8, image->width(), image->height(),
image->bytesPerLine(), callbackFreeImage, image); image->bytesPerLine(), callbackFreeImage, image);