instrument editor undo: don't check delta if no user input has come in that could potentially have dirtied the editor
This commit is contained in:
parent
ea02a913b2
commit
ad53b33d7c
5 changed files with 54 additions and 22 deletions
|
|
@ -376,6 +376,8 @@ bool MemPatch::calcDiff(const void* pre, const void* post, size_t inputSize) {
|
|||
const unsigned char* preBytes=(const unsigned char*)pre;
|
||||
const unsigned char* postBytes=(const unsigned char*)post;
|
||||
|
||||
// @NOTE: consider/profile using a memcmp==0 check to early-out, if it's potentially faster
|
||||
// for the common case, which is no change
|
||||
for (size_t ii=0; ii<inputSize; ++ii) {
|
||||
if (preBytes[ii] != postBytes[ii]) {
|
||||
lastDiff=ii;
|
||||
|
|
@ -439,7 +441,7 @@ bool DivInstrumentUndoStep::makeUndoPatch(size_t processTime_, const DivInstrume
|
|||
return nameValid || podPatch.isValid();
|
||||
}
|
||||
|
||||
void DivInstrument::recordUndoStepIfChanged(size_t processTime, const DivInstrument* old) {
|
||||
bool DivInstrument::recordUndoStepIfChanged(size_t processTime, const DivInstrument* old) {
|
||||
DivInstrumentUndoStep step;
|
||||
|
||||
// generate a patch to go back to old
|
||||
|
|
@ -464,7 +466,10 @@ void DivInstrument::recordUndoStepIfChanged(size_t processTime, const DivInstrum
|
|||
undoHist.push_back(stepPtr);
|
||||
|
||||
// logI("DivInstrument::undoHist push (%u off, %u size)", stepPtr->podPatch.offset, stepPtr->podPatch.size);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int DivInstrument::undo() {
|
||||
|
|
|
|||
|
|
@ -934,7 +934,7 @@ struct DivInstrument : DivInstrumentPOD {
|
|||
*/
|
||||
FixedQueue<DivInstrumentUndoStep*, 128> undoHist;
|
||||
FixedQueue<DivInstrumentUndoStep*, 128> redoHist;
|
||||
void recordUndoStepIfChanged(size_t processTime, const DivInstrument* old);
|
||||
bool recordUndoStepIfChanged(size_t processTime, const DivInstrument* old);
|
||||
int undo();
|
||||
int redo();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue