mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-20 15:17:41 +00:00
removed unnecessary borders in files / links overview, crash fixed in history repaint optimization
This commit is contained in:
parent
827055f32a
commit
c146843ab4
@ -5857,6 +5857,8 @@ void HistoryWidget::ui_repaintHistoryItem(const HistoryItem *item) {
|
||||
}
|
||||
|
||||
void HistoryWidget::onUpdateHistoryItems() {
|
||||
if (!_list) return;
|
||||
|
||||
uint64 ms = getms();
|
||||
if (_lastScrolled + 100 <= ms) {
|
||||
_list->update();
|
||||
|
@ -850,9 +850,11 @@ void LayoutOverviewDocument::paint(Painter &p, const QRect &clip, uint32 selecti
|
||||
statustop = st::linksBorder + st::overviewFileStatusTop;
|
||||
datetop = st::linksBorder + st::overviewFileDateTop;
|
||||
|
||||
QRect shadow(rtlrect(nameleft, 0, _width - nameleft, st::linksBorder, _width));
|
||||
if (clip.intersects(shadow)) {
|
||||
p.fillRect(clip.intersected(shadow), st::linksBorderFg);
|
||||
const OverviewPaintContext *pcontext = context->toOverviewPaintContext();
|
||||
t_assert(pcontext != 0);
|
||||
QRect border(rtlrect(nameleft, 0, _width - nameleft, st::linksBorder, _width));
|
||||
if (!pcontext->isAfterDate && clip.intersects(border)) {
|
||||
p.fillRect(clip.intersected(border), st::linksBorderFg);
|
||||
}
|
||||
|
||||
QRect rthumb(rtlrect(0, st::linksBorder + st::overviewFilePadding.top(), st::overviewFileSize, st::overviewFileSize, _width));
|
||||
@ -1274,8 +1276,11 @@ void LayoutOverviewLink::paint(Painter &p, const QRect &clip, uint32 selection,
|
||||
top += st::normalFont->height;
|
||||
}
|
||||
|
||||
if (clip.intersects(rtlrect(left, 0, w, st::linksBorder, _width))) {
|
||||
p.fillRect(clip.intersected(rtlrect(left, 0, w, st::linksBorder, _width)), st::linksBorderFg);
|
||||
const OverviewPaintContext *pcontext = context->toOverviewPaintContext();
|
||||
t_assert(pcontext != 0);
|
||||
QRect border(rtlrect(left, 0, w, st::linksBorder, _width));
|
||||
if (!pcontext->isAfterDate && clip.intersects(border)) {
|
||||
p.fillRect(clip.intersected(border), st::linksBorderFg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ style::color documentSelectedColor(int32 colorIndex);
|
||||
style::sprite documentCorner(int32 colorIndex);
|
||||
RoundCorners documentCorners(int32 colorIndex);
|
||||
|
||||
class OverviewPaintContext;
|
||||
class InlinePaintContext;
|
||||
class PaintContext {
|
||||
public:
|
||||
@ -89,6 +90,10 @@ public:
|
||||
}
|
||||
uint64 ms;
|
||||
bool selecting;
|
||||
|
||||
virtual const OverviewPaintContext *toOverviewPaintContext() const {
|
||||
return 0;
|
||||
}
|
||||
virtual const InlinePaintContext *toInlinePaintContext() const {
|
||||
return 0;
|
||||
}
|
||||
@ -260,6 +265,17 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
class OverviewPaintContext : public PaintContext {
|
||||
public:
|
||||
OverviewPaintContext(uint64 ms, bool selecting) : PaintContext(ms, selecting), isAfterDate(false) {
|
||||
}
|
||||
const OverviewPaintContext *toOverviewPaintContext() const {
|
||||
return this;
|
||||
}
|
||||
bool isAfterDate;
|
||||
|
||||
};
|
||||
|
||||
class OverviewItemInfo {
|
||||
public:
|
||||
OverviewItemInfo() : _top(0) {
|
||||
|
@ -834,7 +834,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
||||
p.setClipRect(r);
|
||||
}
|
||||
uint64 ms = getms();
|
||||
PaintContext context(ms, _selMode);
|
||||
OverviewPaintContext context(ms, _selMode);
|
||||
|
||||
if (_history->overview[_type].isEmpty() && (!_migrated || !_history->overviewLoaded(_type) || _migrated->overview[_type].isEmpty())) {
|
||||
QPoint dogPos((_width - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||
@ -887,6 +887,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
||||
if (_reversed) curY = _height - curY;
|
||||
if (_marginTop + curY >= r.y() + r.height()) break;
|
||||
|
||||
context.isAfterDate = (j > 0) ? !_items.at(j - 1)->toLayoutMediaItem() : false;
|
||||
p.translate(0, curY - y);
|
||||
_items.at(i)->paint(p, r.translated(-_rowsLeft, -_marginTop - curY), itemSelectedValue(i), &context);
|
||||
y = curY;
|
||||
|
Loading…
Reference in New Issue
Block a user