mirror of https://github.com/procxx/kepka.git
Optimize online dot painting.
This commit is contained in:
parent
034bee8fc3
commit
61c66994a2
|
@ -34,9 +34,9 @@ dialogsPhotoSize: 46px;
|
|||
dialogsPhotoPadding: 12px;
|
||||
dialogsPadding: point(10px, 8px);
|
||||
|
||||
dialogsOnlineBadgeSizePadding: 4px;
|
||||
dialogsOnlineBadgeSize: 8px;
|
||||
dialogsOnlineBadgeRightSkip: 2px;
|
||||
dialogsOnlineBadgeStroke: 2px;
|
||||
dialogsOnlineBadgeSize: 10px;
|
||||
dialogsOnlineBadgeSkip: point(10px, 12px);
|
||||
|
||||
dialogsImportantBarHeight: 37px;
|
||||
|
||||
|
|
|
@ -181,21 +181,27 @@ InnerWidget::InnerWidget(
|
|||
if (peerUpdate.peer->isSelf()) {
|
||||
return;
|
||||
}
|
||||
const auto circleSize = st::dialogsOnlineBadgeSize
|
||||
+ st::dialogsOnlineBadgeSizePadding;
|
||||
const auto history = session().data().historyLoaded(peerUpdate.peer);
|
||||
if (!history) {
|
||||
return;
|
||||
}
|
||||
const auto size = st::dialogsOnlineBadgeSize;
|
||||
const auto stroke = st::dialogsOnlineBadgeStroke;
|
||||
const auto skip = st::dialogsOnlineBadgeSkip;
|
||||
const auto edge = st::dialogsPadding.x() + st::dialogsPhotoSize;
|
||||
const auto updateRect = QRect(
|
||||
st::dialogsPadding.x()
|
||||
+ st::dialogsPhotoSize
|
||||
- st::dialogsOnlineBadgeRightSkip
|
||||
- circleSize,
|
||||
st::dialogsPadding.y()
|
||||
+ st::dialogsPhotoSize
|
||||
- circleSize,
|
||||
circleSize,
|
||||
circleSize);
|
||||
edge - skip.x() - size,
|
||||
edge - skip.y() - size,
|
||||
size,
|
||||
size
|
||||
).marginsAdded(
|
||||
{ stroke, stroke, stroke, stroke }
|
||||
).translated(
|
||||
st::dialogsPadding
|
||||
);
|
||||
updateDialogRow(
|
||||
RowDescriptor(
|
||||
session().data().history(peerUpdate.peer->id),
|
||||
history,
|
||||
FullMsgId()),
|
||||
updateRect,
|
||||
UpdateRowSection::Default | UpdateRowSection::Filtered);
|
||||
|
|
|
@ -260,37 +260,31 @@ void paintRow(
|
|||
frame.setDevicePixelRatio(cRetinaFactor());
|
||||
frame.fill(Qt::transparent);
|
||||
{
|
||||
const auto size = st::dialogsOnlineBadgeSize;
|
||||
const auto paddingSize = st::dialogsOnlineBadgeSizePadding;
|
||||
const auto circleSize = size + paddingSize;
|
||||
const auto offset = size + paddingSize / 2;
|
||||
const auto x = st::dialogsPadding.x() + st::dialogsPhotoSize - st::dialogsOnlineBadgeRightSkip - size;
|
||||
const auto y = st::dialogsPadding.y() + st::dialogsPhotoSize - size;
|
||||
|
||||
Painter q(&frame);
|
||||
PainterHighQualityEnabler hq(q);
|
||||
from->paintUserpicLeft(
|
||||
q,
|
||||
0,
|
||||
0,
|
||||
fullWidth,
|
||||
st::dialogsPhotoSize);
|
||||
q.setPen(Qt::NoPen);
|
||||
q.setBrush(Qt::transparent);
|
||||
q.setCompositionMode(QPainter::CompositionMode_SourceOut);
|
||||
q.drawEllipse(
|
||||
x - circleSize,
|
||||
y - circleSize,
|
||||
circleSize,
|
||||
circleSize);
|
||||
|
||||
PainterHighQualityEnabler hq(q);
|
||||
q.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
|
||||
const auto size = st::dialogsOnlineBadgeSize;
|
||||
const auto stroke = st::dialogsOnlineBadgeStroke;
|
||||
const auto skip = st::dialogsOnlineBadgeSkip;
|
||||
const auto edge = st::dialogsPadding.x() + st::dialogsPhotoSize;
|
||||
|
||||
auto pen = QPen(Qt::transparent);
|
||||
pen.setWidth(stroke);
|
||||
q.setPen(pen);
|
||||
q.setBrush(active
|
||||
? st::dialogsOnlineBadgeFgActive
|
||||
: st::dialogsOnlineBadgeFg);
|
||||
q.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
q.drawEllipse(
|
||||
x - offset,
|
||||
y - offset,
|
||||
edge - skip.x() - size,
|
||||
edge - skip.y() - size,
|
||||
size,
|
||||
size);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue