Reduced size of chunk_size and removed conditions as code_size is always zero

This commit is contained in:
tinaq 2016-12-09 14:27:27 -05:00
parent 0f28ed9ce8
commit dc694af672

View File

@ -98,35 +98,15 @@ const BreakPoints& DisassemblerModel::GetBreakPoints() const {
void DisassemblerModel::ParseFromAddress(unsigned int address) { void DisassemblerModel::ParseFromAddress(unsigned int address) {
// NOTE: A too large value causes lagging when scrolling the disassembly // NOTE: A too large value causes lagging when scrolling the disassembly
const unsigned int chunk_size = 1000 * 500; const unsigned int chunk_size = 1000 * 100;
// If we haven't loaded anything yet, initialize base address to the parameter address base_address = address;
if (code_size == 0)
base_address = address;
// If the new area is already loaded, just continue unsigned int num_rows = (base_address + chunk_size - code_size - address) / 4;
if (base_address + code_size > address + chunk_size && base_address <= address)
return;
// Insert rows before currently loaded data beginInsertRows(QModelIndex(), 0, num_rows);
if (base_address > address) { code_size += num_rows;
unsigned int num_rows = (address - base_address) / 4; endInsertRows();
beginInsertRows(QModelIndex(), 0, num_rows);
code_size += num_rows;
base_address = address;
endInsertRows();
}
// Insert rows after currently loaded data
if (base_address + code_size < address + chunk_size) {
unsigned int num_rows = (base_address + chunk_size - code_size - address) / 4;
beginInsertRows(QModelIndex(), 0, num_rows);
code_size += num_rows;
endInsertRows();
}
SetNextInstruction(address); SetNextInstruction(address);
} }