mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Returned render color theme in main menu when background is filled.
This commit is contained in:
@@ -49,6 +49,20 @@ inline bool AreTestingTheme() {
|
||||
return !GlobalApplying.paletteForRevert.isEmpty();
|
||||
};
|
||||
|
||||
bool CalculateIsMonoColorImage(const QImage &image) {
|
||||
if (!image.isNull()) {
|
||||
const auto bits = reinterpret_cast<const uint32*>(image.constBits());
|
||||
const auto first = bits[0];
|
||||
for (auto i = 0; i < image.width() * image.height(); i++) {
|
||||
if (first != bits[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray readThemeContent(const QString &path) {
|
||||
QFile file(path);
|
||||
if (!file.exists()) {
|
||||
@@ -580,6 +594,7 @@ void ChatBackground::preparePixmaps(QImage image) {
|
||||
}
|
||||
_pixmapForTiled = App::pixmapFromImageInPlace(std::move(imageForTiled));
|
||||
}
|
||||
_isMonoColorImage = CalculateIsMonoColorImage(image);
|
||||
_pixmap = App::pixmapFromImageInPlace(std::move(image));
|
||||
if (!isSmallForTiled) {
|
||||
_pixmapForTiled = _pixmap;
|
||||
@@ -671,6 +686,10 @@ bool ChatBackground::tileNight() const {
|
||||
return _tileNightValue;
|
||||
}
|
||||
|
||||
bool ChatBackground::isMonoColorImage() const {
|
||||
return _isMonoColorImage;
|
||||
}
|
||||
|
||||
void ChatBackground::ensureStarted() {
|
||||
if (_pixmap.isNull() && !_paper.backgroundColor()) {
|
||||
// We should start first, otherwise the default call
|
||||
|
Reference in New Issue
Block a user