Commit ffc4d9cf authored by Nishant Rodrigues's avatar Nishant Rodrigues

Merge branch 'nishant/ratio-option-skewing/366030'

parents 34f8ecdf 61c422b9
......@@ -128,18 +128,15 @@ QTransform baseBrushTransform(KisDabShape const& shape,
const QRectF &baseBounds)
{
QTransform transform;
if (!qFuzzyCompare(shape.rotation(), 0)) {
QTransform rotationTransform;
rotationTransform.rotateRadians(shape.rotation());
transform.scale(shape.scaleX(), shape.scaleY());
QRectF rotatedBounds = rotationTransform.mapRect(baseBounds);
transform = rotationTransform *
QTransform::fromTranslate(-rotatedBounds.x(), -rotatedBounds.y());
if (!qFuzzyCompare(shape.rotation(), 0)) {
transform = transform * QTransform().rotateRadians(shape.rotation());
QRectF rotatedBounds = transform.mapRect(baseBounds);
transform = transform * QTransform::fromTranslate(-rotatedBounds.x(), -rotatedBounds.y());
}
return transform *
QTransform::fromScale(shape.scaleX(), shape.scaleY()) *
QTransform::fromTranslate(subPixelX, subPixelY);
return transform * QTransform::fromTranslate(subPixelX, subPixelY);
}
void KisQImagePyramid::calculateParams(KisDabShape const& shape,
......@@ -178,7 +175,6 @@ void KisQImagePyramid::calculateParams(KisDabShape shape,
baseBrushTransform(shape,
subPixelX, subPixelY,
baseBounds);
QRect expectedDstRect = roundRect(originalTransform.mapRect(originalBounds));
#if 0 // Only enable when debugging; users shouldn't see this warning
{
......
......@@ -294,6 +294,22 @@ void KisBrushTest::testPyramidLevelRounding()
QCOMPARE(baseLevel, 5);
}
static QSize dabTransformHelper(KisDabShape const& shape)
{
QSize const testSize(150, 150);
qreal const subPixelX = 0.0,
subPixelY = 0.0;
return KisQImagePyramid::imageSize(testSize, shape, subPixelX, subPixelY);
}
void KisBrushTest::testPyramidDabTransform()
{
QCOMPARE(dabTransformHelper(KisDabShape(1.0, 1.0, 0.0)), QSize(150, 150));
QCOMPARE(dabTransformHelper(KisDabShape(1.0, 0.5, 0.0)), QSize(150, 75));
QCOMPARE(dabTransformHelper(KisDabShape(1.0, 1.0, M_PI / 4)), QSize(213, 213));
QCOMPARE(dabTransformHelper(KisDabShape(1.0, 0.5, M_PI / 4)), QSize(160, 160));
}
// see comment in KisQImagePyramid::appendPyramidLevel
void KisBrushTest::testQPainterTransformationBorder()
{
......
......@@ -38,9 +38,10 @@ private Q_SLOTS:
void benchmarkPyramidCreation();
void benchmarkScaling();
void benchmarkRotation();
void benchmarkMaskScaling();
void testPyramidLevelRounding();
void testPyramidDabTransform();
void testQPainterTransformationBorder();
};
......
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