add cleanup

This commit is contained in:
Jonas Mucke
2020-01-23 20:19:59 +01:00
parent 5d794819b0
commit 8a192722cb

View File

@@ -472,26 +472,28 @@ void PaintingArea::updateTools(){
void PaintingArea::historyadd(){ void PaintingArea::historyadd(){
if (++historyPresent == 100) historyPresent = 0; if (++historyPresent == 100){
historyMaxFuture = historyPresent; historyPresent = 0;
if (historyPresent == historyMaxPast) if (++historyMaxPast == 100) historyMaxPast = 0;
history[static_cast<size_t>(historyPresent)] = layerBundle;
for (unsigned long long i=0;i < layerBundle.size();i++) {
} }
historyMaxFuture = historyPresent;
if (historyPresent == historyMaxPast)
if (++historyMaxPast == 100)
historyMaxPast = 0;
history[static_cast<size_t>(historyPresent)] = layerBundle;
} }
void PaintingArea::historyGoBack(){ void PaintingArea::historyGoBack(){
if (historyPresent != historyMaxPast){ if (historyPresent != historyMaxPast){
if (--historyPresent == -1) historyPresent = 99; if (--historyPresent == -1)
historyPresent = 99;
layerBundle = history[static_cast<size_t>(historyPresent)]; layerBundle = history[static_cast<size_t>(historyPresent)];
} }
} }
void PaintingArea::historyGoForward(){ void PaintingArea::historyGoForward(){
if (historyPresent != historyMaxFuture){ if (historyPresent != historyMaxFuture){
if (++historyPresent == 100) historyPresent = 0; if (++historyPresent == 100)
historyPresent = 0;
layerBundle = history[static_cast<size_t>(historyPresent)]; layerBundle = history[static_cast<size_t>(historyPresent)];
} }
} }