Fix VisualNavbar range

This commit is contained in:
Florian Märkl 2018-07-06 17:32:35 +02:00
parent f12118f4d4
commit 8566e9e2b3
2 changed files with 6 additions and 7 deletions

View File

@ -1546,8 +1546,6 @@ BlockStatistics CutterCore::getBlockStatistics(unsigned int blocksCount)
QJsonArray blocksArray = statsObj["blocks"].toArray();
printf("got %d blocks for requested %u\n", blocksArray.count(), blocksCount);
for (const QJsonValue &value : blocksArray) {
QJsonObject blockObj = value.toObject();
BlockDescription block;

View File

@ -106,12 +106,11 @@ void VisualNavbar::fillData()
int h = graphicsView->height();
RVA totalSize = stats.to - stats.from;
printf("from: %llu, to %llu, first: %llu\n", stats.from, stats.to, stats.blocks[0].addr);
RVA beginAddr = stats.from;
double widthPerByte = (double)w / (double)totalSize;
auto xFromAddr = [widthPerByte] (RVA addr) -> double {
return addr * widthPerByte;
auto xFromAddr = [widthPerByte, beginAddr] (RVA addr) -> double {
return (addr - beginAddr) * widthPerByte;
};
std::array<QBrush, static_cast<int>(DataType::Count)> dataTypeBrushes;
@ -133,12 +132,14 @@ void VisualNavbar::fillData()
xToAddress.append(x2a);
DataType dataType;
if (block.inFunctions > 0) {
if (block.functions > 0) {
dataType = DataType::Code;
} else if (block.strings > 0) {
dataType = DataType::String;
} else if (block.symbols > 0) {
dataType = DataType::Symbol;
} else if (block.inFunctions > 0) {
dataType = DataType::Code;
} else {
lastDataType = DataType::Empty;
continue;