From b4643c2a5eb62c436f83fb2e1350a05141d4ae8c Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Mon, 29 Dec 2014 12:29:12 -0500 Subject: [PATCH] Added rect flipping for good measure --- openbr/plugins/register.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/openbr/plugins/register.cpp b/openbr/plugins/register.cpp index ef4c304..52d420b 100644 --- a/openbr/plugins/register.cpp +++ b/openbr/plugins/register.cpp @@ -150,7 +150,7 @@ private: dst.append(Template(src[i].file,buffer)); QList flippedPoints; - foreach(const QPointF &point, src.last().file.points()) { + foreach(const QPointF &point, src[i].file.points()) { if (axis == Y) { flippedPoints.append(QPointF(src[i].m().cols-point.x(),point.y())); } else if (axis == X) { @@ -160,7 +160,28 @@ private: } } + QList flippedRects; + foreach(const QRectF &rect, src[i].file.rects()) { + if (axis == Y) { + flippedRects.append(QRectF(src[i].m().cols-rect.right(), + rect.y(), + rect.width(), + rect.height())); + } else if (axis == X) { + flippedRects.append(QRectF(rect.x(), + src[i].m().rows-rect.bottom(), + rect.width(), + rect.height())); + } else { + flippedRects.append(QRectF(src[i].m().cols-rect.right(), + src[i].m().rows-rect.bottom(), + rect.width(), + rect.height())); + } + } + dst.last().file.setPoints(flippedPoints); + dst.last().file.setRects(flippedRects); dst.last().file.set("Flipped",true); } } -- libgit2 0.21.4