Commit b4643c2a5eb62c436f83fb2e1350a05141d4ae8c

Authored by Scott Klum
1 parent 6ab3d0c5

Added rect flipping for good measure

Showing 1 changed file with 22 additions and 1 deletions
openbr/plugins/register.cpp
... ... @@ -150,7 +150,7 @@ private:
150 150 dst.append(Template(src[i].file,buffer));
151 151  
152 152 QList<QPointF> flippedPoints;
153   - foreach(const QPointF &point, src.last().file.points()) {
  153 + foreach(const QPointF &point, src[i].file.points()) {
154 154 if (axis == Y) {
155 155 flippedPoints.append(QPointF(src[i].m().cols-point.x(),point.y()));
156 156 } else if (axis == X) {
... ... @@ -160,7 +160,28 @@ private:
160 160 }
161 161 }
162 162  
  163 + QList<QRectF> flippedRects;
  164 + foreach(const QRectF &rect, src[i].file.rects()) {
  165 + if (axis == Y) {
  166 + flippedRects.append(QRectF(src[i].m().cols-rect.right(),
  167 + rect.y(),
  168 + rect.width(),
  169 + rect.height()));
  170 + } else if (axis == X) {
  171 + flippedRects.append(QRectF(rect.x(),
  172 + src[i].m().rows-rect.bottom(),
  173 + rect.width(),
  174 + rect.height()));
  175 + } else {
  176 + flippedRects.append(QRectF(src[i].m().cols-rect.right(),
  177 + src[i].m().rows-rect.bottom(),
  178 + rect.width(),
  179 + rect.height()));
  180 + }
  181 + }
  182 +
163 183 dst.last().file.setPoints(flippedPoints);
  184 + dst.last().file.setRects(flippedRects);
164 185 dst.last().file.set("Flipped",true);
165 186 }
166 187 }
... ...