mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 07:29:44 +00:00
(svn r16094) -Fix: AIDebug window profiled the blitters by invalidating itself unconditionally on repaint. OTOH it was not invalidated in other cases when needed.
This commit is contained in:
parent
a91ff2d5e8
commit
90ebf211dc
@ -727,8 +727,14 @@ struct AIDebugWindow : public Window {
|
|||||||
AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();
|
AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();
|
||||||
_current_company = old_company;
|
_current_company = old_company;
|
||||||
|
|
||||||
SetVScrollCount(this, (log == NULL) ? 0 : log->used);
|
int scroll_count = (log == NULL) ? 0 : log->used;
|
||||||
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
if (this->vscroll.count != scroll_count) {
|
||||||
|
SetVScrollCount(this, scroll_count);
|
||||||
|
|
||||||
|
/* We need a repaint */
|
||||||
|
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
||||||
|
}
|
||||||
|
|
||||||
if (log == NULL) return;
|
if (log == NULL) return;
|
||||||
|
|
||||||
/* Detect when the user scrolls the window. Enable autoscroll when the
|
/* Detect when the user scrolls the window. Enable autoscroll when the
|
||||||
@ -736,7 +742,15 @@ struct AIDebugWindow : public Window {
|
|||||||
if (this->last_vscroll_pos != this->vscroll.pos) {
|
if (this->last_vscroll_pos != this->vscroll.pos) {
|
||||||
this->autoscroll = this->vscroll.pos >= log->used - this->vscroll.cap;
|
this->autoscroll = this->vscroll.pos >= log->used - this->vscroll.cap;
|
||||||
}
|
}
|
||||||
if (this->autoscroll) this->vscroll.pos = max(0, log->used - this->vscroll.cap);
|
if (this->autoscroll) {
|
||||||
|
int scroll_pos = max(0, log->used - this->vscroll.cap);
|
||||||
|
if (scroll_pos != this->vscroll.pos) {
|
||||||
|
this->vscroll.pos = scroll_pos;
|
||||||
|
|
||||||
|
/* We need a repaint */
|
||||||
|
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
last_vscroll_pos = this->vscroll.pos;
|
last_vscroll_pos = this->vscroll.pos;
|
||||||
|
|
||||||
int y = 6;
|
int y = 6;
|
||||||
@ -799,6 +813,7 @@ struct AIDebugWindow : public Window {
|
|||||||
virtual void OnResize(Point delta)
|
virtual void OnResize(Point delta)
|
||||||
{
|
{
|
||||||
this->vscroll.cap += delta.y / (int)this->resize.step_height;
|
this->vscroll.cap += delta.y / (int)this->resize.step_height;
|
||||||
|
SetVScrollCount(this, this->vscroll.count); // vscroll.pos should be in a valid range
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user