From 5f7766e49e19e8472424f71db7e8162b154304cf Mon Sep 17 00:00:00 2001 From: Daniel Jour Date: Tue, 19 Nov 2019 20:59:47 +0100 Subject: [PATCH] Keyframe::RemovePoint() only set needs_update if a point was removed --- src/KeyFrame.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index f8fb19c2..3035a670 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -550,9 +550,6 @@ int64_t Keyframe::GetCount() { // Remove a point by matching a coordinate void Keyframe::RemovePoint(Point p) { - // mark as dirty - needs_update = true; - // loop through points, and find a matching coordinate for (int64_t x = 0; x < Points.size(); x++) { // Get each point @@ -562,6 +559,8 @@ void Keyframe::RemovePoint(Point p) { if (p.co.X == existing_point.co.X && p.co.Y == existing_point.co.Y) { // Remove the matching point, and break out of loop Points.erase(Points.begin() + x); + // mark as dirty + needs_update = true; return; } } @@ -572,12 +571,11 @@ void Keyframe::RemovePoint(Point p) { // Remove a point by index void Keyframe::RemovePoint(int64_t index) { - // mark as dirty - needs_update = true; - // Is index a valid point? if (index >= 0 && index < Points.size()) { + // mark as dirty + needs_update = true; // Remove a specific point by index Points.erase(Points.begin() + index); }