分批更新
This commit is contained in:
parent
4f511a2a5d
commit
25f73007f8
|
|
@ -123,7 +123,8 @@ void MapPresent::paintEvent(QPaintEvent* ev)
|
|||
if (_updated_index_list.size()) {
|
||||
QPainter pic_painter(&_paint_buffer);
|
||||
|
||||
for (auto unit_idx : _updated_index_list) {
|
||||
const int update_batch_count = 1200;
|
||||
for (auto unit_idx : _updated_index_list.mid(0, update_batch_count)) {
|
||||
pic_painter.save();
|
||||
|
||||
auto opt = _visible_units[unit_idx];
|
||||
|
|
@ -147,7 +148,10 @@ void MapPresent::paintEvent(QPaintEvent* ev)
|
|||
pic_painter.restore();
|
||||
}
|
||||
|
||||
_updated_index_list.clear();
|
||||
_updated_index_list = _updated_index_list.mid(update_batch_count);
|
||||
if (_updated_index_list.size()) {
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
QPainter widget_painter(this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue