mirror of https://github.com/WerWolv/ImHex.git
patterns: Increased highlighting performance
This commit is contained in:
parent
e3dd5900e2
commit
ae9f4fa876
|
@ -807,16 +807,17 @@ namespace hex::pl {
|
|||
|
||||
std::optional<u32> highlightBytes(size_t offset) override{
|
||||
auto entry = this->m_template->clone();
|
||||
ON_SCOPE_EXIT { delete entry; };
|
||||
|
||||
for (u64 address = this->getOffset(); address < this->getOffset() + this->getSize(); address += this->m_template->getSize()) {
|
||||
entry->setOffset(address);
|
||||
if (auto color = entry->highlightBytes(offset); color.has_value())
|
||||
return color.value();
|
||||
}
|
||||
if (offset < this->getOffset() || offset >= this->getOffset() + this->getSize())
|
||||
return { };
|
||||
|
||||
delete entry;
|
||||
|
||||
return { };
|
||||
auto index = (offset - this->getOffset()) / this->m_template->getSize();
|
||||
entry->setOffset(this->getOffset() + this->m_template->getSize() * index);
|
||||
if (auto color = entry->highlightBytes(offset); color.has_value())
|
||||
return color.value();
|
||||
else
|
||||
return { };
|
||||
}
|
||||
|
||||
std::map<u64, u32> getHighlightedAddresses() override {
|
||||
|
|
|
@ -341,9 +341,9 @@ namespace hex {
|
|||
void ViewPatternEditor::parsePattern(char *buffer) {
|
||||
this->m_evaluatorRunning = true;
|
||||
|
||||
this->clearPatternData();
|
||||
this->m_textEditor.SetErrorMarkers({ });
|
||||
this->m_console.clear();
|
||||
this->clearPatternData();
|
||||
EventManager::post<EventPatternChanged>();
|
||||
|
||||
std::thread([this, buffer = std::string(buffer)] {
|
||||
|
@ -358,9 +358,9 @@ namespace hex {
|
|||
|
||||
if (result.has_value()) {
|
||||
SharedData::patternData = std::move(result.value());
|
||||
View::doLater([]{
|
||||
//View::doLater([]{
|
||||
EventManager::post<EventPatternChanged>();
|
||||
});
|
||||
//});
|
||||
}
|
||||
|
||||
this->m_evaluatorRunning = false;
|
||||
|
|
Loading…
Reference in New Issue