1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-20 18:50:15 +03:00

identify single color background also

--Latte now does not only identify background files
but single colors also. At the same time the new
implementation is multi-screen aware. That means
that two different top panels at two different screens
can be color independent, meaning the first could
be lightish when it is transparent and the latter
darkish

BUG: 402143
This commit is contained in:
Michail Vourlakos 2018-12-25 19:11:59 +02:00
parent 418799ed30
commit b6ae8d66ee

View File

@ -188,14 +188,20 @@ float BackgroundCache::luminasFor(QString activity, QString screen, Plasma::Type
float BackgroundCache::luminasFromFile(QString imageFile, Plasma::Types::Location location)
{
QImage image(imageFile);
if (m_luminasCache.keys().contains(imageFile)) {
if (m_luminasCache[imageFile].keys().contains(location)) {
return m_luminasCache[imageFile].value(location);
}
}
//! if it is a color
if (imageFile.startsWith("#")) {
return Latte::colorLumina(QColor(imageFile));
}
//! if it is a local image
QImage image(imageFile);
if (image.format() != QImage::Format_Invalid) {
int maskHeight = (0.08 * image.height());
int maskWidth = (0.05 * image.width());