mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Fix delayed pattern-with-negative-intensity appearance.
This commit is contained in:
parent
7f20cc7b44
commit
e492bbb883
3 changed files with 12 additions and 2 deletions
|
@ -124,6 +124,9 @@ constexpr auto kMinAcceptableContrast = 1.14;// 4.5;
|
||||||
QImage::Format_ARGB32_Premultiplied),
|
QImage::Format_ARGB32_Premultiplied),
|
||||||
.gradient = gradient,
|
.gradient = gradient,
|
||||||
.area = request.area,
|
.area = request.area,
|
||||||
|
.waitingForNegativePattern = (request.background.isPattern
|
||||||
|
&& request.background.prepared.isNull()
|
||||||
|
&& request.background.patternOpacity < 0.)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const auto rects = ComputeChatBackgroundRects(
|
const auto rects = ComputeChatBackgroundRects(
|
||||||
|
@ -206,7 +209,8 @@ CachedBackground::CachedBackground(CacheBackgroundResult &&result)
|
||||||
: pixmap(PixmapFromImage(std::move(result.image)))
|
: pixmap(PixmapFromImage(std::move(result.image)))
|
||||||
, area(result.area)
|
, area(result.area)
|
||||||
, x(result.x)
|
, x(result.x)
|
||||||
, y(result.y) {
|
, y(result.y)
|
||||||
|
, waitingForNegativePattern(result.waitingForNegativePattern) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatTheme::ChatTheme() {
|
ChatTheme::ChatTheme() {
|
||||||
|
|
|
@ -79,6 +79,7 @@ struct CacheBackgroundResult {
|
||||||
QSize area;
|
QSize area;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
bool waitingForNegativePattern = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CachedBackground {
|
struct CachedBackground {
|
||||||
|
@ -89,6 +90,7 @@ struct CachedBackground {
|
||||||
QSize area;
|
QSize area;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
bool waitingForNegativePattern = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BackgroundState {
|
struct BackgroundState {
|
||||||
|
|
|
@ -191,7 +191,11 @@ void SectionWidget::PaintBackground(
|
||||||
const auto to = QRect(
|
const auto to = QRect(
|
||||||
QPoint(cache.x, fromy + cache.y),
|
QPoint(cache.x, fromy + cache.y),
|
||||||
cache.pixmap.size() / cIntRetinaFactor());
|
cache.pixmap.size() / cIntRetinaFactor());
|
||||||
if (cache.area == fill) {
|
if (cache.waitingForNegativePattern) {
|
||||||
|
// While we wait for pattern being loaded we paint just gradient.
|
||||||
|
// But in case of negative patter opacity we just fill-black.
|
||||||
|
p.fillRect(to, Qt::black);
|
||||||
|
} else if (cache.area == fill) {
|
||||||
p.drawPixmap(to, cache.pixmap);
|
p.drawPixmap(to, cache.pixmap);
|
||||||
} else {
|
} else {
|
||||||
const auto sx = fill.width() / float64(cache.area.width());
|
const auto sx = fill.width() / float64(cache.area.width());
|
||||||
|
|
Loading…
Add table
Reference in a new issue