Commit 123c58cd authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix Tangent-Normal brush on rotated/mirrored canvas

(and also in multihand brush)

Now the canvas rotation/mirroing code is fully ported to the new
API, by passing via KisPaintInformation instead of paintop settings'
temporary properties.

BUG:404408
parent 86cfd2e3
......@@ -85,6 +85,8 @@ struct KisPaintInformation::Private {
directionHistoryInfo = rhs.directionHistoryInfo;
canvasRotation = rhs.canvasRotation;
canvasMirroredH = rhs.canvasMirroredH;
canvasMirroredV = rhs.canvasMirroredV;
if (rhs.drawingAngleOverride) {
drawingAngleOverride = *rhs.drawingAngleOverride;
}
......@@ -105,8 +107,9 @@ struct KisPaintInformation::Private {
bool isHoveringMode;
KisRandomSourceSP randomSource;
KisPerStrokeRandomSourceSP perStrokeRandomSource;
int canvasRotation {0};
qreal canvasRotation {0};
bool canvasMirroredH {false};
bool canvasMirroredV {false};
boost::optional<qreal> drawingAngleOverride;
bool sanityIsRegistered = false;
......@@ -255,8 +258,9 @@ KisPaintInformation::createHoveringModeInfo(const QPointF &pos,
qreal tangentialPressure,
qreal perspective,
qreal speed,
int canvasrotation,
bool canvasMirroredH)
qreal canvasrotation,
bool canvasMirroredH,
bool canvasMirroredV)
{
KisPaintInformation info(pos,
pressure,
......@@ -267,23 +271,19 @@ KisPaintInformation::createHoveringModeInfo(const QPointF &pos,
info.d->isHoveringMode = true;
info.d->canvasRotation = canvasrotation;
info.d->canvasMirroredH = canvasMirroredH;
info.d->canvasMirroredV = canvasMirroredV;
return info;
}
int KisPaintInformation::canvasRotation() const
qreal KisPaintInformation::canvasRotation() const
{
return d->canvasRotation;
}
void KisPaintInformation::setCanvasRotation(int rotation)
void KisPaintInformation::setCanvasRotation(qreal rotation)
{
if (rotation < 0) {
d->canvasRotation= 360- abs(rotation % 360);
} else {
d->canvasRotation= rotation % 360;
}
d->canvasRotation = normalizeAngleDegrees(rotation);
}
bool KisPaintInformation::canvasMirroredH() const
......@@ -291,10 +291,19 @@ bool KisPaintInformation::canvasMirroredH() const
return d->canvasMirroredH;
}
void KisPaintInformation::setCanvasHorizontalMirrorState(bool mir)
void KisPaintInformation::setCanvasMirroredH(bool value)
{
d->canvasMirroredH = mir;
d->canvasMirroredH = value;
}
bool KisPaintInformation::canvasMirroredV() const
{
return d->canvasMirroredV;
}
void KisPaintInformation::setCanvasMirroredV(bool value)
{
d->canvasMirroredV = value;
}
void KisPaintInformation::toXML(QDomDocument&, QDomElement& e) const
......@@ -606,6 +615,9 @@ void KisPaintInformation::mixOtherImpl(const QPointF &p, qreal t, const KisPaint
KIS_ASSERT_RECOVER_NOOP(other.isHoveringMode() == this->isHoveringMode());
*(this->d) = Private(p, pressure, xTilt, yTilt, rotation, tangentialPressure, perspective, time, speed, other.isHoveringMode());
this->d->canvasRotation = other.d->canvasRotation;
this->d->canvasMirroredH = other.d->canvasMirroredH;
this->d->canvasMirroredV = other.d->canvasMirroredV;
this->d->randomSource = other.d->randomSource;
this->d->perStrokeRandomSource = other.d->perStrokeRandomSource;
// this->d->isHoveringMode = other.isHoveringMode();
......
......@@ -253,26 +253,39 @@ public:
qreal tangentialPressure = 0.0,
qreal perspective = 1.0,
qreal speed = 0.0,
int canvasrotation = 0,
bool canvasMirroredH = false);
qreal canvasrotation = 0,
bool canvasMirroredH = false,
bool canvasMirroredV = false);
/**
*Returns the canvas rotation if that has been given to the kispaintinformation.
* Returns the canvas rotation if that has been given to the kispaintinformation.
*/
int canvasRotation() const;
qreal canvasRotation() const;
/**
*set the canvas rotation.
* Set the canvas rotation.
*/
void setCanvasRotation(int rotation);
void setCanvasRotation(qreal rotation);
/*
*Whether the canvas is mirrored for the paint-operation.
/**
* Whether the canvas is horizontally mirrored for the paint-operation.
*/
bool canvasMirroredH() const;
/*
*Set whether the canvas is mirrored for the paint-operation.
/**
* Set whether the canvas is horizontally mirrored for the paint-operation.
*/
void setCanvasMirroredH(bool value);
/**
* Whether the canvas is vertically mirrored for the paint-operation.
*/
bool canvasMirroredV() const;
/**
* Set whether the canvas is vertically mirrored for the paint-operation.
*/
void setCanvasHorizontalMirrorState(bool mir);
void setCanvasMirroredV(bool value);
void toXML(QDomDocument&, QDomElement&) const;
......
......@@ -439,25 +439,6 @@ QPainterPath KisPaintOpSettings::makeTiltIndicator(KisPaintInformation const& in
return ret;
}
void KisPaintOpSettings::setCanvasRotation(qreal angle)
{
Private::DirtyNotificationsLocker locker(d.data());
setProperty("runtimeCanvasRotation", angle);
setPropertyNotSaved("runtimeCanvasRotation");
}
void KisPaintOpSettings::setCanvasMirroring(bool xAxisMirrored, bool yAxisMirrored)
{
Private::DirtyNotificationsLocker locker(d.data());
setProperty("runtimeCanvasMirroredX", xAxisMirrored);
setPropertyNotSaved("runtimeCanvasMirroredX");
setProperty("runtimeCanvasMirroredY", yAxisMirrored);
setPropertyNotSaved("runtimeCanvasMirroredY");
}
void KisPaintOpSettings::setProperty(const QString & name, const QVariant & value)
{
if (value != KisPropertiesConfiguration::getProperty(name) &&
......
......@@ -282,15 +282,6 @@ public:
/// @return loadable state of the settings, by default implementation return the same as isValid()
virtual bool isLoadable();
/**
* These methods are populating properties with runtime
* information about canvas rotation/mirroring. This information
* is set directly by KisToolFreehand. Later the data is accessed
* by the pressure options to make a final decision.
*/
void setCanvasRotation(qreal angle);
void setCanvasMirroring(bool xAxisMirrored, bool yAxisMirrored);
/**
* Overrides the method in KisPropertiesCofiguration to allow
* onPropertyChanged() callback
......
......@@ -19,7 +19,6 @@ set(kritaui_LIB_SRCS
canvas/kis_canvas2.cpp
canvas/kis_canvas_updates_compressor.cpp
canvas/kis_canvas_controller.cpp
canvas/kis_paintop_transformation_connector.cpp
canvas/kis_display_color_converter.cpp
canvas/kis_display_filter.cpp
canvas/kis_exposure_gamma_correction_interface.cpp
......
......@@ -25,7 +25,6 @@
#include <klocalizedstring.h>
#include <kactioncollection.h>
#include "kis_canvas_decoration.h"
#include "kis_paintop_transformation_connector.h"
#include "kis_coordinates_converter.h"
#include "kis_canvas2.h"
#include "opengl/kis_opengl_canvas2.h"
......@@ -42,8 +41,7 @@ static const int gRulersUpdateDelay = 80 /* ms */;
struct KisCanvasController::Private {
Private(KisCanvasController *qq)
: q(qq),
paintOpTransformationConnector(0)
: q(qq)
{
using namespace std::placeholders;
......@@ -60,7 +58,6 @@ struct KisCanvasController::Private {
QPointer<KisView> view;
KisCoordinatesConverter *coordinatesConverter;
KisCanvasController *q;
KisPaintopTransformationConnector *paintOpTransformationConnector;
QScopedPointer<KisSignalCompressorWithParam<QPoint> > mousePositionCompressor;
void emitPointerPositionChangedSignals(QPoint pointerPos);
......@@ -112,14 +109,8 @@ void KisCanvasController::setCanvas(KoCanvasBase *canvas)
m_d->coordinatesConverter =
const_cast<KisCoordinatesConverter*>(kritaCanvas->coordinatesConverter());
m_d->paintOpTransformationConnector =
new KisPaintopTransformationConnector(kritaCanvas, this);
} else {
m_d->coordinatesConverter = 0;
delete m_d->paintOpTransformationConnector;
m_d->paintOpTransformationConnector = 0;
}
KoCanvasControllerWidget::setCanvas(canvas);
......@@ -200,7 +191,6 @@ void KisCanvasController::mirrorCanvas(bool enable)
QPoint newOffset = m_d->coordinatesConverter->mirror(m_d->coordinatesConverter->widgetCenterPoint(), enable, false);
m_d->updateDocumentSizeAfterTransform();
setScrollBarValue(newOffset);
m_d->paintOpTransformationConnector->notifyTransformationChanged();
m_d->showMirrorStateOnCanvas();
}
......@@ -219,7 +209,6 @@ void KisCanvasController::rotateCanvas(qreal angle, const QPointF &center)
QPoint newOffset = m_d->coordinatesConverter->rotate(center, angle);
m_d->updateDocumentSizeAfterTransform();
setScrollBarValue(newOffset);
m_d->paintOpTransformationConnector->notifyTransformationChanged();
m_d->showRotationValueOnCanvas();
}
......@@ -248,7 +237,6 @@ void KisCanvasController::resetCanvasRotation()
QPoint newOffset = m_d->coordinatesConverter->resetRotation(m_d->coordinatesConverter->widgetCenterPoint());
m_d->updateDocumentSizeAfterTransform();
setScrollBarValue(newOffset);
m_d->paintOpTransformationConnector->notifyTransformationChanged();
m_d->showRotationValueOnCanvas();
}
......
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_paintop_transformation_connector.h"
#include "kis_canvas_resource_provider.h"
#include "kis_canvas2.h"
#include "kis_coordinates_converter.h"
#include "brushengine/kis_paintop_preset.h"
#include "brushengine/kis_paintop_settings.h"
KisPaintopTransformationConnector::KisPaintopTransformationConnector(KisCanvas2 *canvas, QObject *parent)
: QObject(parent),
m_canvas(canvas)
{
connect(m_canvas->resourceManager(),
SIGNAL(canvasResourceChanged(int,QVariant)),
SLOT(slotCanvasResourceChanged(int,QVariant)));
}
void KisPaintopTransformationConnector::notifyTransformationChanged()
{
KisPaintOpPresetSP preset =
m_canvas->resourceManager()->
resource(KisCanvasResourceProvider::CurrentPaintOpPreset).value<KisPaintOpPresetSP>();
if (preset) {
const KisCoordinatesConverter *converter = m_canvas->coordinatesConverter();
preset->settings()->setCanvasRotation(converter->rotationAngle());
preset->settings()->setCanvasMirroring(converter->xAxisMirrored(),
converter->yAxisMirrored());
}
}
void KisPaintopTransformationConnector::slotCanvasResourceChanged(int key, const QVariant &resource)
{
Q_UNUSED(resource);
if (key == KisCanvasResourceProvider::CurrentPaintOpPreset) {
notifyTransformationChanged();
}
}
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINTOP_TRANSFORMATION_CONNECTOR_H
#define __KIS_PAINTOP_TRANSFORMATION_CONNECTOR_H
#include <QObject>
#include <QPointer>
#include <kis_canvas2.h>
class KisPaintopTransformationConnector : public QObject
{
Q_OBJECT
public:
KisPaintopTransformationConnector(KisCanvas2 *canvas, QObject *parent);
public:
void notifyTransformationChanged();
public Q_SLOTS:
void slotCanvasResourceChanged(int key, const QVariant &resource);
private:
QPointer<KisCanvas2> m_canvas;
};
#endif /* __KIS_PAINTOP_TRANSFORMATION_CONNECTOR_H */
......@@ -101,6 +101,20 @@ qreal KisPaintingInformationBuilder::calculatePerspective(const QPointF &documen
return 1.0;
}
qreal KisPaintingInformationBuilder::canvasRotation() const
{
return 0;
}
bool KisPaintingInformationBuilder::canvasMirroredX() const
{
return false;
}
bool KisPaintingInformationBuilder::canvasMirroredY() const
{
return false;
}
KisPaintInformation KisPaintingInformationBuilder::createPaintingInformation(KoPointerEvent *event,
int timeElapsed)
......@@ -111,7 +125,7 @@ KisPaintInformation KisPaintingInformationBuilder::createPaintingInformation(KoP
qreal perspective = calculatePerspective(adjusted);
qreal speed = m_speedSmoother->getNextSpeed(imageToView(imagePoint));
return KisPaintInformation(imagePoint,
KisPaintInformation pi(imagePoint,
!m_pressureDisabled ? 1.0 : pressureToCurve(event->pressure()),
event->xTilt(), event->yTilt(),
event->rotation(),
......@@ -119,6 +133,12 @@ KisPaintInformation KisPaintingInformationBuilder::createPaintingInformation(KoP
perspective,
timeElapsed,
speed);
pi.setCanvasRotation(canvasRotation());
pi.setCanvasMirroredH(canvasMirroredX());
pi.setCanvasMirroredV(canvasMirroredY());
return pi;
}
KisPaintInformation KisPaintingInformationBuilder::hover(const QPointF &imagePoint,
......@@ -134,9 +154,16 @@ KisPaintInformation KisPaintingInformationBuilder::hover(const QPointF &imagePoi
event->rotation(),
event->tangentialPressure(),
perspective,
speed);
speed,
canvasRotation(),
canvasMirroredX(),
canvasMirroredY());
} else {
return KisPaintInformation::createHoveringModeInfo(imagePoint);
KisPaintInformation pi = KisPaintInformation::createHoveringModeInfo(imagePoint);
pi.setCanvasRotation(canvasRotation());
pi.setCanvasMirroredH(canvasMirroredX());
pi.setCanvasMirroredV(canvasMirroredY());
return pi;
}
}
......@@ -166,11 +193,27 @@ QPointF KisConverterPaintingInformationBuilder::imageToView(const QPointF &point
return m_converter->documentToWidget(point);
}
qreal KisConverterPaintingInformationBuilder::canvasRotation() const
{
return m_converter->rotationAngle();
}
bool KisConverterPaintingInformationBuilder::canvasMirroredX() const
{
return m_converter->xAxisMirrored();
}
bool KisConverterPaintingInformationBuilder::canvasMirroredY() const
{
return m_converter->yAxisMirrored();
}
/***********************************************************************/
/* KisToolFreehandPaintingInformationBuilder */
/* KisToolFreehandPaintingInformationBuilder */
/***********************************************************************/
#include "kis_tool_freehand.h"
#include "kis_canvas2.h"
KisToolFreehandPaintingInformationBuilder::KisToolFreehandPaintingInformationBuilder(KisToolFreehand *tool)
: m_tool(tool)
......@@ -196,3 +239,21 @@ qreal KisToolFreehandPaintingInformationBuilder::calculatePerspective(const QPoi
{
return m_tool->calculatePerspective(documentPoint);
}
qreal KisToolFreehandPaintingInformationBuilder::canvasRotation() const
{
KisCanvas2 *canvas = dynamic_cast<KisCanvas2*>(m_tool->canvas());
return canvas->coordinatesConverter()->rotationAngle();
}
bool KisToolFreehandPaintingInformationBuilder::canvasMirroredX() const
{
KisCanvas2 *canvas = dynamic_cast<KisCanvas2*>(m_tool->canvas());
return canvas->coordinatesConverter()->xAxisMirrored();
}
bool KisToolFreehandPaintingInformationBuilder::canvasMirroredY() const
{
KisCanvas2 *canvas = dynamic_cast<KisCanvas2*>(m_tool->canvas());
return canvas->coordinatesConverter()->yAxisMirrored();
}
......@@ -59,6 +59,10 @@ protected:
virtual QPointF imageToView(const QPointF &point);
virtual qreal calculatePerspective(const QPointF &documentPoint);
virtual qreal canvasRotation() const;
virtual bool canvasMirroredX() const;
virtual bool canvasMirroredY() const;
private:
KisPaintInformation createPaintingInformation(KoPointerEvent *event,
......@@ -88,6 +92,10 @@ protected:
QPointF documentToImage(const QPointF &point) override;
QPointF imageToView(const QPointF &point) override;
qreal canvasRotation() const override;
bool canvasMirroredX() const override;
bool canvasMirroredY() const override;
private:
const KisCoordinatesConverter *m_converter;
};
......@@ -105,6 +113,10 @@ protected:
QPointF adjustDocumentPoint(const QPointF &point, const QPointF &startPoint) override;
qreal calculatePerspective(const QPointF &documentPoint) override;
qreal canvasRotation() const override;
bool canvasMirroredX() const override;
bool canvasMirroredY() const override;
private:
KisToolFreehand *m_tool;
};
......
......@@ -176,12 +176,6 @@ void KisToolFreehand::initStroke(KoPointerEvent *event)
void KisToolFreehand::doStroke(KoPointerEvent *event)
{
//set canvas information here?//
KisCanvas2 *canvas2 = dynamic_cast<KisCanvas2 *>(canvas());
if (canvas2) {
m_helper->setCanvasHorizontalMirrorState(canvas2->xAxisMirrored());
m_helper->setCanvasRotation(canvas2->rotationAngle());
}
m_helper->paintEvent(event);
}
......
......@@ -111,9 +111,6 @@ struct KisToolFreehandHelper::Private
QTimer asynchronousUpdatesThresholdTimer;
int canvasRotation;
bool canvasMirroredH;
qreal effectiveSmoothnessDistance() const;
};
......@@ -127,7 +124,6 @@ KisToolFreehandHelper::KisToolFreehandHelper(KisPaintingInformationBuilder *info
m_d->transactionText = transactionText;
m_d->smoothingOptions = KisSmoothingOptionsSP(
smoothingOptions ? smoothingOptions : new KisSmoothingOptions());
m_d->canvasRotation = 0;
m_d->fakeDabRandomSource = new KisRandomSource();
m_d->fakeStrokeRandomSource = new KisPerStrokeRandomSource();
......@@ -173,8 +169,6 @@ QPainterPath KisToolFreehandHelper::paintOpOutline(const QPointF &savedCursorPos
KisPaintInformation info = m_d->infoBuilder->hover(savedCursorPos, event);
QPointF prevPoint = m_d->lastCursorPos.pushThroughHistory(savedCursorPos);
qreal startAngle = KisAlgebra2D::directionBetweenPoints(prevPoint, savedCursorPos, 0);
info.setCanvasRotation(m_d->canvasRotation);
info.setCanvasHorizontalMirrorState( m_d->canvasMirroredH );
KisDistanceInformation distanceInfo(prevPoint, startAngle);
if (!m_d->strokeInfos.isEmpty()) {
......@@ -440,9 +434,6 @@ void KisToolFreehandHelper::paintEvent(KoPointerEvent *event)
KisPaintInformation info =
m_d->infoBuilder->continueStroke(event,
elapsedStrokeTime());
info.setCanvasRotation( m_d->canvasRotation );
info.setCanvasHorizontalMirrorState( m_d->canvasMirroredH );
KisUpdateTimeMonitor::instance()->reportMouseMove(info.pos());
paint(info);
......@@ -982,22 +973,3 @@ void KisToolFreehandHelper::paintBezierCurve(const KisPaintInformation &pi1,
{
paintBezierCurve(0, pi1, control1, control2, pi2);
}
int KisToolFreehandHelper::canvasRotation()
{
return m_d->canvasRotation;
}
void KisToolFreehandHelper::setCanvasRotation(int rotation)
{
m_d->canvasRotation = rotation;
}
bool KisToolFreehandHelper::canvasMirroredH()
{
return m_d->canvasMirroredH;
}
void KisToolFreehandHelper::setCanvasHorizontalMirrorState(bool mirrored)
{
m_d->canvasMirroredH = mirrored;
}
......@@ -83,10 +83,7 @@ public:
const KoPointerEvent *event,
const KisPaintOpSettingsSP globalSettings,
KisPaintOpSettings::OutlineMode mode) const;
int canvasRotation();
void setCanvasRotation(int rotation = 0);
bool canvasMirroredH();
void setCanvasHorizontalMirrorState (bool mirrored = false);
Q_SIGNALS:
/**
* The signal is emitted when the outline should be updated
......
......@@ -22,6 +22,7 @@
#include "kis_painter.h"
#include <strokes/KisFreehandStrokeInfo.h>
#include "kis_algebra_2d.h"
struct KisToolMultihandHelper::Private
{
......@@ -61,6 +62,25 @@ void KisToolMultihandHelper::createPainters(QVector<KisFreehandStrokeInfo*> &str
}
}
void adjustPointInformationRotation(KisPaintInformation &pi, const QTransform &t)
{
KisAlgebra2D::DecomposedMatix d(t);
qreal rotation = d.angle;
const bool mirrorX = KisAlgebra2D::signPZ(d.scaleX) < 0;
const bool mirrorY = KisAlgebra2D::signPZ(d.scaleY) < 0;
pi.setCanvasMirroredH(pi.canvasMirroredH() ^ mirrorX);
pi.setCanvasMirroredV(pi.canvasMirroredV() ^ mirrorY);
if (pi.canvasMirroredH()!= pi.canvasMirroredV()) {
rotation = normalizeAngleDegrees(360.0 - rotation);
}
pi.setCanvasRotation(normalizeAngleDegrees(pi.canvasRotation() - rotation));
}
void KisToolMultihandHelper::paintAt(const KisPaintInformation &pi)
{
for (int i = 0; i < d->transformations.size(); i++) {
......@@ -72,12 +92,7 @@ void KisToolMultihandHelper::paintAt(const KisPaintInformation &pi)
QLineF rotated = transform.map(rotateme);
__pi.setPos(transform.map(__pi.pos()));
__pi.setCanvasRotation(rotated.angle());
if (__pi.canvasMirroredH()) {
__pi.setCanvasRotation(180-__pi.canvasRotation());
__pi.setCanvasRotation(__pi.canvasRotation()+180);
}
adjustPointInformationRotation(__pi, transform);
paintAt(i, __pi);
}
......@@ -94,23 +109,8 @@ void KisToolMultihandHelper::paintLine(const KisPaintInformation &pi1,
__pi1.setPos(transform.map(__pi1.pos()));
__pi2.setPos(transform.map(__pi2.pos()));
QLineF rotateme(QPointF (0.0,0.0), QPointF (10.0,10.0));
rotateme.setAngle(__pi1.canvasRotation());
QLineF rotated = transform.map(rotateme);
__pi1.setCanvasRotation(rotated.angle());
rotateme.setAngle(__pi2.canvasRotation());
rotated = transform.map(rotateme);
__pi2.setCanvasRotation(rotated.angle());
//check mirroring
if (__pi2.canvasMirroredH()) {
__pi1.setCanvasRotation(180-__pi1.canvasRotation());
__pi1.setCanvasRotation(__pi1.canvasRotation()+180);
__pi2.setCanvasRotation(180-__pi2.canvasRotation());
__pi2.setCanvasRotation(__pi2.canvasRotation()+180);
}
adjustPointInformationRotation(__pi1, transform);
adjustPointInformationRotation(__pi2, transform);
paintLine(i, __pi1, __pi2);
}
......@@ -129,22 +129,8 @@ void KisToolMultihandHelper::paintBezierCurve(const KisPaintInformation &pi1,
__pi1.setPos(transform.map(__pi1.pos()));
__pi2.setPos(transform.map(__pi2.pos()));
QLineF rotateme(QPointF (0.0,0.0), QPointF (10.0,10.0));
rotateme.setAngle(__pi1.canvasRotation());
QLineF rotated = transform.map(rotateme);
__pi1.setCanvasRotation(rotated.angle());
rotateme.setAngle(__pi2.canvasRotation());
rotated = transform.map(rotateme);
__pi2.setCanvasRotation(rotated.angle());
if (__pi2.canvasMirroredH()) {
__pi1.setCanvasRotation(180-__pi1.canvasRotation());
__pi1.setCanvasRotation(__pi1.canvasRotation()+180);
__pi2.setCanvasRotation(180-__pi2.canvasRotation());
__pi2.setCanvasRotation(__pi2.canvasRotation()+180);
}
adjustPointInformationRotation(__pi1, transform);
adjustPointInformationRotation(__pi2, transform);
QPointF __control1 = transform.map(control1);
QPointF __control2 = transform.map(control2);
......
......@@ -88,10 +88,6 @@ public:
KisPaintOpPresetSP preset =
manager->resource(KisCanvasResourceProvider::CurrentPaintOpPreset).value<KisPaintOpPresetSP>();
preset->settings()->setCanvasRotation(rotation);
preset->settings()->setCanvasMirroring(mirrorY, mirrorX);
if (mirrorDabX || mirrorDabY) {
KisPaintOpSettingsSP settings = preset->settings()->clone();
......@@ -143,13 +139,16 @@ public:
resources->setupPainter(&gc);
doPaint(gc);
doPaint(gc, rotation, mirrorX, mirrorY);
checkOneLayer(image, paint1, testName);
}
virtual void doPaint(KisPainter &gc) {
virtual void doPaint(KisPainter &gc, qreal rotation, bool mirrorX, bool mirrorY) {
KisPaintInformation pi(QPointF(100, 100), 1.0);
pi.setCanvasRotation(rotation);
pi.setCanvasMirroredH(mirrorX);