Commit 87fbfaf9 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fixed two small asserts in Cage Transform worker

parent e73df4fb
......@@ -472,6 +472,7 @@ iterateThroughGrid(PolygonOp polygonOp,
void KisCageTransformWorker::run()
{
KIS_ASSERT_RECOVER_RETURN(m_d->origCage.size() >= 3);
KIS_ASSERT_RECOVER_RETURN(m_d->origCage.size() == m_d->transfCage.size());
QVector<QPointF> transformedPoints = m_d->calculateTransformedPoints();
......@@ -503,7 +504,8 @@ void KisCageTransformWorker::run()
QImage KisCageTransformWorker::runOnQImage(QPointF *newOffset)
{
KIS_ASSERT_RECOVER(m_d->origCage.size() == m_d->transfCage.size()) {
KIS_ASSERT_RECOVER(m_d->origCage.size() >= 3 &&
m_d->origCage.size() == m_d->transfCage.size()) {
return QImage();
}
......
......@@ -43,9 +43,15 @@ inline int calcGridDimension(int start, int end, const int pixelPrecision)
int alignedStart = (start + pixelPrecision - 1) & alignmentMask;
int alignedEnd = end & alignmentMask;
int size = (alignedEnd - alignedStart) / pixelPrecision + 1;
size += alignedStart != start;
size += alignedEnd != end;
int size = 0;
if (alignedEnd > alignedStart) {
size = (alignedEnd - alignedStart) / pixelPrecision + 1;
size += alignedStart != start;
size += alignedEnd != end;
} else {
size = 2 + (end - start >= pixelPrecision);
}
return size;
}
......
......@@ -322,7 +322,7 @@ bool KisWarpTransformStrategy::Private::shouldCloseTheCage() const
return transaction.editWarpPoints() &&
closeOnStartPointClick &&
pointIndexUnderCursor == 0 &&
currentArgs.origPoints().size() > 1 &&
currentArgs.origPoints().size() > 2 &&
!pointWasDragged;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment