From 8a192722cbc2914d1e09dc9d6bd460fb9c8c0a78 Mon Sep 17 00:00:00 2001 From: Jonas Mucke Date: Thu, 23 Jan 2020 20:19:59 +0100 Subject: [PATCH] add cleanup --- src/Layer/PaintingArea.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index b7d9e07..3398d72 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -472,26 +472,28 @@ void PaintingArea::updateTools(){ void PaintingArea::historyadd(){ - if (++historyPresent == 100) historyPresent = 0; - historyMaxFuture = historyPresent; - if (historyPresent == historyMaxPast) if (++historyMaxPast == 100) historyMaxPast = 0; - history[static_cast(historyPresent)] = layerBundle; - - for (unsigned long long i=0;i < layerBundle.size();i++) { - + if (++historyPresent == 100){ + historyPresent = 0; } + historyMaxFuture = historyPresent; + if (historyPresent == historyMaxPast) + if (++historyMaxPast == 100) + historyMaxPast = 0; + history[static_cast(historyPresent)] = layerBundle; } void PaintingArea::historyGoBack(){ if (historyPresent != historyMaxPast){ - if (--historyPresent == -1) historyPresent = 99; + if (--historyPresent == -1) + historyPresent = 99; layerBundle = history[static_cast(historyPresent)]; } } void PaintingArea::historyGoForward(){ if (historyPresent != historyMaxFuture){ - if (++historyPresent == 100) historyPresent = 0; + if (++historyPresent == 100) + historyPresent = 0; layerBundle = history[static_cast(historyPresent)]; } }